Skip to content

Commit

Permalink
ci: fix browser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bgins committed Jul 26, 2023
1 parent 188499f commit bb4d743
Showing 1 changed file with 34 additions and 22 deletions.
56 changes: 34 additions & 22 deletions .github/workflows/run_test_suite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,40 @@ jobs:
- name: Run Tests
run: cargo test --all

- name: Install Rust/WASM Test Dependencies
run: |
rustup target install wasm32-unknown-unknown
cargo install toml-cli
WASM_BINDGEN_VERSION=`toml get ./Cargo.lock . | jq '.package | map(select(.name == "wasm-bindgen"))[0].version' | xargs echo`
cargo install wasm-bindgen-cli --vers "$WASM_BINDGEN_VERSION"
run-headless-tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
browser: [ firefox, chrome ]
crate: [ ucan, ucan-key-support ]

# See: https://github.com/SeleniumHQ/selenium/blob/5d108f9a679634af0bbc387e7e3811bc1565912b/.github/actions/setup-chrome/action.yml
- name: Setup Chrome and Chromedriver
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update -qqy
sudo apt-get -qqy install google-chrome-stable
CHROME_VERSION=$(google-chrome-stable --version)
CHROME_FULL_VERSION=${CHROME_VERSION%%.*}
CHROME_MAJOR_VERSION=${CHROME_FULL_VERSION//[!0-9]}
sudo rm /etc/apt/sources.list.d/google-chrome.list
export CHROMEDRIVER_VERSION=`curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION%%.*}`
curl -L -O "https://chromedriver.storage.googleapis.com/${CHROMEDRIVER_VERSION}/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip && chmod +x chromedriver && sudo mv chromedriver /usr/local/bin
chromedriver -version
include:
- os: macos-latest
browser: safari
crate: ${{ matrix.browser }}

# defaults:
# run:
# working-directory: ${{ matrix.dirs }}

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Cache Project
uses: Swatinem/rust-cache@v2

- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable

- name: Run Rust Headless Browser Tests
run: CHROMEDRIVER=/usr/local/bin/chromedriver cargo test --target wasm32-unknown-unknown
working-directory: ${{ matrix.crate }}
run: wasm-pack test --headless --${{ matrix.browser }}

0 comments on commit bb4d743

Please sign in to comment.