Merge pull request #1355 from nickgros/SWC-7064d #2461
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: End to end testing for Portals | |
on: | |
push: | |
pull_request: | |
branches: [main] | |
env: | |
PW_ALL_BLOBS_DIR: all-blob-reports | |
PORTALS_E2E_SUBDIR: apps/portals-e2e | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
e2e-tests: | |
if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.actor == github.repository_owner)) || github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
max-parallel: ${{ github.repository_owner == 'Sage-Bionetworks' && 5 || 10 }} | |
matrix: | |
PORTAL: | |
[ | |
adknowledgeportal, | |
arkportal, | |
bsmn, | |
cancercomplexity, | |
challengeportal, | |
digitalhealth, | |
elportal, | |
genie, | |
nf, | |
stopadportal, | |
] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/pnpm-setup-action | |
- name: Build portal | |
run: pnpm nx run portals-e2e:portal:build | |
env: | |
PORTAL: ${{ matrix.PORTAL }} | |
- name: Install Playwright Browsers | |
run: | | |
cd "${{ env.PORTALS_E2E_SUBDIR }}" | |
pnpm playwright install --with-deps | |
- name: Run e2e tests | |
run: pnpm nx run portals-e2e:e2e | |
env: | |
PORTAL: ${{ matrix.PORTAL }} | |
- name: Upload blob report to GitHub Actions Artifacts | |
uses: actions/upload-artifact@v3 | |
if: ${{ always() }} | |
with: | |
name: ${{ env.PW_ALL_BLOBS_DIR }} | |
path: '${{ env.PORTALS_E2E_SUBDIR }}/blob-report' | |
retention-days: 1 | |
merge-e2e-reports: | |
# Merge reports after e2e-tests, even if some shards have failed | |
# But skip this job if the previous job was cancelled or skipped | |
if: ${{ !cancelled() && needs.e2e-tests.result != 'skipped' }} | |
needs: [e2e-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/pnpm-setup-action | |
- name: Download blob reports from GitHub Actions Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{ env.PW_ALL_BLOBS_DIR }} | |
path: ${{ env.PORTALS_E2E_SUBDIR }}/${{ env.PW_ALL_BLOBS_DIR }} | |
- name: Merge into HTML Report | |
run: cd ${{ env.PORTALS_E2E_SUBDIR }}; pnpm exec playwright merge-reports --reporter html ./"${{ env.PW_ALL_BLOBS_DIR }}" | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: html-report--attempt-${{ github.run_attempt }} | |
path: '${{ env.PORTALS_E2E_SUBDIR }}/playwright-report' | |
retention-days: 14 |