Test multiple targets in CI

This commit is contained in:
Gary Guo 2023-05-07 00:33:30 +01:00
parent c7f06f852b
commit 6dc1ed4d80

View File

@ -1,26 +1,55 @@
name: CI name: CI
on: on: [push, pull_request]
push:
branches: [ "trunk" ]
pull_request:
branches: [ "trunk" ]
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
test: test:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
build_std: [false]
include:
- target: riscv32gc-unknown-linux-gnu
build_std: true
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Install Rust - name: Install Rust
run: rustup update nightly && rustup default nightly run: |
- name: Run Example Binary rustup update nightly
rustup default nightly
- name: Install Rust standard library source
if: matrix.build_std
run: rustup component add rust-src
- name: Install cross-compilation tools
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
- name: Build example binary
if: '!matrix.build_std'
run: cargo build --release
- name: Build example binary
if: matrix.build_std
run: cargo build --release -Zbuild-std
- name: Run example binary
if: '!matrix.build_std'
run: (cargo run --release 2>&1 | tee ../run.log) || true run: (cargo run --release 2>&1 | tee ../run.log) || true
working-directory: example working-directory: example
- name: Check Log - name: Run example binary
if: matrix.build_std
run: (cargo run --release -Zbuild-std 2>&1 | tee ../run.log) || true
working-directory: example
- name: Check log
run: | run: |
grep "panicked at 'panic', example/src/main.rs:36:5" run.log grep "panicked at 'panic', example/src/main.rs:36:5" run.log
grep 'note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace' run.log grep 'note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace' run.log