Skip to content

Commit 9426314

Browse files
committed
ci: consolidate into a single workflow and improve CI
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
1 parent e647fbc commit 9426314

6 files changed

Lines changed: 175 additions & 319 deletions

File tree

.github/workflows/check.yml

Lines changed: 0 additions & 138 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
permissions:
2+
contents: read
3+
on:
4+
pull_request:
5+
name: CI
6+
jobs:
7+
fmt:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: ${{github.event.pull_request.commits}}
13+
ref: ${{github.event.pull_request.head.sha}}
14+
- uses: dtolnay/rust-toolchain@nightly
15+
with:
16+
components: rustfmt
17+
- run: git config user.name "github-runner" && git config user.email "<>"
18+
- run: git rebase --exec 'cargo fmt --check' --root
19+
- run: cd internal && git rebase --exec 'cargo fmt --check' --root
20+
readme:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: ${{github.event.pull_request.commits}}
26+
ref: ${{github.event.pull_request.head.sha}}
27+
- uses: dtolnay/rust-toolchain@nightly
28+
- run: cargo install cargo-rdme
29+
- run: git config user.name "github-runner" && git config user.email "<>"
30+
- run: git rebase --exec 'cargo rdme --check' --root
31+
docs:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: ${{github.event.pull_request.commits}}
37+
ref: ${{github.event.pull_request.head.sha}}
38+
- uses: dtolnay/rust-toolchain@nightly
39+
- uses: dtolnay/rust-toolchain@nightly
40+
with:
41+
components: rust-src
42+
- run: git config user.name "github-runner" && git config user.email "<>"
43+
- run: git rebase --exec 'cargo doc --no-deps' --root
44+
clippy:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
with:
49+
fetch-depth: ${{github.event.pull_request.commits}}
50+
ref: ${{github.event.pull_request.head.sha}}
51+
- uses: dtolnay/rust-toolchain@nightly
52+
with:
53+
components: clippy
54+
- run: cargo install cargo-hack
55+
- run: git config user.name "github-runner" && git config user.email "<>"
56+
- run: git rebase --exec 'cargo hack --clean-per-run --feature-powerset clippy --locked' --root
57+
test:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v4
61+
- uses: dtolnay/rust-toolchain@nightly
62+
with:
63+
components: rust-src
64+
- run: cargo install cargo-expand
65+
- run: git config user.name "github-runner" && git config user.email "<>"
66+
- run: git rebase --exec 'cargo test --locked' --root
67+
miri:
68+
runs-on: ubuntu-latest
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
flags: [
73+
"",
74+
"-Zmiri-tree-borrows",
75+
"-Zmiri-strict-provenance",
76+
"-Zmiri-tree-borrows -Zmiri-strict-provenance",
77+
]
78+
name: "miri (${{matrix.flags}})"
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
fetch-depth: ${{github.event.pull_request.commits}}
83+
ref: ${{github.event.pull_request.head.sha}}
84+
- run: |
85+
echo "NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)" >> $GITHUB_ENV
86+
- name: Install ${{env.NIGHTLY}}
87+
uses: dtolnay/rust-toolchain@master
88+
with:
89+
toolchain: ${{env.NIGHTLY}}
90+
components: miri, rust-src
91+
- run: cargo install cargo-expand
92+
- run: git config user.name "github-runner" && git config user.email "<>"
93+
- name: ${{matrix.flags}} cargo miri test
94+
run: git rebase --exec 'cargo miri test --locked' --root
95+
env:
96+
MIRIFLAGS: ${{matrix.flags}}
97+
sanitizers:
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v4
101+
with:
102+
fetch-depth: ${{github.event.pull_request.commits}}
103+
ref: ${{github.event.pull_request.head.sha}}
104+
- uses: dtolnay/rust-toolchain@nightly
105+
with:
106+
components: rust-src
107+
- name: enable debug symbols
108+
run: |
109+
sudo apt install llvm
110+
# https://github.com/japaric/rust-san#unrealiable-leaksanitizer
111+
sed -i '/\[features\]/i [profile.dev]' Cargo.toml
112+
sed -i '/profile.dev/a opt-level = 1' Cargo.toml
113+
cat Cargo.toml
114+
- run: git config user.name "github-runner" && git config user.email "<>"
115+
- run: git rebase --exec 'cargo test --lib --tests --target x86_64-unknown-linux-gnu' --root
116+
env:
117+
ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0"
118+
RUSTFLAGS: "--cfg NO_UI_TESTS --cfg NO_ALLOC_FAIL_TESTS -Z sanitizer=address"
119+
- run: git rebase --exec 'cargo test --target x86_64-unknown-linux-gnu' --root
120+
env:
121+
RUSTFLAGS: "--cfg NO_UI_TESTS --cfg NO_ALLOC_FAIL_TESTS -Z sanitizer=leak"
122+
msrv:
123+
runs-on: ubuntu-latest
124+
steps:
125+
- uses: actions/checkout@v4
126+
with:
127+
fetch-depth: ${{github.event.pull_request.commits}}
128+
ref: ${{github.event.pull_request.head.sha}}
129+
- uses: dtolnay/rust-toolchain@stable
130+
- run: cargo install cargo-hack
131+
- run: git config user.name "github-runner" && git config user.email "<>"
132+
- run: git rebase --exec 'cargo hack --clean-per-run --feature-powerset --exclude-features alloc --exclude-features default --version-range 1.82.. --clean-per-version check --locked' --root
133+
nightly-msrv:
134+
runs-on: ubuntu-latest
135+
steps:
136+
- uses: actions/checkout@v4
137+
with:
138+
fetch-depth: ${{github.event.pull_request.commits}}
139+
ref: ${{github.event.pull_request.head.sha}}
140+
- uses: dtolnay/rust-toolchain@stable
141+
with:
142+
components: rust-src
143+
- run: cargo install cargo-hack
144+
- run: cargo install cargo-expand
145+
- run: git config user.name "github-runner" && git config user.email "<>"
146+
- run: git rebase --exec 'cargo hack --clean-per-run --feature-powerset --version-range 1.78.. --clean-per-version check --locked' --root
147+
env:
148+
RUSTC_BOOTSTRAP: 1
149+
os-check:
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
os: [macos-latest, windows-latest]
154+
runs-on: ${{matrix.os}}
155+
name: "os-check (${{matrix.os}})"
156+
steps:
157+
- uses: actions/checkout@v4
158+
with:
159+
fetch-depth: ${{github.event.pull_request.commits}}
160+
ref: ${{github.event.pull_request.head.sha}}
161+
- uses: dtolnay/rust-toolchain@nightly
162+
with:
163+
components: rust-src
164+
- run: cargo install cargo-expand
165+
- run: git config user.name "github-runner" && git config user.email "<>"
166+
- run: git rebase --exec 'cargo test --locked' --root

.github/workflows/nostd.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)