-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (67 loc) · 2.34 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Continuous Integration
on:
workflow_dispatch:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: ["*"]
env:
CARGO_TERM_COLOR: always
# Disable incremental compilation for faster from-scratch builds
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_PROFILE_RELEASE_LTO: true
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
jobs:
build:
name: Build on ${{ matrix.environments.runner }} with target ${{ matrix.environments.target }}
strategy:
fail-fast: false
matrix:
environments:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runner: ubuntu-latest
target: wasm32-unknown-unknown
optional: true
- runner: macos-latest
target: aarch64-apple-darwin
- runner: windows-latest
target: x86_64-pc-windows-msvc
- runner: ubuntu-latest
target: aarch64-unknown-linux-musl
optional: true
cross-compile: true
timeout-minutes: 30
runs-on: ${{ matrix.environments.runner }}
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
prefix-key: ${{ runner.os }}-${{ matrix.environments.target }}
- name: Check format
run: cargo fmt-amaru
- name: Run clippy
run: cargo clippy-amaru
- run: rustup target add ${{ matrix.environments.target }}
- name: Run tests
run: |
set +e
if [[ "${{ matrix.environments.cross-compile }}" == "true" ]] ; then
cargo install cross --git https://github.com/cross-rs/cross
# cross doesn't load .cargo/config.toml, see https://github.com/cross-rs/cross/issues/562
$HOME/.cargo/bin/cross test --locked --all-features --workspace --target ${{ matrix.environments.target }}
else
cargo test-amaru --locked --target ${{ matrix.environments.target }}
fi
exitcode="$?"
if [[ "${{ matrix.environments.optional }}" == "true" && "$exitcode" != "0" ]] ; then
# Propagate failure as a warning
# but do not fail the job
echo "::warning::Tests failed with exit code $exitcode"
exit 0
else
exit "$exitcode"
fi
shell: bash