Skip to content

Commit be2f26e

Browse files
committed
ci: modernize Rust CI workflow with rust-lang/setup-rust@v2
- Replaced deprecated Rust setup action with `rust-lang/setup-rust@v2` - Run CI on push to any branch and PRs targeting main/dev - Temporary config.toml ensures unit tests and doctests pass in CI - Added Clippy and rustfmt checks - Cached cargo registry and git dependencies for faster builds
1 parent 3562b75 commit be2f26e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/rust-ci.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,26 @@ on:
1212

1313
env:
1414
CARGO_TERM_COLOR: always
15-
RUST_BACKTRACE: 1 # helpful for debugging panics
15+
RUST_BACKTRACE: 1 # Helpful for debugging panics
1616

1717
jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22+
# 1️⃣ Checkout repository
2223
- name: Checkout repository
2324
uses: actions/checkout@v3
2425

26+
# 2️⃣ Set up Rust toolchain using latest supported action
2527
- name: Set up Rust
26-
uses: actions/setup-rust@v1
28+
uses: rust-lang/setup-rust@v2
2729
with:
28-
rust-version: stable
30+
toolchain: stable
31+
profile: minimal
32+
override: true
2933

34+
# 3️⃣ Cache cargo registry and git dependencies for faster builds
3035
- name: Cache cargo registry and git
3136
uses: actions/cache@v3
3237
with:
@@ -37,26 +42,33 @@ jobs:
3742
restore-keys: |
3843
${{ runner.os }}-cargo-
3944
45+
# 4️⃣ Create temporary config.toml to ensure tests pass
4046
- name: Create temporary config.toml
4147
run: |
48+
mkdir -p assets
4249
cat <<EOT > config.toml
4350
[paths]
4451
nasa_jpl_de441 = "assets/linux_m13000p17000.441.bsp"
4552
header_441 = "assets/header.441"
4653
initial_data_dat = "assets/Initial_data.dat"
4754
EOT
4855
56+
# 5️⃣ Build the project
4957
- name: Build
5058
run: cargo build --verbose
5159

60+
# 6️⃣ Run unit tests
5261
- name: Run unit tests
5362
run: cargo test --verbose
5463

64+
# 7️⃣ Run doctests
5565
- name: Run doctests
5666
run: cargo test --doc --verbose
5767

68+
# 8️⃣ Run Clippy linter
5869
- name: Run Clippy
5970
run: cargo clippy --all-targets --all-features -- -D warnings
6071

72+
# 9️⃣ Check code formatting
6173
- name: Check formatting
6274
run: cargo fmt --all -- --check

0 commit comments

Comments
 (0)