Skip to content

Commit 1560b06

Browse files
committed
Enable CI
1 parent 4259914 commit 1560b06

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed

.github/workflows/_build.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
rust_toolchain:
7+
required: true
8+
type: string
9+
rust_features:
10+
required: false
11+
type: string
12+
default: --all-features
13+
with_rustfmt:
14+
required: false
15+
type: boolean
16+
default: false
17+
with_audit:
18+
required: false
19+
type: boolean
20+
default: false
21+
with_clippy:
22+
required: false
23+
type: boolean
24+
default: false
25+
with_doc:
26+
required: false
27+
type: boolean
28+
default: false
29+
pre_build_script:
30+
required: false
31+
type: string
32+
33+
env:
34+
CARGO_TERM_COLOR: always
35+
36+
jobs:
37+
38+
build:
39+
40+
name: Rust ${{ inputs.rust_toolchain }} ${{ inputs.rust_features }}
41+
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
46+
- uses: actions/checkout@v4
47+
48+
- uses: dtolnay/rust-toolchain@master
49+
with:
50+
toolchain: ${{ inputs.rust_toolchain }}
51+
components: rustfmt, clippy
52+
53+
- id: quickinstall
54+
name: Install cargo-quickinstall
55+
if: ${{ inputs.with_audit }}
56+
run: |
57+
cargo install cargo-quickinstall
58+
59+
- id: pre_build_script
60+
name: Pre build script
61+
if: ${{ inputs.pre_build_script }}
62+
run: ${{ inputs.pre_build_script }}
63+
64+
- id: rustfmt
65+
name: Rust format
66+
if: ${{ inputs.with_rustfmt }}
67+
run: |
68+
cargo fmt --verbose --all -- --check
69+
echo "Rustfmt OK" >> "$GITHUB_STEP_SUMMARY"
70+
71+
- id: audit
72+
name: Audit
73+
if: ${{ inputs.with_audit }}
74+
run: |
75+
cargo quickinstall cargo-audit
76+
cargo audit
77+
echo "Audit OK" >> "$GITHUB_STEP_SUMMARY"
78+
79+
- id: clippy
80+
name: Clippy
81+
if: ${{ inputs.with_clippy }}
82+
run: |
83+
cargo clippy --all ${{ inputs.rust_features }} --all-targets -- -D warnings
84+
echo "Clippy OK" >> "$GITHUB_STEP_SUMMARY"
85+
86+
- id: test
87+
name: Compile and run tests
88+
run: cargo test ${{ inputs.rust_features }} --verbose
89+
90+
- id: doc
91+
name: Doc
92+
if: ${{ inputs.with_doc }}
93+
run: |
94+
RUSTDOCFLAGS="-D warnings" cargo doc ${{ inputs.rust_features }} --no-deps
95+
echo "Doc OK" >> "$GITHUB_STEP_SUMMARY"
96+

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Continuous Integration
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
9+
main_stable:
10+
name: Rust stable
11+
uses: ./.github/workflows/_build.yml
12+
with:
13+
rust_toolchain: stable
14+
with_rustfmt: true
15+
with_clippy: true
16+
with_audit: true
17+
with_doc: true
18+
19+
main_1_89_0:
20+
name: Rust 1.89.0
21+
uses: ./.github/workflows/_build.yml
22+
with:
23+
rust_toolchain: 1.89.0
24+
pre_build_script: ./scripts/msrv_pin_dependencies.sh
25+
26+
main_nightly:
27+
name: Rust nightly
28+
uses: ./.github/workflows/_build.yml
29+
with:
30+
rust_toolchain: nightly
31+

.github/workflows/codecov.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Code Coverage
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
14+
code-coverage:
15+
16+
name: Code coverage
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
22+
- uses: actions/checkout@v4
23+
24+
- uses: dtolnay/rust-toolchain@master
25+
with:
26+
toolchain: nightly
27+
28+
- name: Install cargo-llvm-cov
29+
uses: taiki-e/install-action@cargo-llvm-cov
30+
31+
- name: Generate code coverage
32+
run: |
33+
cargo llvm-cov --all-features --lcov --output-path lcov.info
34+
35+
- name: Upload coverage to Codecov
36+
uses: codecov/codecov-action@v4
37+
with:
38+
token: ${{ secrets.CODECOV_TOKEN }}
39+
files: lcov.info
40+
fail_ci_if_error: true
41+

0 commit comments

Comments
 (0)