From 693adb417e14471e7c8e2c7656c4676a22c56e40 Mon Sep 17 00:00:00 2001 From: larabr <7375870+larabr@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:07:31 +0200 Subject: [PATCH] CI: run browser tests also on Linux To test platform potential specific code of e.g. the WebCrypto API Testing on Windows would be nice too, but all browsers fail to fetch resources from the web-test-runner server. --- .github/workflows/tests.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9893a7e9..291c02b3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,8 +57,15 @@ jobs: test-browsers-latest: name: Browsers (latest) - runs-on: ubuntu-latest needs: build + strategy: + fail-fast: false # if tests for one version fail, continue with the rest + matrix: + # run on all main platforms to test platform-specific code, if present + # (e.g. webkit's WebCrypto API implementation is different in macOS vs Linux) + # TODO: windows-latest fails to fetch resources from the wtr server; investigate if the problem is with path declaration or permissions + runner: ['ubuntu-latest', 'macos-latest'] + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 @@ -79,17 +86,19 @@ jobs: npm pkg delete scripts.prepare npm ci - - name: Get Playwright version + - name: Get Playwright version and cache location id: playwright-version run: | PLAYWRIGHT_VERSION=$(npm ls playwright --depth=0 | grep playwright | sed 's/.*@//') echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT + PLAYWRIGHT_CACHE=${{ fromJSON('{"ubuntu-latest": "~/.cache/ms-playwright", "macos-latest": "~/Library/Caches/ms-playwright"}')[matrix.runner] }} + echo "playwright_cache=$PLAYWRIGHT_CACHE" >> $GITHUB_OUTPUT - name: Check for cached browsers id: cache-playwright-browsers uses: actions/cache@v4 with: - path: ~/.cache/ms-playwright - key: playwright-browsers-${{ steps.playwright-version.outputs.version }} + path: ${{ steps.playwright-version.outputs.playwright_cache }} + key: playwright-browsers-${{ matrix.runner }}-${{ steps.playwright-version.outputs.version }} - name: Install browsers if: steps.cache-playwright-browsers.outputs.cache-hit != 'true' run: |