-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (117 loc) · 3.63 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
on:
push:
branches:
- main
pull_request:
branches:
- main
name: ci
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
RUST_BACKTRACE: 1
# Pin the nightly toolchain to prevent breakage.
# This should be occasionally updated.
RUST_NIGHTLY_TOOLCHAIN: nightly-2024-11-19
jobs:
env:
runs-on: ubuntu-latest
outputs:
rust-versions: ${{ steps.definitions.outputs.versions }}
msrv: ${{ steps.definitions.outputs.msrv }}
steps:
- uses: actions/checkout@v4
- name: Evaluate definitions
id: definitions
run: |
export MSRV=$(rustup show | awk 'NF' | awk 'END{print $2}')
echo "msrv=$MSRV" >> "$GITHUB_OUTPUT"
export RAW_VERSIONS="stable $RUST_NIGHTLY_TOOLCHAIN $MSRV"
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.')
echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT"
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal --component rustfmt
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- name: Run cargo fmt
run: |
cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install rust toolchain
id: toolchain
run: |
rustup toolchain install stable --profile minimal --component clippy
rustup override set stable
- uses: camshaft/rust-cache@v1
- name: Run cargo clippy
run: |
cargo clippy --all-features --all-targets --workspace
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --profile minimal
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: camshaft/rust-cache@v1
- uses: camshaft/install@v1
with:
crate: cargo-udeps
- name: Run cargo udeps
run: cargo udeps --workspace --all-targets
env:
RUSTC_WRAPPER: ""
test:
runs-on: ${{ matrix.os }}
needs: env
strategy:
matrix:
rust: ${{ fromJson(needs.env.outputs.rust-versions) }}
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ matrix.rust }}
rustup override set ${{ matrix.rust }}
- uses: camshaft/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Run tests
run: |
cargo test
miri:
runs-on: ubuntu-latest
strategy:
matrix:
crate: [bach]
steps:
- uses: actions/checkout@v4
- name: Install toolchain
id: toolchain
run: |
rustup toolchain install ${{ env.RUST_NIGHTLY_TOOLCHAIN }} --component miri,rust-src
rustup override set ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
- uses: camshaft/rust-cache@v1
with:
key: ${{ matrix.crate }}
- name: ${{ matrix.crate }}
# Disabling capture speeds up miri execution: https://github.com/rust-lang/miri/issues/1780#issuecomment-830664528
run: cd ${{ matrix.crate }} && cargo miri test -- --nocapture
env:
# needed to read corpus files from filesystem
MIRIFLAGS: -Zmiri-disable-isolation