forked from librespot-org/librespot
-
Notifications
You must be signed in to change notification settings - Fork 8
304 lines (268 loc) · 9.76 KB
/
test.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# Note, this is used in the badge URL!
name: test
on:
push:
branches: [master, dev, spotty, spotty-dev]
paths:
[
"**.rs",
"Cargo.toml",
"Cargo.lock",
"rustfmt.toml",
".github/workflows/*",
"!*.md",
"!contrib/*",
"!docs/*",
"!LICENSE",
"!*.sh",
]
pull_request:
paths:
[
"**.rs",
"Cargo.toml",
"Cargo.lock",
"rustfmt.toml",
".github/workflows/*",
"!*.md",
"!contrib/*",
"!docs/*",
"!LICENSE",
"!*.sh",
]
schedule:
# Run CI every week
- cron: "00 01 * * 0"
env:
RUST_BACKTRACE: 1
KEYMASTER_CLIENT_ID: ${{ secrets.KEYMASTER_CLIENT_ID }}
RUSTFLAGS: -D warnings
# The layering here is as follows:
# 1. code formatting
# 2. absence of lints
# 3. absence of errors and warnings on Linux/x86
# 4. cross compilation on Windows and Linux/ARM
jobs:
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Install toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile default --default-toolchain stable -y
- run: cargo fmt --all -- --check
clippy:
needs: fmt
name: cargo +${{ matrix.toolchain }} clippy (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain: [stable]
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Write Build Configuration File
uses: DamianReeves/write-file-action@v1.3
with:
path: ./src/client_id.txt
contents: ${{ env.KEYMASTER_CLIENT_ID }}
write-mode: overwrite
- name: Install toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile default --default-toolchain ${{ matrix.toolchain }} -y
- name: Get Rustc version
id: get-rustc-version
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Rust dependencies
uses: actions/cache@v4.1.2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
target
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- name: Install developer package dependencies
run: sudo apt-get update && sudo apt install -y libunwind-dev && sudo apt-get install libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev gstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavahi-compat-libdnssd-dev
- run: cargo install cargo-hack
- run: cargo hack --workspace --remove-dev-deps
- run: cargo clippy -p librespot-core --no-default-features
- run: cargo clippy -p librespot-core
- run: cargo hack clippy --each-feature -p librespot-discovery
- run: cargo hack clippy --each-feature -p librespot-playback
# - run: cargo hack clippy --each-feature
test-linux:
if: false
name: cargo +${{ matrix.toolchain }} check (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
needs: clippy
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
toolchain:
- "1.75" # MSRV (Minimum supported rust version)
- stable
experimental: [false]
# Ignore failures in beta
include:
- os: ubuntu-latest
toolchain: beta
experimental: true
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Install toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y
- name: Get Rustc version
id: get-rustc-version
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Rust dependencies
uses: actions/cache@v4.1.2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
target
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- name: Install developer package dependencies
run: sudo apt-get update && sudo apt install -y libunwind-dev && sudo apt-get install libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev gstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavahi-compat-libdnssd-dev
- run: cargo fetch --locked
- run: cargo build --frozen --workspace --examples
- run: cargo test --workspace
- run: cargo install cargo-hack
- run: cargo hack --workspace --remove-dev-deps
- run: cargo check -p librespot-core --no-default-features
- run: cargo check -p librespot-core
- run: cargo hack check --each-feature -p librespot-discovery
- run: cargo hack check --each-feature -p librespot-playback
- run: cargo hack check --each-feature
test-windows:
if: false
needs: clippy
name: cargo +${{ matrix.toolchain }} check (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [windows-latest]
toolchain:
- "1.75" # MSRV (Minimum supported rust version)
- stable
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
# hyper-rustls >=0.27 uses aws-lc as default backend which requires NASM to build
- name: Install NASM
uses: ilammy/setup-nasm@v1.5.1
- name: Write Build Configuration File
uses: DamianReeves/write-file-action@v1.3
with:
path: ./src/client_id.txt
contents: ${{ env.KEYMASTER_CLIENT_ID }}
write-mode: overwrite
- name: Install toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y
- name: Get Rustc version
id: get-rustc-version
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Rust dependencies
uses: actions/cache@v4.1.2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
target
key: ${{ runner.os }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- run: cargo fetch --locked
- run: cargo build --frozen --workspace --examples
- run: cargo test --workspace
- run: cargo install cargo-hack
- run: cargo hack --workspace --remove-dev-deps
- run: cargo check --no-default-features
- run: cargo check
test-cross-linux:
if: false
name: cross +${{ matrix.toolchain }} build ${{ matrix.target }}
needs: clippy
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
target:
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
toolchain:
- "1.75" # MSRV (Minimum supported rust version)
- stable
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2
- name: Write Build Configuration File
uses: DamianReeves/write-file-action@v1.3
with:
path: ./src/client_id.txt
contents: ${{ env.KEYMASTER_CLIENT_ID }}
write-mode: overwrite
- name: Install toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain ${{ matrix.toolchain }} -y
- name: Get Rustc version
id: get-rustc-version
run: echo "version=$(rustc -V)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Rust dependencies
uses: actions/cache@v4.1.2
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.target }}-${{ steps.get-rustc-version.outputs.version }}-${{ hashFiles('Cargo.lock') }}
- name: Install the cross compiler rust targets
run: rustup target add ${{ matrix.target }}
- name: Install cross compiler
run: |
if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then
sudo apt-get install -y gcc-arm-linux-gnueabihf
fi
if [ ${{ matrix.target }} = "aarch64-unknown-linux-gnu" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu
fi
if [ ${{ matrix.target }} = "riscv64gc-unknown-linux-gnu" ]; then
sudo apt-get install -y gcc-riscv64-linux-gnu
fi
- name: Set target link compiler
run: |
# Convert target to uppercase and replace - with _
target=${{ matrix.target }}
target=${target^^}
target=${target//-/_}
if [ ${{ matrix.target }} = "armv7-unknown-linux-gnueabihf" ]; then
echo "CARGO_TARGET_${target}_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV
fi
if [ ${{ matrix.target }} = "aarch64-unknown-linux-gnu" ]; then
echo "CARGO_TARGET_${target}_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
fi
if [ ${{ matrix.target }} = "riscv64gc-unknown-linux-gnu" ]; then
echo "CARGO_TARGET_${target}_LINKER=riscv64-linux-gnu-gcc" >> $GITHUB_ENV
fi
- name: Fetch
run: cargo fetch --locked
- name: Build
run: cargo build --frozen --verbose --target ${{ matrix.target }} --no-default-features
- name: Check binary
run: file target/${{ matrix.target }}/debug/librespot