name: Rust HAL tests
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
hal_tests:
name: Test ${{ matrix.test }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
test: [ spi, i2c, gpio ]
runtime: [ wasm3, wasmtime ]
steps:
- uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Fetch spec
uses: actions/checkout@v2
with:
repository: embedded-wasm/spec
path: spec
- name: Fetch (latest) runtime
run: |
wget https://github.com/embedded-wasm/rt/releases/latest/download/wasm-embedded-rt-x86_64-unknown-linux-gnu.tgz
tar -xvf wasm-embedded-rt-x86_64-unknown-linux-gnu.tgz
- name: Configure toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
target: wasm32-wasi
override: true
components: rustfmt, clippy
- name: Configure caching
uses: actions/cache@v2
with:
key: hal_rs-${{ matrix.test }}
path: |
~/.cargo
target
- name: Build ${{matrix.test}} test
run: |
cargo build --features=test_${{ matrix.test }}
- name: Run ${{ matrix.test }} test
run: |
./wasm-embedded-rt --mode mock --runtime ${{ matrix.runtime }} --config spec/tests/${{ matrix.test }}.toml ./target/wasm32-wasi/debug/test-${{ matrix.test }}.wasm