Skip to content

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
env:
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Unit Test
run: npm run test
build-and-test-local:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: |
npm ci
npx playwright install
npx playwright install-deps
- name: Build
run: npm run build
- name: Run tests
run: npm run integration-test
cucumber-build-and-test-local:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Dependencies
run: |
npm ci
npx playwright install
npx playwright install-deps
- name: Build
run: npm run build
- name: Local Tests
working-directory: tests/fixtures/local/cucumber/
run: |
npm i
node ../../../../ --suiteName "cucumber local test" --runCfgPath ./sauce-runner.json
node ../../../../ --suiteName "cucumber config test" --runCfgPath ./sauce-runner.json
build-windows-bundle:
runs-on: windows-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Google Cloud Login
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCS_RUNNER_SA_KEY }}'
- name: Install gcloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCS_RUNNER_PROJECT_ID }}
env:
CLOUDSDK_PYTHON: ${{env.pythonLocation}}\python.exe
- name: Update Release Version
run: npm version --no-git-tag-version 1.0.0
- name: Bundle Directory
run: bash ./scripts/bundle.sh
- name: Archive Bundle
uses: azure/powershell@v2
with:
inlineScript: |
Compress-Archive bundle/ playwright-windows-amd64.zip
azPSVersion: '3.1.0'
- name: Upload to GCS
run: |
gsutil cp ./playwright-windows-amd64.zip gs://${{ secrets.GCS_RUNNER_BUCKET }}/playwright-windows-amd64-${{ github.run_id }}.zip
build-macos-bundle:
# macos-latest is arm only
runs-on: macos-13
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Google Cloud Login
id: "auth"
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.GCS_RUNNER_SA_KEY }}'
- name: Install gcloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCS_RUNNER_PROJECT_ID }}
env:
CLOUDSDK_PYTHON: ${{env.pythonLocation}}/python
- name: Update Release Version
run: npm version --no-git-tag-version 1.0.0
- name: Bundle Directory
run: bash ./scripts/bundle.sh
- name: Archive Bundle
run: zip --symlinks -r playwright-macos-amd64.zip bundle/
- name: Upload to GCS
run: |
gsutil cp ./playwright-macos-amd64.zip gs://${{ secrets.GCS_RUNNER_BUCKET }}/playwright-macos-amd64-${{ github.run_id }}.zip
bundle-test:
needs: [build-windows-bundle, build-macos-bundle]
strategy:
max-parallel: 3
matrix:
os: [Win10, Win11, macOS12, macOS13]
browser: [Chromium, Firefox, Webkit]
exclude:
- os: macOS12
browser: Webkit
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup saucectl
uses: saucelabs/saucectl-run-action@v4
env:
GITHUB_TOKEN: ${{ github.token }}
with:
skip-run: true
saucectl-version: v0.184.1
- name: Test on Sauce
working-directory: ./tests/fixtures/cloud
run: |
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/playwright-windows-amd64-${{ github.run_id }}.zip
if [[ ${{ matrix.os }} =~ ^macOS ]];then
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/playwright-macos-amd64-${{ github.run_id }}.zip
fi
saucectl run \
--runner-version "url: ${BUNDLE_URL}" \
--config .sauce/config.yml \
--select-suite "${{ matrix.os }} - ${{ matrix.browser }}"
bundle-test-with-sauce-connect:
needs: [build-windows-bundle, build-macos-bundle]
strategy:
max-parallel: 3
matrix:
os: [Win10, Win11, macOS12, macOS13]
browser: [Chromium, Firefox, Webkit]
exclude:
- os: Win10
browser: Webkit
- os: Win11
browser: Webkit
- os: macOS12
browser: Webkit
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup saucectl
uses: saucelabs/saucectl-run-action@v4
env:
GITHUB_TOKEN: ${{ github.token }}
with:
skip-run: true
saucectl-version: v0.184.1
- name: Run web-page
run: |
python -m http.server 8000 &
working-directory: ./tests/fixtures/cloud/www/
- name: Start sauce-connect
uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelName: github-playwright-sc-check-tunnel-${{ matrix.os }}-${{ matrix.browser }}
scVersion: 4.9.2
- name: Test on Sauce
working-directory: ./tests/fixtures/cloud
run: |
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/playwright-windows-amd64-${{ github.run_id }}.zip
if [[ ${{ matrix.os }} =~ ^macOS ]];then
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/playwright-macos-amd64-${{ github.run_id }}.zip
fi
saucectl run \
--runner-version "url: ${BUNDLE_URL}" \
--config .sauce/config-sc.yml \
--tunnel-name github-playwright-sc-check-tunnel-${{ matrix.os }}-${{ matrix.browser }} \
--select-suite "${{ matrix.os }} - ${{ matrix.browser }}"
cucumber-bundle-test:
needs: [build-windows-bundle, build-macos-bundle]
strategy:
fail-fast: false
matrix:
os: [win, mac]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Setup saucectl
uses: saucelabs/saucectl-run-action@v4
env:
GITHUB_TOKEN: ${{ github.token }}
with:
skip-run: true
saucectl-version: v0.184.1
- name: Test on Sauce
working-directory: ./tests/fixtures/cloud/cucumber
run: |
npm ci --production
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/playwright-windows-amd64-${{ github.run_id }}.zip
if [[ ${{ matrix.os }} = mac ]];then
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/playwright-macos-amd64-${{ github.run_id }}.zip
fi
saucectl run \
--runner-version "url: ${BUNDLE_URL}" \
--config .sauce/config_${{ matrix.os }}.yml