Skip to content

Commit

Permalink
ci: Pull out in-browser tests into their own parallelized job
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 committed Sep 18, 2024
1 parent 35f1fda commit 589cde1
Showing 1 changed file with 59 additions and 4 deletions.
63 changes: 59 additions & 4 deletions .github/workflows/test_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,55 @@ jobs:
working-directory: web
run: npm test

- name: Upload artifacts
if: matrix.os == 'ubuntu-22.04' && matrix.node_version == '22'
uses: actions/upload-artifact@v4
with:
name: selfhosted-dist
path: web/packages/selfhosted/dist

browser-tests:
# Only the instance that uploads the artifact is really needed, but there's no way to express that.
# See: https://github.com/orgs/community/discussions/42335
needs: build
if: needs.changes.outputs.should_run == 'true'
name: Test in ${{ matrix.browser }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
browser: ["chrome", "firefox", "edge"]

steps:
- uses: actions/checkout@v4

- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: selfhosted-dist
path: web/packages/selfhosted/dist

- name: Run browser-based tests
# Don't run browser tests on Windows because it's flaky for unknown reasons. :-(
if: runner.os == 'Linux'
working-directory: web
run: npm run wdio -- --headless --chrome --firefox --edge
shell: bash -l {0}
run: |
npm ci
npm run wdio -- --headless --${{ matrix.browser }}
check-required:
# The rest is needed only because otherwise the real jobs couldn't be made required for merging PRs,
# as they would fail the entire workflow run if skipped - this makes GitHub happy instead.
# See:
# - https://github.com/orgs/community/discussions/13690
# - https://github.com/orgs/community/discussions/44490

build-dummy:
needs: changes
if: needs.changes.outputs.should_run == 'false'
name: Test Node.js ${{ matrix.node_version }} / ${{ matrix.os }}
Expand All @@ -112,3 +154,16 @@ jobs:
steps:
- name: No-op
run: echo noop

browser-tests-dummy:
needs: build
if: needs.changes.outputs.should_run == 'false'
name: Test in ${{ matrix.browser }}
runs-on: ubuntu-22.04
strategy:
matrix:
browser: ["chrome", "firefox", "edge"]

steps:
- name: No-op
run: echo noop

0 comments on commit 589cde1

Please sign in to comment.