-
-
Notifications
You must be signed in to change notification settings - Fork 83
104 lines (94 loc) · 3.57 KB
/
ci.yml
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
name: CI tests
on: [push]
jobs:
populate-rust-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/setup-ci
with:
rust-cache-shared-key: "base"
- run: cargo check --all-targets --all-features
continue-on-error: true
rust-jobs:
name: ${{ matrix.job }}
runs-on: ubuntu-latest
needs: populate-rust-cache
strategy:
matrix:
job:
- rustup toolchain install nightly --profile minimal --component rustfmt && cargo +nightly fmt --all -- --check
- cargo test --all-targets --all-features
- cargo clippy --all-targets --all-features -- -D warning
fail-fast: false
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/setup-ci
with:
rust-cache-shared-key: "base"
- run: ${{ matrix.job }}
deny:
name: ${{ matrix.job }}
runs-on: ubuntu-latest
strategy:
matrix:
job:
- cargo deny --all-features check advisories
- cargo deny --all-features check bans licenses sources
fail-fast: false
# Prevent sudden announcement of a new advisory from failing CI:
continue-on-error: ${{ endsWith(matrix.job, 'check advisories') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/cargo-binstall
with:
binstall: "cargo-deny"
- run: ${{ matrix.job }}
pre-commit:
name: Run pre-commit
runs-on: ubuntu-latest
needs: populate-rust-cache
env:
# These hooks are expensive and already run as dedicated jobs above
SKIP: "rustfmt,tests,clippy"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/setup-ci
with:
rust-cache-shared-key: "base"
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
- name: set PYVERSION
run: echo "PYVERSION=$(python --version | tr ' ' '-')" >> $GITHUB_ENV
- uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4
with:
path: ~/.cache/pre-commit
# Changes to pre-commit-config.yaml may require the installation of
# new binaries/scripts. When a cache hit occurs, changes to the cache
# aren't persisted at the end of the run, so making the key dependent
# on the configuration file ensures we always persist a complete cache.
key: pre-commit-${{ env.PYVERSION }}-${{ hashFiles('.pre-commit-config.yaml') }}
- run: pip install pre-commit
- run: pre-commit run --all --color=always --show-diff-on-failure
test-windows:
name: Test on Windows
runs-on: windows-latest
steps:
- run: git config --system core.autocrlf false && git config --system core.eol lf
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/setup-ci
- run: cargo test
coverage:
name: Code coverage
runs-on: ubuntu-latest
needs: populate-rust-cache
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: ./.github/actions/setup-ci
- uses: ./.github/actions/cargo-binstall
with:
binstall: "cargo-tarpaulin"
- run: cargo tarpaulin --out Html
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: tarpaulin-report
path: tarpaulin-report.html