name: test
on: [pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
rust_version: [stable]
platform:
- { target: x86_64-pc-windows-msvc, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: aarch64-apple-ios, os: macos-latest }
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v2
- name: install stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
- name: install webkit2gtk (ubuntu only)
if: matrix.platform.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0 libgtksourceview-3.0-dev libappindicator3-dev
- name: install webview2 (windows only)
if: matrix.platform.os == 'windows-latest'
shell: pwsh
run: |
Invoke-WebRequest https://go.microsoft.com/fwlink/p/?LinkId=2124703 -OutFile installwebview.exe -UseBasicParsing
cmd /C start /wait installwebview.exe /silent /install
- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Cache cargo registry
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/registry
key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('Cargo.toml') }}-${{ env.CURRENT_DATE }}
restore-keys: |
${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v2.1.4
with:
path: ~/.cargo/git
key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('Cargo.toml') }}-${{ env.CURRENT_DATE }}
restore-keys: |
${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-index-
- name: Cache cargo target
uses: actions/cache@v2
with:
path: target
key: ${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('Cargo.toml') }}-${{ env.CURRENT_DATE }}
restore-keys: |
${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('Cargo.toml') }}
${{ matrix.platform }}-stable-cargo-core-
- name: build wry
run: cargo build --target ${{ matrix.platform.target }}
- name: build tests and examples
shell: bash
run: cargo test --no-run --verbose --target ${{ matrix.platform.target }}
- name: run tests
if: (!contains(matrix.platform.target, 'ios'))
run: cargo test --verbose --target ${{ matrix.platform.target }}