| 1 |
name: Rust |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [ "master" ] |
| 6 |
pull_request: |
| 7 |
branches: [ "master" ] |
| 8 |
|
| 9 |
env: |
| 10 |
CARGO_TERM_COLOR: always |
| 11 |
|
| 12 |
jobs: |
| 13 |
test: |
| 14 |
|
| 15 |
runs-on: ubuntu-latest |
| 16 |
|
| 17 |
steps: |
| 18 |
- uses: actions/checkout@v3 |
| 19 |
- name: Build |
| 20 |
run: cargo build --verbose |
| 21 |
- name: Run tests |
| 22 |
run: cargo test --verbose |
| 23 |
|
| 24 |
verify-msrv: |
| 25 |
strategy: |
| 26 |
matrix: |
| 27 |
os: [ubuntu-latest] |
| 28 |
runs-on: ${{ matrix.os }} |
| 29 |
name: verify minimum supported rust version without cache (takes longer, but caching produces unexpected behaviour) |
| 30 |
timeout-minutes: 30 |
| 31 |
|
| 32 |
# we are using the `cargo-msrv` app |
| 33 |
# https://github.com/foresterre/cargo-msrv |
| 34 |
|
| 35 |
steps: |
| 36 |
- uses: actions/checkout@v2 |
| 37 |
|
| 38 |
- name: Install foresterre/cargo-msrv |
| 39 |
run: cargo install cargo-msrv |
| 40 |
|
| 41 |
- uses: dtolnay/rust-toolchain@nightly |
| 42 |
- name: Generate Cargo.lock with minimal-version dependencies |
| 43 |
run: cargo -Zminimal-versions generate-lockfile |
| 44 |
|
| 45 |
- name: Verify the Rustc version declared in `Cargo.toml` with `minimal-versions` |
| 46 |
run: cargo-msrv verify |
| 47 |
|
| 48 |
# github actions does not support big endian systems directly, but it does support QEMU. |
| 49 |
# so we use cross-rs, which uses QEMU internally. |
| 50 |
big-endian: |
| 51 |
runs-on: ubuntu-latest |
| 52 |
name: test on emulated big endian system |
| 53 |
timeout-minutes: 90 |
| 54 |
|
| 55 |
# we are using the cross project for cross compilation: |
| 56 |
# https://github.com/cross-rs/cross |
| 57 |
|
| 58 |
steps: |
| 59 |
- uses: actions/checkout@v2 |
| 60 |
|
| 61 |
- name: Install or use cached cross-rs/cross |
| 62 |
uses: baptiste0928/cargo-install@v1 |
| 63 |
with: |
| 64 |
crate: cross |
| 65 |
|
| 66 |
- name: Cache Cargo Dependencies |
| 67 |
uses: Swatinem/[email protected] |
| 68 |
|
| 69 |
- name: Start Docker |
| 70 |
run: sudo systemctl start docker |
| 71 |
|
| 72 |
# https://github.com/cross-rs/cross#supported-targets |
| 73 |
- name: Cross-Compile project to powerpc-unknown-linux-gnu |
| 74 |
run: cross build --target powerpc-unknown-linux-gnu --verbose |
| 75 |
|
| 76 |
- name: Cross-Run Tests in powerpc-unknown-linux-gnu |
| 77 |
run: cross test --target powerpc-unknown-linux-gnu --verbose |
| 78 |
|
| 79 |
wasm32: |
| 80 |
runs-on: ubuntu-latest |
| 81 |
name: test on wasm32 |
| 82 |
timeout-minutes: 60 |
| 83 |
|
| 84 |
steps: |
| 85 |
- uses: actions/checkout@v2 |
| 86 |
|
| 87 |
- name: Cache Cargo Dependencies |
| 88 |
uses: Swatinem/[email protected] |
| 89 |
|
| 90 |
- name: Add wasm32 Target |
| 91 |
run: rustup target add wasm32-unknown-unknown |
| 92 |
|
| 93 |
- name: Build without default features |
| 94 |
run: cargo build --verbose --no-default-features --target wasm32-unknown-unknown |
| 95 |
|
| 96 |
- name: Run tests without default features |
| 97 |
run: cargo test --verbose --no-default-features |
| 98 |
|