name: Rust CI on: push: branches: ["**"] pull_request: branches: ["next", "main"] schedule: - cron: "0 0 * * 0" jobs: build-wasm: name: Build wasm runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: submodules: true - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4 with: toolchain: nightly components: rust-src rustflags: "" target: wasm32-unknown-unknown - name: Install Binaryen and WABT run: sudo apt-get install -y binaryen wabt - name: Build wasm run: ./examples/rust/build.sh - name: Save artifacts uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 with: name: wasm path: examples/rust/out run-tests: needs: build-wasm strategy: matrix: include: - os: ubuntu-latest rust: stable name: "Linux x86 (stable)" - os: ubuntu-latest rust: nightly name: "Linux x86 (nightly)" - os: ubuntu-latest rust: stable name: "Linux x86 (stable, no default features)" args: "--no-default-features" - os: ubuntu-latest rust: nightly name: "Linux x86 (nightly, no default features)" args: "--no-default-features" - os: macos-14 rust: stable name: "macOS arm64 (Apple M1)" - os: ubuntu-latest rust: stable name: "Linux arm64" target: aarch64-unknown-linux-gnu - os: ubuntu-latest rust: stable name: "Linux armv7" target: armv7-unknown-linux-gnueabihf name: Run tests on ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: submodules: true - name: Install Rust toolchain uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4 with: toolchain: ${{ matrix.rust }} rustflags: "" components: rustfmt, clippy if: matrix.target == '' - name: Load wasm uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: wasm path: examples/rust/out - name: Run tests run: cargo test --workspace ${{ matrix.args }} && cargo test --workspace ${{ matrix.args }} --examples if: matrix.target == '' - name: Run clippy run: cargo clippy --workspace ${{ matrix.args }} if: matrix.target == '' - name: Run tests (${{ matrix.target }}) uses: houseabsolute/actions-rust-cross@a8cc74d61047fa553b4e908b4b10e70029f00ca6 # v1.0.6 with: command: test target: ${{ matrix.target }} toolchain: ${{ matrix.rust }} if: matrix.target != ''