Skip to content

Commit 7476b4e

Browse files
committed
ci: add CI Master (Build, Test, Lint)
1 parent ced4065 commit 7476b4e

1 file changed

Lines changed: 125 additions & 0 deletions

File tree

.github/workflows/ci-master.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: "CI: Master (Build, Test, Lint)"
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "src/**"
8+
- "benches/**"
9+
- "examples/**"
10+
- "Cargo.toml"
11+
- "Cargo.lock"
12+
- ".github/workflows/ci-master.yml"
13+
pull_request:
14+
branches: [main]
15+
workflow_dispatch:
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
# Mirror proof.yml: allow noise lints in evolving 115K-line codebase
20+
RUSTFLAGS: "-D warnings -A unused -A dead-code -A private-interfaces -A mismatched-lifetime-syntaxes -A unsafe-op-in-unsafe-fn -A unexpected-cfgs -A ambiguous-glob-reexports -A overlapping-range-endpoints -A confusable-idents"
21+
22+
jobs:
23+
# ---------------------------------------------------------------------------
24+
# Build — debug + release
25+
# ---------------------------------------------------------------------------
26+
build:
27+
name: Build
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- uses: dtolnay/rust-toolchain@master
33+
with:
34+
toolchain: "1.93.0"
35+
components: clippy, rustfmt
36+
37+
- uses: Swatinem/rust-cache@v2
38+
39+
- name: Cargo build (debug, default features)
40+
run: cargo build --lib --bins --tests --benches
41+
42+
- name: Cargo build (release)
43+
run: cargo build --release --lib --bins
44+
45+
# ---------------------------------------------------------------------------
46+
# Test — unit + integration + doc tests
47+
# ---------------------------------------------------------------------------
48+
test:
49+
name: Test
50+
needs: build
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- uses: dtolnay/rust-toolchain@master
56+
with:
57+
toolchain: "1.93.0"
58+
59+
- uses: Swatinem/rust-cache@v2
60+
61+
- name: Unit tests (all modules)
62+
run: cargo test --lib -- --test-threads=4
63+
64+
- name: Integration tests
65+
run: cargo test --tests -- --test-threads=1
66+
67+
- name: Doc tests
68+
run: cargo test --doc
69+
70+
- name: Examples compile
71+
run: cargo build --examples
72+
73+
# ---------------------------------------------------------------------------
74+
# Lint — clippy + fmt
75+
# ---------------------------------------------------------------------------
76+
lint:
77+
name: Lint
78+
needs: build
79+
runs-on: ubuntu-latest
80+
steps:
81+
- uses: actions/checkout@v4
82+
83+
- uses: dtolnay/rust-toolchain@master
84+
with:
85+
toolchain: "1.93.0"
86+
components: clippy, rustfmt
87+
88+
- uses: Swatinem/rust-cache@v2
89+
90+
- name: Clippy (all targets)
91+
run: cargo clippy --all-targets -- -D warnings -A unused -A dead-code -A private-interfaces -A mismatched-lifetime-syntaxes -A unsafe-op-in-unsafe-fn -A unexpected-cfgs -A ambiguous-glob-reexports -A overlapping-range-endpoints -A confusable-idents
92+
93+
- name: Rustfmt
94+
run: cargo fmt --all -- --check
95+
96+
# ---------------------------------------------------------------------------
97+
# Summary
98+
# ---------------------------------------------------------------------------
99+
ci-summary:
100+
name: CI Summary
101+
needs: [build, test, lint]
102+
runs-on: ubuntu-latest
103+
if: always()
104+
steps:
105+
- name: Results
106+
run: |
107+
echo "============================================"
108+
echo " LADYBUG-RS CI MASTER RESULTS"
109+
echo "============================================"
110+
echo ""
111+
echo " Build: ${{ needs.build.result }}"
112+
echo " Test: ${{ needs.test.result }}"
113+
echo " Lint: ${{ needs.lint.result }}"
114+
echo ""
115+
PASS=true
116+
for r in "${{ needs.build.result }}" "${{ needs.test.result }}" "${{ needs.lint.result }}"; do
117+
[ "$r" != "success" ] && PASS=false
118+
done
119+
if [ "$PASS" = true ]; then
120+
echo " ✅ ALL CI CHECKS PASSED"
121+
else
122+
echo " ❌ SOME CI CHECKS FAILED"
123+
exit 1
124+
fi
125+
echo "============================================"

0 commit comments

Comments
 (0)