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
name: Rust CI
on:
# Run on push to any branch
push:
branches:
# Run on pull requests targeting main or dev
pull_request:
branches:
- main
- dev
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1 # Helpful for debugging panics
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1️⃣ Checkout repository
- name: Checkout repository
uses: actions/checkout@v3
# 2️⃣ Set up Rust toolchain using latest supported action
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
# 3️⃣ Cache cargo registry and git dependencies for faster builds
- name: Cache cargo registry and git
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# 4️⃣ Create temporary config.toml to ensure tests pass
- name: Create temporary config.toml
run: |
mkdir -p assets
cat <<EOT > config.toml
[paths]
nasa_jpl_de441 = "assets/linux_m13000p17000.441.bsp"
header_441 = "assets/header.441"
initial_data_dat = "assets/Initial_data.dat"
EOT
# 5️⃣ Build the project
- name: Build
run: cargo build --verbose
# 6️⃣ Run unit tests
- name: Run unit tests
run: cargo test --verbose
# 7️⃣ Run doctests
- name: Run doctests
run: cargo test --doc --verbose
# 8️⃣ Run Clippy linter
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
# 9️⃣ Check code formatting
- name: Check formatting
run: cargo fmt --all -- --check