Skip to content

Commit 141c55a

Browse files
committed
Added GitHub Actions CI workflow
1 parent f4cfb9c commit 141c55a

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

.github/workflows/ci.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: "**"
6+
pull_request:
7+
branches: "**"
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUSTFLAGS: "-D warnings"
12+
RUST_MSRV: "1.70.0" # Default fallback MSRV
13+
14+
jobs:
15+
test:
16+
name: Basic checks
17+
strategy:
18+
matrix:
19+
os: [ ubuntu-latest, macos-latest, windows-latest ]
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install Rust
25+
uses: dtolnay/rust-toolchain@stable
26+
with:
27+
components: clippy, rustfmt
28+
29+
- name: Install cargo-deadlinks
30+
run: cargo install cargo-deadlinks
31+
32+
- name: Build
33+
run: cargo build --verbose
34+
35+
- name: Clippy (default features)
36+
run: cargo clippy --all-targets
37+
38+
- name: Clippy (all features)
39+
run: cargo clippy --all-features --all-targets
40+
41+
- name: Documentation
42+
run: cargo doc --no-deps
43+
44+
- name: Check deadlinks
45+
run: cargo deadlinks
46+
47+
- name: Run tests (default features)
48+
run: cargo test
49+
50+
feature-checks:
51+
name: Feature combination checks
52+
strategy:
53+
matrix:
54+
os: [ ubuntu-latest, macos-latest, windows-latest ]
55+
runs-on: ${{ matrix.os }}
56+
steps:
57+
- uses: actions/checkout@v4
58+
59+
- name: Install Rust
60+
uses: dtolnay/rust-toolchain@stable
61+
with:
62+
components: clippy, rustfmt
63+
64+
- name: Install cargo-hack
65+
run: cargo install cargo-hack
66+
67+
- name: Check each feature
68+
run: cargo hack check --each-feature --no-dev-deps
69+
70+
- name: Check feature powerset
71+
run: cargo hack check --feature-powerset --no-dev-deps
72+
73+
- name: Clippy each feature
74+
run: cargo hack clippy --each-feature --all-targets
75+
76+
- name: Clippy feature powerset
77+
run: cargo hack clippy --feature-powerset --all-targets
78+
79+
- name: Test each feature
80+
run: cargo hack test --each-feature
81+
82+
- name: Test feature powerset
83+
run: cargo hack test --feature-powerset
84+
85+
msrv:
86+
name: Check MSRV
87+
runs-on: ubuntu-latest
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- name: Get MSRV from Cargo.toml
92+
run: |
93+
MSRV=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].rust_version // "${{ env.RUST_MSRV }}"')
94+
echo "MSRV=$MSRV" >> $GITHUB_ENV
95+
96+
- name: Install Rust
97+
uses: dtolnay/rust-toolchain@master
98+
with:
99+
toolchain: ${{ env.MSRV }}
100+
101+
- name: Debug info
102+
run: |
103+
echo "MSRV: $MSRV"
104+
echo "Rust: $(rustc --version)"
105+
106+
- name: Check MSRV
107+
run: cargo check

0 commit comments

Comments
 (0)