Skip to content

Support Chrome for Testing #490

Support Chrome for Testing

Support Chrome for Testing #490

Workflow file for this run

name: "Test chromedriver on *NIX"
on:
push:
branches:
- '*'
tags:
- '*'
paths:
- '**'
- '!*.md'
pull_request:
branches:
- '*'
paths:
- '**'
- '!*.md'
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-20.04, macos-latest, macos-11 ]
branch:
# - 'master'
- 'now'
chrome_version:
- 'current'
- '114.0.5735.90'
steps:
- uses: actions/checkout@v3
- if: startsWith(matrix.os, 'ubuntu')
run: echo 'CHROMEAPP=google-chrome' >> $GITHUB_ENV
- if: startsWith(matrix.os, 'macos')
run: echo 'CHROMEAPP=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' >> $GITHUB_ENV
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn package
- run: yarn test
- run: |
node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
rm -rf node_modules
- if: matrix.chrome_version != 'current'
env:
CHROME_VERSION: ${{ matrix.chrome_version }}
run: |
CHROME_VERSION=$(echo $CHROME_VERSION | cut -d '.' -f 1)
echo "CHROMEDRIVER_VERSION=$(curl --location --fail --retry 10 http://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION})" >> $GITHUB_ENV
- if: matrix.chrome_version == 'current' && startsWith(matrix.os, 'ubuntu')
run: |
CHROME_VERSION=$("$CHROMEAPP" --version | cut -f 3 -d ' ')
echo "CHROMEDRIVER_VERSION=$CHROME_VERSION" >> $GITHUB_ENV
- if: matrix.chrome_version == 'current' && startsWith(matrix.os, 'maos')
env:
CHROME_VERSION: '114.0.5735.90'
run: |
CHROME_VERSION=$(echo $CHROME_VERSION | cut -d '.' -f 1)
echo "CHROMEDRIVER_VERSION=$CHROME_VERSION" >> $GITHUB_ENV
- uses: ./
if: matrix.branch == 'now'
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
- uses: nanasess/setup-chromedriver@master
if: matrix.branch == 'master'
with:
chromedriver-version: ${{ env.CHROMEDRIVER_VERSION }}
- name: setup
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
node $GITHUB_WORKSPACE/__tests__/index.js
test_default_version:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-20.04, macos-latest, macos-11 ]
branch:
# - 'master'
- 'now'
steps:
- uses: actions/checkout@v3
- if: startsWith(matrix.os, 'ubuntu')
run: echo 'CHROMEAPP=google-chrome' >> $GITHUB_ENV
- if: startsWith(matrix.os, 'macos')
run: echo 'CHROMEAPP=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' >> $GITHUB_ENV
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn package
- run: yarn test
- run: |
node_modules/.bin/tsc $GITHUB_WORKSPACE/__tests__/chromedriver.ts
node_modules/.bin/ncc build $GITHUB_WORKSPACE/__tests__/chromedriver.js -o $GITHUB_WORKSPACE/__tests__
rm -rf node_modules
- uses: ./
if: matrix.branch == 'now'
- uses: nanasess/setup-chromedriver@master
if: matrix.branch == 'master'
- name: setup
run: |
"$CHROMEAPP" --version
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # disable headless mode
node $GITHUB_WORKSPACE/__tests__/index.js