Skip to content

Commit 2be6a9a

Browse files
committed
ci: add test, simplify a bit.
1 parent 2d16444 commit 2be6a9a

File tree

1 file changed

+41
-32
lines changed

1 file changed

+41
-32
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,42 @@ jobs:
4949
- name: Run miri
5050
run: MIRIFLAGS=-Zmiri-ignore-leaks cargo miri test
5151

52+
# Run cargo test
53+
test:
54+
name: test
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v4
59+
60+
- name: Cache cargo dependencies
61+
uses: actions/cache@v3
62+
with:
63+
path: |
64+
- ~/.cargo/bin/
65+
- ~/.cargo/registry/index/
66+
- ~/.cargo/registry/cache/
67+
- ~/.cargo/git/db/
68+
key: ${{ runner.OS }}-cargo-${{ hashFiles('**/Cargo.lock') }}
69+
restore-keys: |
70+
${{ runner.OS }}-cargo-
71+
72+
- name: Cache build output dependencies
73+
uses: actions/cache@v3
74+
with:
75+
path: target
76+
key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
77+
restore-keys: |
78+
${{ runner.OS }}-build-
79+
80+
- name: Install Rust
81+
uses: dtolnay/rust-toolchain@master
82+
with:
83+
toolchain: stable
84+
85+
- name: Run cargo test
86+
run: cargo test
87+
5288
# Run cargo fmt --check
5389
style:
5490
name: style
@@ -169,11 +205,6 @@ jobs:
169205
target:
170206
- x86_64-unknown-linux-gnu
171207
- i686-unknown-linux-musl
172-
toolchain:
173-
- stable
174-
- nightly
175-
features:
176-
- serde
177208
buildtype:
178209
- ""
179210
- "--release"
@@ -203,14 +234,14 @@ jobs:
203234
${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }}
204235
${{ runner.OS }}-build-
205236
206-
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
237+
- name: Install Rust with target (${{ matrix.target }})
207238
uses: dtolnay/rust-toolchain@master
208239
with:
209-
toolchain: ${{ matrix.toolchain }}
240+
toolchain: stable
210241
targets: ${{ matrix.target }}
211242

212243
- name: cargo test
213-
run: cargo test --test cpass --target=${{ matrix.target }} --features=${{ matrix.features }} ${{ matrix.buildtype }}
244+
run: cargo test --test cpass --target=${{ matrix.target }} --features=serde ${{ matrix.buildtype }}
214245

215246
# Run test suite for UI
216247
testtsan:
@@ -220,8 +251,6 @@ jobs:
220251
matrix:
221252
target:
222253
- x86_64-unknown-linux-gnu
223-
toolchain:
224-
- nightly
225254
buildtype:
226255
- ""
227256
- "--release"
@@ -249,10 +278,10 @@ jobs:
249278
restore-keys: |
250279
${{ runner.OS }}-build-
251280
252-
- name: Install Rust ${{ matrix.toolchain }} with target (${{ matrix.target }})
281+
- name: Install Rust nightly with target (${{ matrix.target }})
253282
uses: dtolnay/rust-toolchain@master
254283
with:
255-
toolchain: ${{ matrix.toolchain }}
284+
toolchain: nightly
256285
target: ${{ matrix.target }}
257286
components: rust-src
258287

@@ -302,23 +331,3 @@ jobs:
302331

303332
- name: Run cargo
304333
run: cargo run
305-
306-
# Refs: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
307-
#
308-
# ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
309-
310-
ci-success:
311-
name: ci
312-
if: github.event_name == 'push' && success()
313-
needs:
314-
- style
315-
- check
316-
- doc
317-
- testcpass
318-
- testtsan
319-
- testcfail
320-
- testmiri
321-
runs-on: ubuntu-latest
322-
steps:
323-
- name: Mark the job as a success
324-
run: exit 0

0 commit comments

Comments
 (0)