-
Notifications
You must be signed in to change notification settings - Fork 1
182 lines (169 loc) · 5.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
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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust stable
run: rustup toolchain install stable
- name: Check format
run: cargo fmt -- --check
no-std:
name: No std
runs-on: ubuntu-latest
env:
NO_STD_TARGET: thumbv7m-none-eabi
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust stable
run: rustup toolchain install stable
- name: Add no_std target
run: rustup target add ${{ env.NO_STD_TARGET }}
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Build on no_std environment
run: >
cargo hack build
--target ${{ env.NO_STD_TARGET }}
--no-dev-deps
--feature-powerset
--skip yield,thread_local
msrv:
name: MSRV
runs-on: ubuntu-latest
env:
CARGO_UNSTABLE_SPARSE_REGISTRY: true
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust 1.65.0
# NOTE: We are actually installing the first nightly 1.66.0. It should
# be equivalent to stable 1.65.0. We need the nightly version to use the
# sparse registry feature. This massively improves the index download.
# Link: https://blog.rust-lang.org/2022/06/22/sparse-registry-testing.html
run: rustup toolchain install nightly-2022-09-18
- name: Set Rust 1.65.0 as default
run: rustup default nightly-2022-09-18
- name: Check MSRV
run: cargo check --all-features
docsrs:
name: Build doc
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust nightly
run: rustup toolchain install nightly
- name: Set Rust nightly as default
run: rustup default nightly
- name: Build docs
env:
RUSTDOCFLAGS: --cfg docsrs -D warnings
run: cargo doc --all-features
doc:
name: Test doc
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust stable
run: rustup toolchain install stable
- name: Run doc snippets
run: cargo test --doc --all-features
examples:
name: Examples
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust stable
run: rustup toolchain install stable
- name: Run raw example
run: cargo run --example raw
- name: Run barging example
run: cargo run --example barging --features barging
- name: Run thread_local example
run: cargo run --example thread_local --features thread_local
- name: Run lock_api example
run: cargo run --example lock_api --features lock_api,barging
linter:
name: Linter
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust stable
run: rustup toolchain install stable
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Lint feature powerset
env:
RUSTFLAGS: -D warnings -D clippy::pedantic -D clippy::nursery
run: cargo hack clippy --feature-powerset --no-dev-deps
- name: Lint test profile
env:
RUSTFLAGS: -D warnings -D clippy::pedantic -D clippy::nursery
run: cargo hack clippy --profile test --feature-powerset --no-dev-deps
- name: Lint loom
env:
RUSTFLAGS: --cfg loom -D warnings -D clippy::pedantic -D clippy::nursery
run: cargo hack clippy --profile test --feature-powerset
coverage:
name: Coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:latest
options: --security-opt seccomp=unconfined
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Generate coverage
run: >
cargo tarpaulin
--verbose
--engine llvm
--all-features
--out xml
- name: Upload to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust nightly and Miri
# NOTE: not all nightly releases come with Miri
run: rustup toolchain install nightly --component miri
- name: Set Rust nightly as default
run: rustup default nightly
# NOTE: Nextest is configure to run Miri against `num-cpus` threads.
- name: Install latest nextest release
uses: taiki-e/install-action@nextest
- name: Miri test
run: cargo miri nextest run --all-features
loom:
name: Loom
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust stable
run: rustup toolchain install stable
- name: Loom test
env:
RUSTFLAGS: --cfg loom
run: cargo test --lib --release --all-features