Link to repository (#45) #124
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
tests: | |
runs-on: "${{ matrix.platform.os }}-latest" | |
strategy: | |
matrix: | |
platform: [ | |
{ os: "ubuntu", target: "x86_64-unknown-linux-gnu" }, | |
{ os: "ubuntu", target: "wasm32-unknown-unknown" }, | |
] | |
env: | |
# used to connect to httpmock | |
URL: "http://localhost:5000" | |
API_KEY: "VerySecretKey" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache .cargo and target | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo | |
./target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }} | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.platform.target }} | |
profile: minimal | |
default: true | |
- name: Install httpmock | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: --features standalone -- httpmock | |
- name: Run httpmock | |
run: httpmock --expose --mock-files-dir=./mocks & | |
- name: Install test runner for wasm | |
if: matrix.platform.target == 'wasm32-unknown-unknown' | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Stable Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --all-features --target ${{ matrix.platform.target }} | |
- name: Tests | |
if: matrix.platform.target != 'wasm32-unknown-unknown' | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --all-features | |
- name: Tests in WASM | |
if: matrix.platform.target == 'wasm32-unknown-unknown' | |
run: RUST_LOG=wasm_bindgen_test_runner wasm-pack test --headless --chrome | |
working-directory: ./typesense |