ZWE Integration Test Framework #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |