-
Notifications
You must be signed in to change notification settings - Fork 242
174 lines (163 loc) · 5.62 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
name: CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
# Daily cron job used to clear and rebuild cache (https://github.com/Swatinem/rust-cache/issues/181).
schedule:
- cron: '0 0 * * *'
# Limits workflow concurrency to only the latest commit in the PR.
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
test-all-features:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: "3072"
temp-reserve-mb: "3072"
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule' }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: taiki-e/install-action@nextest
- name: Clear cache
if: github.event_name =='schedule'
run: |
cargo clean
rm -rf ~/.cargo/registry
rm -rf ~/.cargo/git
- name: Compile unit tests with all features enabled
run: cargo nextest run --all-targets --all-features --workspace --locked --no-run --timings
- name: Run unit tests with all features enabled
run: timeout 10m cargo nextest run --no-fail-fast --all-targets --all-features --workspace --locked
- name: Store timings with all features enabled
uses: actions/upload-artifact@v4
with:
name: timings-all-features
path: target/cargo-timings/
if-no-files-found: warn
test-default-features:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: "3072"
temp-reserve-mb: "3072"
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: rui314/setup-mold@v1
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'schedule' }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: taiki-e/install-action@nextest
- name: Clear cache
if: github.event_name =='schedule'
run: |
cargo clean
rm -rf ~/.cargo/registry
rm -rf ~/.cargo/git
- name: Compile unit tests with default features
run: cargo nextest run --all-targets --workspace --locked --no-run --timings
- name: Run unit tests with default features
run: timeout 10m cargo nextest run --no-fail-fast --all-targets --workspace --locked
- name: Store timings with default features
uses: actions/upload-artifact@v4
with:
name: timings-default-features
path: target/cargo-timings/
if-no-files-found: warn
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Clear cache
if: github.event_name =='schedule'
run: |
cargo clean
rm -rf ~/.cargo/registry
rm -rf ~/.cargo/git
- run: |
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -D rust_2018_idioms
cargo clippy --workspace --all-targets --locked -- -D warnings -D rust_2018_idioms
cargo clippy --workspace --all-targets --all-features --locked --manifest-path crates/load-test/Cargo.toml -- -D warnings -D rust_2018_idioms
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: |
cargo +nightly fmt --all -- --check
cargo +nightly fmt --all --manifest-path crates/load-test/Cargo.toml -- --check
doc:
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Clear cache
if: github.event_name =='schedule'
run: cargo clean
- run: cargo doc --no-deps --document-private-items
dep-sort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: baptiste0928/cargo-install@v3
with:
crate: cargo-sort
version: "^1.0.9"
- run: |
cargo sort --check --workspace
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
with:
files: .
load_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: cargo check
run: |
cd crates/load-test
cargo check