-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (124 loc) · 3.55 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
141
142
143
144
145
146
on:
push:
branches:
- master
pull_request:
branches:
- master
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-05-10
jobs:
env:
runs-on: ubuntu-latest
outputs:
rust-versions: ${{ steps.definitions.outputs.versions }}
msrv: ${{ steps.definitions.outputs.msrv }}
steps:
- uses: actions/checkout@v3
- name: Evaluate definitions
id: definitions
run: |
export MSRV=$(cat rust-toolchain | awk '{$1=$1};1')
echo "::set-output name=msrv::$MSRV"
export RAW_VERSIONS="stable $MSRV"
export VERSIONS=$(echo $RAW_VERSIONS | jq -scR 'rtrimstr("\n")|split(" ")|.')
echo "::set-output name=versions::$VERSIONS"
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
id: toolchain
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
profile: minimal
override: true
components: rustfmt
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get -o Acquire::Retries=3 install -y libasound2-dev
- uses: actions-rs/[email protected]
id: toolchain
with:
toolchain: stable
profile: minimal
override: true
components: clippy
- uses: camshaft/rust-cache@v1
# TODO translate json reports to in-action warnings
- name: Run cargo clippy
uses: actions-rs/[email protected]
with:
command: clippy
args: --all-features --all-targets -- -D warnings
udeps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get -o Acquire::Retries=3 install -y libasound2-dev
- uses: actions-rs/[email protected]
id: toolchain
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
profile: minimal
override: true
- 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]
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get -o Acquire::Retries=3 update
sudo apt-get -o Acquire::Retries=3 install -y libasound2-dev
- uses: actions-rs/toolchain@v1
id: toolchain
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: camshaft/rust-cache@v1
with:
key: ${{ matrix.target }}
- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test