chore: Sync common workflows #51
Workflow file for this run
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
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Enable tmate debugging' | |
required: false | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || inputs.ref }} | |
cancel-in-progress: true | |
name: Test in GitHub Actions Environment | |
jobs: | |
check-driver-installation: | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
# Disable fail-fast so that one matrix-job failing doesn't make the other | |
# ones end early. We want to see the results on all platforms. | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 12 | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm ci | |
- run: node ./main.js | |
- name: Check installed drivers | |
shell: bash | |
run: | | |
check_driver() { | |
local driver="$1" | |
if ! ./$driver --version &>/dev/null; then | |
echo "::error::$driver not found on ${{ runner.os }}!" | |
return 1 | |
fi | |
} | |
rv=0 | |
if [[ "${{ runner.os }}" == "macOS" ]]; then | |
check_driver chromedriver || rv=1 | |
check_driver geckodriver || rv=1 | |
check_driver msedgedriver || rv=1 | |
elif [[ "${{ runner.os }}" == "Linux" ]]; then | |
check_driver chromedriver || rv=1 | |
check_driver geckodriver || rv=1 | |
elif [[ "${{ runner.os }}" == "Windows" ]]; then | |
check_driver chromedriver.exe || rv=1 | |
check_driver geckodriver.exe || rv=1 | |
check_driver msedgedriver.exe || rv=1 | |
fi | |
exit "$rv" | |
- uses: mxschmitt/action-tmate@v3 | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} |