Skip to content

fix: Load TestCafe config from project folder #640

fix: Load TestCafe config from project folder

fix: Load TestCafe config from project folder #640

Workflow file for this run

name: Test
on:
pull_request:
branches:
- main
env:
GITHUB_TOKEN: ${{ github.token }}
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@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- uses: FedericoCarboni/setup-ffmpeg@v2
id: setup-ffmpeg
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
- name: Unit Test
run: npm run unit-test
- name: Integration Test
run: npm run integration-test
- name: Lint
run: npm run lint
build-windows-bundle:
runs-on: windows-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
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.exe
- name: Update Release version
run: npm version --no-git-tag-version 1.0.0
- run: npm ci --production
- run: npm run build
- name: Setup ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v2
if: ${{ steps.prep.outputs.asset_id == '' }}
id: setup-ffmpeg
with:
token: ${{ github.token }}
- name: Bundle Directory
run: bash ./scripts/bundle.sh
- name: Archive bundle
uses: azure/powershell@v1
with:
inlineScript: |
Compress-Archive bundle/ testcafe-windows-amd64.zip
azPSVersion: '3.1.0'
- name: Upload to GCS
run: |
gsutil cp ./testcafe-windows-amd64.zip gs://${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-windows-amd64-${{ github.run_id }}.zip
build-mac-bundle:
runs-on: macos-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
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 }}
- name: Update Release version
run: npm version --no-git-tag-version 1.0.0
- name: Install Dependencies
run: npm ci --production
- name: Build
run: npm run build
- uses: FedericoCarboni/setup-ffmpeg@v2
if: ${{ steps.prep.outputs.asset_id == '' }}
id: setup-ffmpeg
with:
token: ${{ github.token }}
- name: Bundle Directory
run: bash ./scripts/bundle.sh
- name: Archive Bundle
run: zip -r testcafe-macos-amd64.zip bundle/
- name: Upload to GCS
run: |
gsutil cp ./testcafe-macos-amd64.zip gs://${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-macos-amd64-${{ github.run_id }}.zip
bundle-test:
needs: [build-windows-bundle, build-mac-bundle]
strategy:
max-parallel: 3
fail-fast: false
matrix:
os: [Win10, Win11, macOS11, macOS12, macOS13]
browser: [Chrome, Firefox, Safari]
exclude:
- os: Win10
browser: Safari
- os: Win11
browser: Safari
include:
- os: iPhone14
browser: Safari
- os: iPhone12
browser: Safari
timeout-minutes: 10
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
- name: Test on Sauce
working-directory: ./tests/cloud/
run: |
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-windows-amd64-${{ github.run_id }}.zip
if [[ ${{ matrix.os }} =~ ^mac ]] || [[ ${{ matrix.os }} =~ ^iPhone ]];then
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-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-sc:
needs: [build-windows-bundle, build-mac-bundle]
strategy:
max-parallel: 3
fail-fast: false
matrix:
os: [Win10, Win11, macOS11, macOS12, macOS13]
browser: [Chrome, Firefox, Safari]
exclude:
- os: Win10
browser: Safari
- os: Win11
browser: Safari
include:
- os: iPhone14
browser: Safari
- os: iPhone12
browser: Safari
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup saucectl
uses: saucelabs/saucectl-run-action@v4
env:
GITHUB_TOKEN: ${{ github.token }}
with:
skip-run: true
- name: Run web-page
run: |
python -m http.server 8000 &
working-directory: ./tests/cloud/www/
- name: Start sauce-connect
uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelName: github-testcafe-sc-check-tunnel-${{ matrix.os }}-${{ matrix.browser }}
scVersion: 4.9.1
- name: Test on Sauce
working-directory: ./tests/cloud/
run: |
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-windows-amd64-${{ github.run_id }}.zip
if [[ ${{ matrix.os }} =~ ^mac ]] || [[ ${{ matrix.os }} =~ ^iPhone ]];then
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-macos-amd64-${{ github.run_id }}.zip
fi
saucectl run \
--runner-version "url: ${BUNDLE_URL}" \
--config ./.sauce/config-sc.yml \
--tunnel-name github-testcafe-sc-check-tunnel-${{ matrix.os }}-${{ matrix.browser }} \
--select-suite "${{ matrix.os }} - ${{ matrix.browser }}"
bundle-test-proxy:
needs: [build-windows-bundle, build-mac-bundle]
strategy:
max-parallel: 3
fail-fast: false
matrix:
os: [Win11, macOS13]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup saucectl
uses: saucelabs/saucectl-run-action@v4
env:
GITHUB_TOKEN: ${{ github.token }}
with:
skip-run: true
- name: Run web-page
run: |
python -m http.server 8000 &
working-directory: ./tests/cloud/www/
- name: Start sauce-connect
uses: saucelabs/sauce-connect-action@v2
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelName: github-testcafe-sc-check-tunnel-${{ matrix.os }}
scVersion: 4.9.1
- name: Test on Sauce
working-directory: ./tests/cloud/
run: |
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-windows-amd64-${{ github.run_id }}.zip
if [[ ${{ matrix.os }} =~ ^mac ]];then
BUNDLE_URL=https://storage.googleapis.com/${{ secrets.GCS_RUNNER_BUCKET }}/testcafe-macos-amd64-${{ github.run_id }}.zip
fi
saucectl run \
--runner-version "url: ${BUNDLE_URL}" \
--config ./.sauce/config-proxy.yml \
--tunnel-name github-testcafe-sc-check-tunnel-${{ matrix.os }} \
--select-suite "Proxy - ${{ matrix.os }}"