-
Notifications
You must be signed in to change notification settings - Fork 6
114 lines (101 loc) · 3.55 KB
/
ci.yml
File metadata and controls
114 lines (101 loc) · 3.55 KB
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
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
# Cancel superseded runs on the same ref (e.g. rapid pushes to a PR).
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Least privilege: jobs only read the repo; codecov auth is via token secret.
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# Incremental compilation hurts cold CI builds and bloats the cache; disable it
# (recommended by Swatinem/rust-cache).
CARGO_INCREMENTAL: 0
# Tolerate transient registry/network blips.
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
jobs:
# Formatting — cheap, fails fast, no build/cache needed.
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
# Lints.
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Run clippy
run: cargo clippy --all-targets --features ilp-highs -- -D warnings
# Build, test (nextest), doc tests, and paper.
test:
name: Test
runs-on: ubuntu-latest
# Single feature set across compile + test + doctest so artifacts are reused
# (no redundant full recompile between steps).
env:
FEATURES: "ilp-highs example-db"
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: nextest
- uses: Swatinem/rust-cache@v2
- name: Install typst
uses: typst-community/setup-typst@v5
- name: Compile tests
run: cargo nextest run --no-run --workspace --features "$FEATURES"
# The subprocess example tests (tests/suites/examples.rs) shell out to
# `cargo run --example … --features ilp-highs`. Pre-build those example
# binaries with that exact feature set so the subprocess reuses artifacts
# instead of recompiling the whole crate mid-test (which otherwise adds
# 60s+ to a single test's wall-clock and would trip the nextest timeout).
- name: Build examples (for subprocess tests)
run: cargo build --examples --features ilp-highs
- name: Run tests
run: cargo nextest run --workspace --features "$FEATURES"
# nextest does not run doc tests; run them separately (reuses the build).
- name: Run doc tests
run: cargo test --doc --features "$FEATURES" --verbose
- name: Build paper
run: make paper
# Coverage. Feature set intentionally matches the historical coverage gate
# (ilp-highs only) to keep the codecov baseline stable.
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov,nextest
- uses: Swatinem/rust-cache@v2
- name: Generate coverage
run: cargo llvm-cov nextest --features ilp-highs --workspace --lcov --output-path lcov.info
- name: Upload to codecov.io
uses: codecov/codecov-action@v5
with:
files: lcov.info
fail_ci_if_error: false # Don't fail CI if upload fails
token: ${{ secrets.CODECOV_TOKEN }}