-
-
Notifications
You must be signed in to change notification settings - Fork 0
382 lines (380 loc) · 11.5 KB
/
ci-rust.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# ==----------------------------------------------------------------== #
# SPDX-FileCopyrightText: © 2024-2025 Nayan Patil <nayantsg@proton.me>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# ==----------------------------------------------------------------== #
# Do not modify!
# This file was generated from a template using the necronux internal pkl package.
# Any changes should be made to the template, not this file.
name: CI-Rust
'on':
pull_request:
branches:
- develop
- stable
- release
- hotfix
paths:
- '*.rs'
- '**/*.rs'
- src/**
- crates/**
- Cargo.toml
- Cargo.lock
- deny.toml
push:
paths:
- '*.rs'
- '**/*.rs'
- src/**
- crates/**
- Cargo.toml
- Cargo.lock
- deny.toml
workflow_dispatch:
inputs:
trigger_event:
description: Specify which event to simulate
required: false
default: push
type: choice
options:
- pull_request
- push
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
CARGO_HACK_DENY_WARNINGS: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
conclusion-pr:
if: ${{ (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.trigger_event == 'pull_request')) && !cancelled() }}
needs:
- test-full
- check-version-bump
- clippy
- docs
- lockfile
- msrv
- rustfmt
permissions:
contents: none
runs-on: ubuntu-latest
steps:
- name: Conclusion
shell: bash
run: |-
jq -C <<< '${{ toJson(needs) }}'
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
conclusion-push:
if: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.trigger_event == 'push')) && !cancelled() }}
needs:
- test-minimal
- check-version-bump
- clippy
- docs
- lockfile
- msrv
- rustfmt
permissions:
contents: none
runs-on: ubuntu-latest
steps:
- name: Conclusion
shell: bash
run: |-
jq -C <<< '${{ toJson(needs) }}'
jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
rustfmt:
name: Rustfmt
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- name: Run cargo fmt
shell: bash
run: cargo fmt --all --check
clippy:
name: Clippy
strategy:
matrix:
os:
- ubuntu-latest
- ubuntu-24.04-arm
- windows-latest
- macos-latest
- macos-13
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- name: Run cargo clippy
shell: bash
run: cargo clippy --workspace --all-targets --all-features --no-deps -- -D clippy::all
lockfile:
name: Cargo Lockfile
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Ensure Cargo.lock is up-to-date
shell: bash
run: cargo update -p necronux --locked
check-version-bump:
name: Check Version Bump
runs-on: ubuntu-latest
timeout-minutes: 30
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha != '' && github.event.pull_request.head.sha || github.sha }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-semver-checks
uses: taiki-e/install-action@cargo-semver-checks
- name: Run cargo semver-checks
shell: bash
run: |-
set -euo pipefail
base_sha=$(git rev-parse "${BASE_SHA:-HEAD~1}")
head_sha=$(git rev-parse "${HEAD_SHA:-HEAD}")
echo "Base revision is $base_sha"
echo "Head revision is $head_sha"
cargo semver-checks --baseline-rev "$base_sha" --workspace
test-minimal:
name: Minimal Tests (${{ matrix.name }})
if: ${{ (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.trigger_event == 'push')) && !cancelled() }}
strategy:
matrix:
include:
- name: Linux x86_64 stable
os: ubuntu-latest
rust: stable
other: i686-unknown-linux-gnu
- name: Linux x86_64 beta
os: ubuntu-latest
rust: beta
other: i686-unknown-linux-gnu
- name: Linux x86_64 nightly
os: ubuntu-latest
rust: nightly
other: i686-unknown-linux-gnu
- name: Linux aarch64 stable
os: ubuntu-24.04-arm
rust: stable
- name: Linux aarch64 nightly
os: ubuntu-24.04-arm
rust: nightly
- name: Windows x86_64 MSVC stable
os: windows-latest
rust: stable-msvc
other: i686-pc-windows-msvc
- name: Windows x86_64 gnu nightly
os: windows-latest
rust: nightly-gnu
other: i686-pc-windows-gnu
- name: macOS aarch64 stable
os: macos-latest
rust: stable
other: x86_64-apple-darwin
- name: macOS aarch64 nightly
os: macos-latest
rust: nightly
other: x86_64-apple-darwin
- name: macOS x86_64 nightly
os: macos-13
rust: nightly
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_TEST_DEBUG: 1
RUSTUP_WINDOWS_PATH_ADD_BIN: 0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.rust }}-${{ matrix.name }}
- name: Setup rustup stable
shell: bash
run: rustup update --no-self-update stable
- name: Update rustup and set default version
shell: bash
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Add rustup targets
if: ${{ matrix.other != null }}
shell: bash
run: rustup target add ${{ matrix.other }}
- name: Configure extra test environment
if: matrix.os == 'ubuntu-latest'
shell: bash
run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
- name: Run cargo test with default features in debug mode
shell: bash
run: cargo test --lib --bins --workspace
- name: Run cargo test with all features in debug mode
shell: bash
run: cargo test --lib --bins --workspace --all-features
test-full:
name: Full Tests (${{ matrix.name }})
if: ${{ (github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && github.event.inputs.trigger_event == 'pull_request')) && !cancelled() }}
strategy:
matrix:
include:
- name: Linux x86_64 stable
os: ubuntu-latest
rust: stable
other: i686-unknown-linux-gnu
- name: Linux x86_64 beta
os: ubuntu-latest
rust: beta
other: i686-unknown-linux-gnu
- name: Linux x86_64 nightly
os: ubuntu-latest
rust: nightly
other: i686-unknown-linux-gnu
- name: Linux aarch64 stable
os: ubuntu-24.04-arm
rust: stable
- name: Linux aarch64 nightly
os: ubuntu-24.04-arm
rust: nightly
- name: Windows x86_64 MSVC stable
os: windows-latest
rust: stable-msvc
other: i686-pc-windows-msvc
- name: Windows x86_64 gnu nightly
os: windows-latest
rust: nightly-gnu
other: i686-pc-windows-gnu
- name: macOS aarch64 stable
os: macos-latest
rust: stable
other: x86_64-apple-darwin
- name: macOS aarch64 nightly
os: macos-latest
rust: nightly
other: x86_64-apple-darwin
- name: macOS x86_64 nightly
os: macos-13
rust: nightly
fail-fast: false
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_TEST_DEBUG: 1
RUSTUP_WINDOWS_PATH_ADD_BIN: 0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ github.job }}-${{ matrix.os }}-${{ matrix.rust }}-${{ matrix.name }}
- name: Setup rustup stable
shell: bash
run: rustup update --no-self-update stable
- name: Update rustup and set default version
shell: bash
run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Add rustup targets
if: ${{ matrix.other != null }}
shell: bash
run: rustup target add ${{ matrix.other }}
- name: Configure extra test environment
if: matrix.os == 'ubuntu-latest'
shell: bash
run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV
- name: Run cargo test with default features in debug mode
shell: bash
run: cargo test --all-targets --workspace
- name: Run cargo test with all features in debug mode
shell: bash
run: cargo test --all-targets --workspace --all-features
- name: Run cargo test with default features in release mode
shell: bash
run: cargo test --all-targets --workspace --release
- name: Run cargo test with all features in release mode
shell: bash
run: cargo test --all-targets --workspace --all-features --release
docs:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -C debuginfo=0 -D warnings
RUSTUP_MAX_RETRIES: 10
CARGO_HACK_DENY_WARNINGS: 1
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Setup rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Run cargo doc
env:
RUSTDOCFLAGS: -D warnings
shell: bash
run: cargo doc --workspace --all-features --no-deps --document-private-items --keep-going
- name: Run cargo test with all features in debug mode
shell: bash
run: cargo test --doc --workspace --all-features
msrv:
name: MSRV
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup rust cache
uses: Swatinem/rust-cache@v2
- name: Install cargo hack
uses: taiki-e/install-action@cargo-hack
- name: Run cargo hack check
shell: bash
run: cargo hack check --all-targets --rust-version --locked