-
Notifications
You must be signed in to change notification settings - Fork 51
207 lines (184 loc) · 6.79 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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Zwe Remote Integration Tests
permissions:
contents: write
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
- zzow09
- zzow10
- zzow11
- zzow09,zzow10,zzow11
zwe-test:
description: 'Choose Zwe Test'
type: choice
required: true
default: ZWE_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"
# necessary for pull_requests without a caller issuing a workflow_dispatch
set-test-vars:
runs-on: ubuntu-latest
outputs:
test-suite: ${{ steps.set-test-vars.outputs.test-suite }}
test-server: ${{ steps.set-test-vars.outputs.test-server }}
steps:
- name: 'Set Test Vars'
id: set-test-vars
run: |
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "test-suite=${{ github.event.inputs.zwe-test }}" >> $GITHUB_OUTPUT
echo "test-server=${{ github.event.inputs.test-server }}" >> $GITHUB_OUTPUT
else
echo "test-suite=ZWE_CI_Build" >> $GITHUB_OUTPUT
echo "test-server=Any zzow servers" >> $GITHUB_OUTPUT
fi
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: [set-test-vars, 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: ${{ needs.set-test-vars.outputs.test-server }}
install_test_choice: ${{ needs.set-test-vars.outputs.test-suite }}
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@v4
- name: '[Prep 2] Setup Node'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: '[Prep 3] Cache node modules'
uses: actions/cache@v4
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 Dependencies'
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-${{ matrix.server }}-lock
lock-avg-retry-interval: 60
- name: '[Pre-Test] Prepare configuration YAML'
working-directory: ${{ env.ZWE_TEST_PATH }}
run: echo "$ZWE_INTEGRATION_YAML" > config.yaml
shell: bash
env:
ZWE_INTEGRATION_YAML: ${{ secrets.ZWE_INTEGRATION_YAML }}
- name: '[Test] CI Test Suite'
if: ${{ matrix.test == 'ZWE_CI_Build' }}
timeout-minutes: 180
working-directory: ${{ env.ZWE_TEST_PATH }}
run: npm run test:ci
env:
TEST_CONFIG_FILE: config.yaml
ZOS_HOST: ${{ secrets.SSH_HOST }}
ZOS_USER: ${{ secrets.SSH_USER }}
ZOS_PASSWORD: ${{ secrets.SSH_PASSWORD }}
ZOSMF_PORT: ${{ secrets.ZOSMF_PORT }}
SSH_PORT: ${{ secrets.SSH_PORT }}
JFROG_USER: ${{ secrets.ZWE_TEST_RT_USER }}
JFROG_TOKEN: ${{ secrets.ZWE_TEST_RT_TOKEN }}
- name: '[Test] Extended Test Suite'
if: ${{ matrix.test == 'ZWE_Full_Tests' }}
timeout-minutes: 180
working-directory: ${{ env.ZWE_TEST_PATH }}
run: npm run test:extended
env:
TEST_CONFIG_FILE: ${{ env.ZWE_TEST_PATH }}/config.yaml
ZOS_HOST: ${{ secrets.SSH_HOST }}
ZOS_USER: ${{ secrets.SSH_USER }}
ZOS_PASSWORD: ${{ secrets.SSH_PASSWORD }}
ZOSMF_PORT: ${{ secrets.ZOSMF_PORT }}
SSH_PORT: ${{ secrets.SSH_PORT }}
JFROG_USER: ${{ secrets.ZWE_TEST_RT_USER }}
JFROG_TOKEN: ${{ secrets.ZWE_TEST_RT_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@v4
with:
name: ZweTestReports-${{ env.TEST_NAME }}-${{ matrix.server }}-${{ github.run_id }}-${{ env.CURRENT_TIME }}
path: ${{ env.ZWE_TEST_PATH }}/reports/