Debian Codegraph @

.github/workflows/ci.yaml

raw symbols SCIP
1 name: CI
2 on:
3 push:
4 branches:
5 - master
6 - "v*.*"
7 pull_request:
8 branches:
9 - master
10 - "v*.*"
11 schedule:
12 - cron: "0 0 * * 0"
13
14 jobs:
15 lock:
16 name: Cargo.lock
17 runs-on: ubuntu-latest
18 steps:
19 - name: Checkout the Repository
20 uses: actions/checkout@v4
21 - name: Install the Rust toolchain
22 uses: actions-rs/toolchain@v1
23 with:
24 toolchain: nightly
25 profile: minimal
26 override: true
27 - name: Generate the minimum version lockfile
28 run: |
29 cargo update -Z minimal-versions
30 cargo update -Z direct-minimal-versions
31 mv Cargo.lock Cargo.lock.min
32 - name: Generate the current version lockfile
33 run: cargo update
34 - name: Upload the Cargo lockfiles
35 uses: actions/upload-artifact@v4
36 with:
37 name: Cargo.lock
38 path: |
39 Cargo.lock
40 Cargo.lock.min
41
42 check:
43 name: Check (${{ matrix.rust }}${{ matrix.lock == '"Cargo.lock.min"' && ' (Cargo.lock.min)' || ''}})
44 runs-on: ubuntu-latest
45 needs: lock
46
47 strategy:
48 matrix:
49 rust: [1.64.0, stable, nightly]
50 lock: ["Cargo.lock", "Cargo.lock.min"]
51
52 steps:
53 - uses: actions/checkout@v4
54 - name: Download the Cargo lockfiles
55 uses: actions/download-artifact@v4
56 with:
57 name: Cargo.lock
58 - name: Rename ${{ matrix.lock }} to Cargo.lock
59 run: mv ${{ matrix.lock }} Cargo.lock
60 if: ${{ matrix.lock != 'Cargo.lock' }}
61 - uses: ./.github/actions/setup
62 with:
63 key: test-${{ matrix.rust }}-${{ matrix.lock }}
64 - uses: actions-rs/toolchain@v1
65 with:
66 toolchain: ${{ matrix.rust }}
67 profile: minimal
68 components: clippy
69 override: true
70 - uses: taiki-e/install-action@cargo-hack
71 - name: Downgrade dependencies to MSRV 1.64
72 run: |
73 cargo update -p serde_bytes --precise 0.11.16
74 cargo update -p indexmap --precise 2.5.0
75 cargo update -p once_cell --precise 1.20.3
76 cargo update -p quote --precise 1.0.41
77 cargo update -p syn$(perl -ne 'm/syn (2\.\d+\.\d+)/ && print "\@$1\n"' Cargo.lock) --precise 2.0.106
78 cargo update -p typetag --precise 0.2.20
79 cargo update -p erased-serde --precise 0.4.8
80 if: ${{ matrix.rust == '1.64.0' }}
81 - name: Check
82 run: |
83 cargo hack check --feature-powerset --no-dev-deps
84 - name: Clean
85 run: |
86 cargo clean
87 - name: Clippy
88 run: |
89 cargo hack clippy --feature-powerset --no-dev-deps -- -D warnings -A unknown-lints
90 # Clippy will report lints that cannot be acted on without increasing MSRV on later versions of Rust
91 if: ${{ matrix.rust == '1.64.0' }}
92 - name: Clean
93 run: |
94 cargo clean
95 - name: Test
96 run: |
97 cargo hack test --feature-powerset --clean-per-run
98
99 clippy-fuzz:
100 name: "Clippy: Fuzzer"
101 runs-on: ubuntu-latest
102 continue-on-error: true
103 steps:
104 - uses: actions/checkout@v4
105 - uses: ./.github/actions/setup
106 with:
107 key: clippy-fuzz
108 - uses: actions-rs/toolchain@v1
109 with:
110 toolchain: stable
111 profile: minimal
112 components: clippy
113 override: true
114 - run: cd fuzz && cargo clippy --all -- -D warnings
115
116 rustfmt:
117 name: "Format: stable"
118 runs-on: ubuntu-latest
119 steps:
120 - uses: actions/checkout@v4
121 - uses: ./.github/actions/setup
122 with:
123 key: rustfmt-stable
124 - uses: actions-rs/toolchain@v1
125 with:
126 toolchain: stable
127 profile: minimal
128 components: rustfmt
129 override: true
130 - run: cargo fmt --all -- --check
131 - run: cd fuzz && cargo fmt --all -- --check
132
133 coverage:
134 name: "Coverage: stable"
135 runs-on: ubuntu-latest
136 steps:
137 - uses: actions/checkout@v4
138 - uses: ./.github/actions/setup
139 with:
140 key: coverage
141 - uses: actions-rs/toolchain@v1
142 with:
143 toolchain: stable
144 profile: minimal
145 components: llvm-tools-preview
146 override: true
147 - name: Download grcov
148 run: |
149 curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.18/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf -
150 chmod +x ./grcov
151 - name: Generate the coverage data
152 run: |
153 cargo clean
154 cargo test --all-targets
155 cargo test --features integer128 --all-targets
156 cargo test --features indexmap --all-targets
157 cargo test --all-features --all-targets
158 env:
159 CARGO_INCREMENTAL: 0
160 RUSTFLAGS: -Cinstrument-coverage
161 RUSTDOCFLAGS: -Cinstrument-coverage
162 LLVM_PROFILE_FILE: coverage/coverage-%p-%m.profraw
163 - name: Generate the coverage reports
164 run: |
165 ./grcov . -s . --binary-path ./target/debug/deps \
166 -t lcov -o coverage.lcov --branch \
167 --keep-only "src/*" \
168 --keep-only "tests/*" \
169 --ignore-not-existing \
170 --excl-line GRCOV_EXCL_LINE \
171 --excl-start GRCOV_EXCL_START \
172 --excl-stop GRCOV_EXCL_STOP
173 ./grcov . -s . --binary-path ./target/debug/deps \
174 -t html --branch \
175 --keep-only "src/*" \
176 --keep-only "tests/*" \
177 --ignore-not-existing \
178 --excl-line GRCOV_EXCL_LINE \
179 --excl-start GRCOV_EXCL_START \
180 --excl-stop GRCOV_EXCL_STOP
181 rm -rf html/badges
182 # - name: Upload the coverage report to codecov.io
183 # uses: codecov/codecov-action@v1
184 # with:
185 # files: coverage.lcov
186 # fail_ci_if_error: true
187 - name: Deploy the code coverage report
188 uses: peaceiris/actions-gh-pages@v4
189 with:
190 github_token: ${{ secrets.GITHUB_TOKEN }}
191 publish_dir: ./html
192 destination_dir: coverage
193 if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'