From 2f32080bf1cf60c627595cf77f788bbf93c7a080 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 30 Jul 2024 15:57:01 +0200 Subject: [PATCH] chore: try shared e2e workflow --- .github/workflows/dhis2-verify-app.yml | 155 ++++++++++++++----------- 1 file changed, 85 insertions(+), 70 deletions(-) diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml index 1c6f87f32..c971c89ba 100644 --- a/.github/workflows/dhis2-verify-app.yml +++ b/.github/workflows/dhis2-verify-app.yml @@ -86,80 +86,95 @@ jobs: - name: Test run: yarn d2-app-scripts test - e2e-prod: - runs-on: ubuntu-latest - needs: [test, setup-matrix] + call-workflow-e2e-prod: if: "!contains(github.event.head_commit.message, '[skip ci]')" - - strategy: - fail-fast: false - matrix: - spec-group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} - - env: - SHOULD_RECORD: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }} - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18.x - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: '**/node_modules' - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} - - - name: Set Cypress Record Environment Variables - if: env.SHOULD_RECORD == 'true' - run: | - echo "CYPRESS_GROUP=e2e-${{ matrix.spec-group.id }}" >> $GITHUB_ENV - echo "CYPRESS_TAG=${{ github.event_name }}" >> $GITHUB_ENV - echo "CYPRESS_CI_BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV - - - name: Debug Environment Variables - run: | - echo "SHOULD_RECORD=${{ env.SHOULD_RECORD }}" - echo "CI Build ID=${{ github.run_id }}" - echo "Computed Group=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}" - echo "Computed Tag=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}" - echo "Computed CI Build ID=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}" - echo "Spec=${{ join(matrix.spec-group.tests, ',') }}" - - - name: End-to-End tests - uses: cypress-io/github-action@v5 - with: - start: ${{ env.SERVER_START_CMD }} - wait-on: ${{ env.SERVER_URL }} - wait-on-timeout: 300 - cache-key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} - record: ${{ env.SHOULD_RECORD }} - parallel: ${{ env.SHOULD_RECORD }} - group: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }} - tag: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }} - ci-build-id: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }} - spec: ${{ join(matrix.spec-group.tests, ',') }} - env: - CI: true - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} - SERVER_START_CMD: 'yarn cy:start' - SERVER_URL: 'http://localhost:3000' - cypress_dhis2_api_stub_mode: 'DISABLED' - REACT_APP_DHIS2_BASE_URL: ${{ secrets.CYPRESS_DHIS2_BASE_URL_41 }} - cypress_dhis2_base_url: ${{ secrets.CYPRESS_DHIS2_BASE_URL_41}} - cypress_dhis2BaseUrl: ${{ secrets.CYPRESS_DHIS2_BASE_URL_41}} - CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} - CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} - CYPRESS_dhis2InstanceVersion: '2.41' - cypress_dhis2_username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} - cypress_dhis2_password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + needs: [build, lint, test, setup-matrix] + uses: dhis2/workflows/.github/workflows/analytics-e2e-tests-prod.yml@master + with: + should_record: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record')}} + spec-group: ${{ needs.setup-matrix.outputs.matrix }} + secrets: + username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} + password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} + recordkey: ${{ secrets.CYPRESS_RECORD_KEY }} + reportportal_api_key: ${{ secrets.REPORTPORTAL_API_KEY }} + reportportal_endpoint: ${{ vars.REPORTPORTAL_ENDPOINT }} + reportportal_project: ${{ vars.REPORTPORTAL_PROJECT }} + + # e2e-prod: + # runs-on: ubuntu-latest + # needs: [test, setup-matrix] + # if: "!contains(github.event.head_commit.message, '[skip ci]')" + + # strategy: + # fail-fast: false + # matrix: + # spec-group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + + # env: + # SHOULD_RECORD: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }} + + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-node@v3 + # with: + # node-version: 18.x + + # - uses: actions/cache@v2 + # id: yarn-cache + # with: + # path: '**/node_modules' + # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} + + # - name: Set Cypress Record Environment Variables + # if: env.SHOULD_RECORD == 'true' + # run: | + # echo "CYPRESS_GROUP=e2e-${{ matrix.spec-group.id }}" >> $GITHUB_ENV + # echo "CYPRESS_TAG=${{ github.event_name }}" >> $GITHUB_ENV + # echo "CYPRESS_CI_BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV + + # - name: Debug Environment Variables + # run: | + # echo "SHOULD_RECORD=${{ env.SHOULD_RECORD }}" + # echo "CI Build ID=${{ github.run_id }}" + # echo "Computed Group=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}" + # echo "Computed Tag=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}" + # echo "Computed CI Build ID=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}" + # echo "Spec=${{ join(matrix.spec-group.tests, ',') }}" + + # - name: End-to-End tests + # uses: cypress-io/github-action@v5 + # with: + # start: ${{ env.SERVER_START_CMD }} + # wait-on: ${{ env.SERVER_URL }} + # wait-on-timeout: 300 + # cache-key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} + # record: ${{ env.SHOULD_RECORD }} + # parallel: ${{ env.SHOULD_RECORD }} + # group: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }} + # tag: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }} + # ci-build-id: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }} + # spec: ${{ join(matrix.spec-group.tests, ',') }} + # env: + # CI: true + # CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + # COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} + # SERVER_START_CMD: 'yarn cy:start' + # SERVER_URL: 'http://localhost:3000' + # cypress_dhis2_api_stub_mode: 'DISABLED' + # REACT_APP_DHIS2_BASE_URL: ${{ secrets.CYPRESS_DHIS2_BASE_URL_41 }} + # cypress_dhis2_base_url: ${{ secrets.CYPRESS_DHIS2_BASE_URL_41}} + # cypress_dhis2BaseUrl: ${{ secrets.CYPRESS_DHIS2_BASE_URL_41}} + # CYPRESS_dhis2Username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} + # CYPRESS_dhis2Password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} + # CYPRESS_dhis2InstanceVersion: '2.41' + # cypress_dhis2_username: ${{ secrets.CYPRESS_DHIS2_USERNAME }} + # cypress_dhis2_password: ${{ secrets.CYPRESS_DHIS2_PASSWORD }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} release: runs-on: ubuntu-latest - needs: e2e-prod + needs: call-workflow-e2e-prod if: | !github.event.push.repository.fork && github.actor != 'dependabot[bot]' &&