Skip to content

demo.playwright.failed-only-shards #12

demo.playwright.failed-only-shards

demo.playwright.failed-only-shards #12

name: demo.playwright.failed-only-shards
on:
workflow_dispatch:
jobs:
test-shards:
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
timeout-minutes: 60
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:latest
env:
CURRENTS_PROJECT_ID: ${{ secrets.CURRENTS_PROJECT_ID }}
CURRENTS_RECORD_KEY: ${{ secrets.CURRENTS_RECORD_KEY }}
CURRENTS_CI_BUILD_ID: shards-${{ github.repository }}-${{ github.run_id }}-${{ github.run_attempt }}
CURRENTS_API_URL: ${{ secrets.CURRENTS_API_URL }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
# https://github.com/actions/runner-images/issues/6775
- run: |
echo "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Install dependencies
run: |
npm ci
npx playwright install chrome
npm install -g @currents/cmd@beta
- name: Prepare environment & load last run from cache for shard ${{ matrix.shard }}
env:
DEBUG: "currents,currents:*"
run: |
echo "GH_STRATEGY_JOB_INDEX=${{ strategy.job-index }}" >> $GITHUB_ENV
echo "GH_STRATEGY_JOB_TOTAL=${{ strategy.job-total }}" >> $GITHUB_ENV
npx currents cache get --preset last-run --pw-output-dir basic/test-results --pw-config-dump .pw_config_dump
echo "EXTRA_PW_FLAGS=$(cat .pw_config_dump)" >> $GITHUB_ENV
- name: Run Tests
working-directory: ./basic
run: |
COMMAND="npx pwc ${{ env.EXTRA_PW_FLAGS }}"
echo "Running command: $COMMAND"
$COMMAND
- name: Cache the last run results for shard ${{ matrix.shard }}
env:
DEBUG: "currents,currents:*"
if: ${{ always() }}
run: |
echo "GH_STRATEGY_JOB_INDEX=${{ strategy.job-index }}" >> $GITHUB_ENV
echo "GH_STRATEGY_JOB_TOTAL=${{ strategy.job-total }}" >> $GITHUB_ENV
npx currents cache set --preset last-run --pw-output-dir basic/test-results