-
Notifications
You must be signed in to change notification settings - Fork 85
125 lines (106 loc) · 3.82 KB
/
zowe-cli.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Zowe CLI
on:
push:
paths-ignore:
- 'zowex/**'
- '.github/workflows/rust-cli*.yml'
pull_request:
paths-ignore:
- 'zowex/**'
- '.github/workflows/rust-cli*.yml'
workflow_dispatch:
inputs:
binary-type:
description: "Specify whether to use a `debug` or a `release` version of the binary"
default: "debug"
required: false
test-type:
description: "Specify whether to run tests using the `binary` or regular `nodejs` executable"
default: 'binary'
required: false
jobs:
test:
name: Cross-Platform Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [12.x, 14.x, 16.x]
os: [windows-latest, ubuntu-latest, macos-latest]
env:
OS: ${{ matrix.os }}
NODE: ${{ matrix.node-version }}
NODE_OPTIONS: --max_old_space_size=4096
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && !contains(github.event.head_commit.message, '[ci skip]')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Get NPM Version
id: npm-version
run: echo "::set-output name=number::$(npm --version)"
- name: Use NPM v8
id: npm8
run: npm install -g npm@^8
- name: Install Node Package Dependencies
id: install
run: npm ci
- name: Use Original NPM Version
id: original-npm-version
run: npm install -g npm@${{ steps.npm-version.outputs.number }}
- name: Install Rust toolchain
id: install-rust
if: github.event.inputs.test-type == 'binary'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Build Source
id: build
run: npm run build --if-present
- name: Build Binary
id: build-binary
if: github.event.inputs.test-type == 'binary'
run: |
cargo build --verbose ${{ github.event.inputs.binary-type == 'release' && '--release' || '' }} --manifest-path=zowex/Cargo.toml
tar -cvzf zowe.tgz -C zowex/target/${{ github.event.inputs.binary-type == 'release' && 'release' || 'debug' }} zowe${{ matrix.os == 'windows-latest' && '.exe' || '' }}
- name: Archive Binary
if: github.event.inputs.test-type == 'binary'
id: upload-binary
uses: actions/upload-artifact@v2
with:
name: zowe-${{ matrix.os }}.tgz
path: zowe.tgz
- name: Setup Binary in PATH
if: github.event.inputs.test-type == 'binary'
id: setup-binary
run: tar -xvzf zowe.tgz -C ./node_modules/.bin --overwrite
- name: Unit Tests
id: unit
if: ${{ always() && steps.build.outcome == 'success' }}
run: npm run test:unit >> unit-tests.txt
- name: Integration Tests
id: integration
if: ${{ always() && steps.build.outcome == 'success' }}
run: npm run test:integration >> integration-tests.txt
- name: Archive Results
id: upload
if: ${{ always() && steps.build.outcome == 'success' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}-results
path: |
__tests__/__results__/
unit-tests.txt
integration-tests.txt
- name: Upload Results to Codecov
if: ${{ always() && steps.build.outcome == 'success' }}
uses: codecov/[email protected]
with:
env_vars: OS,NODE