Skip to content

update rules regex from Roberts bioregistry-collection #4853

update rules regex from Roberts bioregistry-collection

update rules regex from Roberts bioregistry-collection #4853

name: End to end testing for Portals
on:
push:
pull_request:
branches: [main]
env:
PW_ALL_BLOBS_DIR: playwright-result-blob-
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,
challenges,
digitalhealth,
eliteportal,
genie,
nf,
stopadportal,
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4
- uses: ./.github/actions/pnpm-setup-action
- name: Determine if portal has had any changes
run: |
affected=$(pnpm nx show projects --affected)
affected_array=($affected)
echo "Affected projects: ${affected_array[@]}"
for project in "${affected_array[@]}"; do
echo "Comparing: '$project' with '${{ matrix.PORTAL }}'"
if [[ "$project" == "${{ matrix.PORTAL }}" ]]; then
echo "Project is affected; setting PROJECT_AFFECTED=true"
echo "PROJECT_AFFECTED=true" >> "$GITHUB_ENV"
exit 0
fi
done
echo "Project is not affected; setting PROJECT_AFFECTED=false"
echo "PROJECT_AFFECTED=false" >> "$GITHUB_ENV"
- name: Build portal
if: ${{ env.PROJECT_AFFECTED == 'true' }}
run: pnpm nx run portals-e2e:portal:build
env:
PORTAL: ${{ matrix.PORTAL }}
- name: Install Playwright Browsers
if: ${{ env.PROJECT_AFFECTED == 'true' }}
run: |
cd "${{ env.PORTALS_E2E_SUBDIR }}"
pnpm playwright install --with-deps
- name: Run e2e tests
if: ${{ env.PROJECT_AFFECTED == 'true' }}
run: pnpm nx run portals-e2e:e2e
env:
PORTAL: ${{ matrix.PORTAL }}
- name: Upload blob report to GitHub Actions Artifacts
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: ${{ env.PW_ALL_BLOBS_DIR }}${{ matrix.PORTAL }}
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
with:
fetch-depth: 0
- uses: ./.github/actions/pnpm-setup-action
- name: Download blob reports from GitHub Actions Artifacts
uses: actions/download-artifact@v4
with:
pattern: ${{ env.PW_ALL_BLOBS_DIR }}*
path: ${{ env.PORTALS_E2E_SUBDIR }}/${{ env.PW_ALL_BLOBS_DIR }}
merge-multiple: true
- name: Check if any E2E tests ran
run: |
cd ${{ env.PORTALS_E2E_SUBDIR }};
if [ ! -d "${{ env.PW_ALL_BLOBS_DIR }}" ]; then
exit 0
fi
- name: Merge into HTML Report
run: |
cd ${{ env.PORTALS_E2E_SUBDIR }};
if [ ! -d "${{ env.PW_ALL_BLOBS_DIR }}" ]; then
exit 0
else
pnpm exec playwright merge-reports --reporter html ./"${{ env.PW_ALL_BLOBS_DIR }}"
fi
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
path: '${{ env.PORTALS_E2E_SUBDIR }}/playwright-report'
retention-days: 14