Skip to content

Commit

Permalink
chore: try shared e2e workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Jul 30, 2024
1 parent 4d69347 commit 2f32080
Showing 1 changed file with 85 additions and 70 deletions.
155 changes: 85 additions & 70 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]' &&
Expand Down

0 comments on commit 2f32080

Please sign in to comment.