-
Notifications
You must be signed in to change notification settings - Fork 51
190 lines (169 loc) · 6.21 KB
/
zwe-integration-tests.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Zwe Remote Integration Tests
permissions: read-all
on:
pull_request:
types: [opened, synchronize]
workflow_dispatch:
inputs:
test-server:
description: 'Choose Test Server'
type: choice
required: true
default: 'Any zzow servers'
options:
- Any zzow servers
- zzow06
- zzow07
- zzow08
zwe-test:
description: 'Choose Zwe Test'
type: choice
required: true
default: CI Build
options:
- ZWE CI Build
- ZWE Full Tests
RANDOM_DISPATCH_EVENT_ID:
description: 'random dispatch event id'
required: false
type: string
# create a new branch to overwrite following defaults if necessary
env:
# constants
ZWE_TEST_PATH: tests/zwe-remote-integration
jobs:
display-dispatch-event-id:
if: github.event.inputs.RANDOM_DISPATCH_EVENT_ID != ''
runs-on: ubuntu-latest
steps:
- name: RANDOM_DISPATCH_EVENT_ID is ${{ github.event.inputs.RANDOM_DISPATCH_EVENT_ID }}
run: echo "prints random dispatch event id sent from workflow dispatch event"
check-permission:
runs-on: ubuntu-latest
steps:
# this action will fail the whole workflow if permission check fails
- name: check permission
uses: zowe-actions/shared-actions/permission-check@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
make-matrix:
runs-on: ubuntu-latest
needs: check-permission
steps:
- name: '[Prep 1] Checkout'
uses: actions/checkout@v2
- name: Make matrix
id: set-matrix
run: |
cd .github/scripts/cicd_test
chmod +x make_matrix.sh
source make_matrix.sh
env:
test_server: ${{ github.event.inputs.test-server }}
install_test_choice: ${{ github.event.inputs.zwe-test }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
cicd-test:
runs-on: ubuntu-latest
needs: make-matrix
strategy:
matrix: ${{ fromJson(needs.make-matrix.outputs.matrix) }}
fail-fast: false
environment: ${{ matrix.server }}
steps:
- name: '[Prep 1] Checkout'
uses: actions/checkout@v2
- name: '[Prep 2] Setup Node'
uses: actions/setup-node@v3
with:
node-version: '20'
- name: '[Prep 3] Cache node modules'
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: |
~/.npm
~/.nvm/.cache
~/.nvm/versions
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('tests/installation/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-cache-node-modules-
- name: '[Prep 4] Setup jFrog CLI'
uses: jfrog/setup-jfrog-cli@v2
env:
JF_ENV_1: ${{ secrets.JF_ARTIFACTORY_TOKEN }}
- name: '[Prep 5] Validate package.json'
uses: zowe-actions/shared-actions/validate-package-json@main
- name: '[Prep 6] Prepare workflow'
uses: zowe-actions/shared-actions/prepare-workflow@main
- name: '[Setup 1] Test Project Install'
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
npm ci
# Error on this step is likely a schema mismatch. See test README
- name: '[Setup 2] Test Project Build'
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
npm run build
- name: '[Lint 1] Lint 1'
timeout-minutes: 2
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
npm run lint
- name: '[LOCK] Lock marist servers'
uses: zowe-actions/shared-actions/lock-resource@main
with:
lock-repository: ${{ github.repository }}
github-token: ${{ secrets.GITHUB_TOKEN }}
lock-resource-name: zowe-zwe-system-test-${{ steps.more-test-prep.outputs.TEST_SERVER }}-lock
lock-avg-retry-interval: 60
- name: '[Test] Test starts from here'
if: ${{ github.event.inputs.zwe-test == 'ZWE CI Build' }}
timeout-minutes: 180
working-directory: ${{ env.ZWE_TEST_PATH }}
run: npm run test:ci
env:
ANSIBLE_FORCE_COLOR: true
TEST_SERVER: ${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }}
ZOS_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
ZOS_USER: ${{ secrets.SSH_USER }}
ZOS_PASSWORD: ${{ secrets.SSH_PASSWORD }}
ZOSMF_PORT: 10443
ZOS_JAVA_HOME: /ZOWE/node/J8.0_64
ZOS_NODE_HOME: /ZOWE/node/node-v18.16.0
REJECT_UNAUTHORIZED: false
REMOTE_TEST_DIR: /ZOWE/zwe-integration
TEST_VOLUME: ZOS003
JFROG_TOKEN: ${{ secrets.JF_ARTIFACTORY_TOKEN }}
- name: '[Test] Test starts from here'
if: ${{ github.event.inputs.zwe-test == 'ZWE Full Tests' }}
timeout-minutes: 180
working-directory: ${{ env.ZWE_TEST_PATH }}
run: npm run test:extended
env:
ANSIBLE_FORCE_COLOR: true
TEST_SERVER: ${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }}
ZOS_HOST: ${{ secrets.SSH_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
ZOS_USER: ${{ secrets.SSH_USER }}
ZOS_PASSWORD: ${{ secrets.SSH_PASSWORD }}
ZOSMF_PORT: 10443
ZOS_JAVA_HOME: /ZOWE/node/J8.0_64
ZOS_NODE_HOME: /ZOWE/node/node-v18.16.0
REJECT_UNAUTHORIZED: false
REMOTE_TEST_DIR: /ZOWE/zwe-integration
TEST_VOLUME: ZOS003
JFROG_TOKEN: ${{ secrets.JF_ARTIFACTORY_TOKEN }}
- name: '[After Test 1] Prepare to upload test report'
if: always()
working-directory: ${{ env.ZWE_TEST_PATH }}
run: |
echo CURRENT_TIME=$(date +%s) >> $GITHUB_ENV
echo TEST_NAME=$(echo "${{ matrix.test }}" | sed 's#.*\/##g') >> $GITHUB_ENV
- name: '[After Test 2] Upload test report'
if: always()
uses: actions/upload-artifact@v3
with:
name: ZweTestReports-${{ env.TEST_NAME }}-${{ steps.more-test-prep.outputs.TEST_SERVER_NICKNAME }}-${{ github.run_id }}-${{ env.CURRENT_TIME }}
path: ${{ env.ZWE_TEST_PATH }}/reports/