|
| 1 | +name: 'e2e development' |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: ['opened', 'labeled', 'reopened', 'synchronize'] |
| 6 | + |
| 7 | +env: |
| 8 | + CI: true |
| 9 | + DEV_URL: 'https://test.e2e.dhis2.org/analytics-dev' |
| 10 | + API_VERSION: 42 |
| 11 | + SHOULD_RECORD: ${{ contains(github.event.pull_request.labels.*.name, 'e2e record') }} |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow}}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +defaults: |
| 18 | + run: |
| 19 | + shell: bash |
| 20 | + |
| 21 | +jobs: |
| 22 | + setup-matrix: |
| 23 | + if: ${{ contains(github.event.pull_request.labels.*.name, 'e2e dev') }} |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + matrix: ${{ steps.set-matrix.outputs.specs }} |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - name: Generate Test matrix |
| 30 | + id: set-matrix |
| 31 | + run: echo "::set-output name=specs::$(node cypress/support/generateTestMatrix.js)" |
| 32 | + |
| 33 | + e2e-dev: |
| 34 | + needs: setup-matrix |
| 35 | + if: ${{ contains(github.event.pull_request.labels.*.name, 'e2e dev') }} |
| 36 | + runs-on: ubuntu-latest |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + spec-group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: 20.x |
| 46 | + - name: Install |
| 47 | + run: yarn install --frozen-lockfile |
| 48 | + |
| 49 | + - name: Generate translations |
| 50 | + run: yarn d2-app-scripts i18n generate |
| 51 | + |
| 52 | + - name: Run e2e tests |
| 53 | + uses: cypress-io/github-action@v5 |
| 54 | + with: |
| 55 | + start: yarn d2-app-scripts start |
| 56 | + wait-on: 'http://localhost:3000' |
| 57 | + wait-on-timeout: 300 |
| 58 | + record: ${{ env.SHOULD_RECORD == 'true' }} |
| 59 | + parallel: ${{ env.SHOULD_RECORD == 'true' }} |
| 60 | + browser: chrome |
| 61 | + spec: ${{ join(matrix.spec-group.tests, ',') }} |
| 62 | + group: ${{ env.SHOULD_RECORD == 'true' && format('e2e-chrome-parallel-{0}', matrix.spec-group.id) || '' }} |
| 63 | + ci-build-id: ${{ env.SHOULD_RECORD == 'true' && github.run_id || '' }} |
| 64 | + env: |
| 65 | + CI: true |
| 66 | + BROWSER: none |
| 67 | + CYPRESS_RECORD_KEY: ${{ secrets.recordkey }} |
| 68 | + CYPRESS_dhis2BaseUrl: ${{ env.DEV_URL }} |
| 69 | + CYPRESS_dhis2InstanceVersion: ${{ env.API_VERSION }} |
| 70 | + CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} |
| 71 | + CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} |
| 72 | + CYPRESS_networkMode: live |
| 73 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments