Bundle npm&npx #721
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Unit Test | |
run: npm run unit-test | |
- name: Lint | |
run: npm run lint | |
build-and-test-local: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
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@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
- name: Install dependencies | |
run: | | |
npm ci | |
npm i @cucumber/cucumber | |
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@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Google Cloud Login | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.GCS_RUNNER_SA_KEY }}' | |
- name: Install gcloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
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-win.sh | |
- name: Archive Bundle | |
uses: azure/powershell@v1 | |
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: | |
runs-on: macos-latest | |
needs: [test] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Google Cloud Login | |
id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.GCS_RUNNER_SA_KEY }}' | |
- name: Install gcloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
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-mac.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] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup saucectl | |
uses: saucelabs/saucectl-run-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
skip-run: true | |
- 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 | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup saucectl | |
uses: saucelabs/saucectl-run-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
skip-run: true | |
- 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 }} | |
tunnelIdentifier: github-playwright-sc-check-tunnel-${{ matrix.os }}-${{ matrix.browser }} | |
scVersion: 4.7.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-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@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Setup saucectl | |
uses: saucelabs/saucectl-run-action@v3 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
skip-run: true | |
- 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 |