@@ -10,7 +10,10 @@ name: 'dhis2: verify (app)'
1010# 'jobs.release.steps.*.cwd'
1111# 'jobs.release.steps.*.build-dir'
1212
13- on : push
13+ on :
14+ push :
15+ pull_request :
16+ types : [labeled]
1417
1518concurrency :
1619 group : ${{ github.workflow}}-${{ github.ref }}
2326 D2_VERBOSE : true
2427
2528jobs :
29+ setup-matrix :
30+ runs-on : ubuntu-latest
31+ outputs :
32+ matrix : ${{ steps.set-matrix.outputs.specs }}
33+ steps :
34+ - uses : actions/checkout@v3
35+ - name : Generate test matrix
36+ id : set-matrix
37+ run : |
38+ node cypress/support/generateTestMatrix.js > matrix.json
39+ echo "::set-output name=specs::$(cat matrix.json)"
40+
2641 build :
2742 runs-on : ubuntu-latest
2843 steps :
@@ -86,28 +101,49 @@ jobs:
86101 e2e :
87102 runs-on : ubuntu-latest
88103 if : " !github.event.push.repository.fork && github.actor != 'dependabot[bot]'"
104+ needs : [build, lint, test, setup-matrix]
89105
90106 strategy :
91107 fail-fast : false
92108 matrix :
93- containers : [1, 2, 3, 4]
109+ spec-group : ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
94110
95- steps :
96- - name : Checkout
97- uses : actions/checkout@v2
111+ env :
112+ SHOULD_RECORD : ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }}
98113
114+ steps :
115+ - uses : actions/checkout@v2
99116 - uses : actions/setup-node@v1
100117 with :
101118 node-version : 16.x
102119
120+ - name : Set Cypress Record Environment Variables
121+ if : env.SHOULD_RECORD == 'true'
122+ run : |
123+ echo "CYPRESS_GROUP=e2e-${{ matrix.spec-group.id }}" >> $GITHUB_ENV
124+ echo "CYPRESS_TAG=${{ github.event_name }}" >> $GITHUB_ENV
125+ echo "CYPRESS_CI_BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV
126+
127+ - name : Debug Environment Variables
128+ run : |
129+ echo "SHOULD_RECORD=${{ env.SHOULD_RECORD }}"
130+ echo "CI Build ID=${{ github.run_id }}"
131+ echo "Computed Group=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}"
132+ echo "Computed Tag=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}"
133+ echo "Computed CI Build ID=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}"
134+ echo "Spec=${{ join(matrix.spec-group.tests, ',') }}"
135+
103136 - name : End-to-End tests
104137 uses : cypress-io/github-action@v2
105138 with :
106139 start : yarn d2-app-scripts start
107140 wait-on : ' http://localhost:3000'
108141 wait-on-timeout : 300
109- record : true
110- parallel : true
142+ record : ${{ env.SHOULD_RECORD }}
143+ parallel : ${{ env.SHOULD_RECORD }}
144+ group : ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}
145+ tag : ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}
146+ ci-build-id : ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}
111147 env :
112148 BROWSER : none
113149 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments