Skip to content

Commit 5d42323

Browse files
committed
Rewrite workflow into failing faster, running default tests and better reuse build artifacts
1 parent f9e4901 commit 5d42323

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

.github/workflows/rust.yml

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,30 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
build:
13+
workflow-default-settings:
14+
name: workflow default settings
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v4
17-
- name: rustup
18-
run: rustup update stable
19-
- name: Build
20-
run: cargo build --verbose
21-
- name: Run tests
22-
run: cargo test --verbose --features testcontainers
23-
build_and_bench:
24-
name: Bench
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v4
28-
with:
29-
ref: main
30-
- name: rustup
31-
run: rustup update stable
32-
- name: measure benchmarks on main
33-
uses: actions-rs/cargo@v1
34-
with:
35-
command: bench
17+
- uses: actions/checkout@v5
18+
- uses: actions-rust-lang/setup-rust-toolchain@v1
19+
- name: Install dependencies
20+
run: |
21+
sudo apt-get update &&
22+
sudo apt-get install -y libssl-dev cmake build-essential # Used by paho-mqtt
23+
24+
# Do all the building first to fail early - sometimes we push without building specific settings:
25+
- name: Build project
26+
run: cargo build
27+
- name: Build project for testing
28+
run: cargo test --no-run
29+
- name: Build project for benching
30+
run: cargo bench --no-run
31+
32+
# Then run the tests and benches
33+
- name: Test project
34+
run: cargo test
35+
- name: Bench project
36+
run: cargo bench
3637
- name: upload benchmark report
3738
uses: actions/upload-artifact@v4
3839
with:

0 commit comments

Comments
 (0)