Skip to content

Commit 2d495aa

Browse files
authored
Update justfile and CI (#89)
1 parent c1d3919 commit 2d495aa

File tree

6 files changed

+266
-214
lines changed

6 files changed

+266
-214
lines changed

.github/dependabot.yml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
version: 2
22
updates:
3-
# Maintain dependencies for GitHub Actions
4-
- package-ecosystem: "github-actions"
5-
directory: "/"
6-
schedule:
7-
interval: "weekly"
8-
- package-ecosystem: cargo
9-
directory: "/"
10-
schedule:
11-
interval: daily
12-
time: "02:00"
13-
open-pull-requests-limit: 10
3+
4+
# Maintain dependencies for GitHub Actions
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
groups:
10+
all-actions-version-updates:
11+
applies-to: version-updates
12+
patterns:
13+
- "*"
14+
all-actions-security-updates:
15+
applies-to: security-updates
16+
patterns:
17+
- "*"
18+
19+
# Update Rust dependencies
20+
- package-ecosystem: cargo
21+
directory: "/"
22+
schedule:
23+
interval: daily
24+
time: "02:00"
25+
open-pull-requests-limit: 10
26+
groups:
27+
all-cargo-version-updates:
28+
applies-to: version-updates
29+
patterns:
30+
- "*"
31+
all-cargo-security-updates:
32+
applies-to: security-updates
33+
patterns:
34+
- "*"

.github/workflows/ci.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,15 @@ jobs:
2222
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
2323
uses: Swatinem/rust-cache@v2
2424
- uses: taiki-e/install-action@v2
25-
with: { tool: 'just,cargo-llvm-cov' }
25+
with: { tool: just }
2626
- if: github.event_name == 'release'
2727
name: Ensure this crate has not yet been published (on release)
2828
run: just check-if-published
29-
- run: RUST_BACKTRACE=1 just -v ci-test
29+
- run: just ci-test
3030
- name: Check semver
3131
uses: obi1kenobi/cargo-semver-checks-action@v2
32-
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
33-
name: Generate code coverage
34-
run: just ci-coverage
35-
- if: github.event_name != 'release' && github.event_name != 'workflow_dispatch'
36-
name: Upload coverage to Codecov
37-
uses: codecov/codecov-action@v5
38-
with:
39-
token: ${{ secrets.CODECOV_TOKEN }}
40-
files: target/llvm-cov/codecov.info
41-
fail_ci_if_error: true
4232

43-
msrv:
33+
test-msrv:
4434
name: Test MSRV
4535
runs-on: ubuntu-latest
4636
steps:
@@ -57,10 +47,32 @@ jobs:
5747
with:
5848
toolchain: ${{ steps.msrv.outputs.value }}
5949
components: rustfmt
60-
- run: just -v ci-test-msrv
50+
- run: just ci-test-msrv
51+
env:
52+
# Ignore warnings in MSRV. Sadly, this cannot be done inside `just ci-test-msrv`
53+
CI: ''
54+
55+
coverage:
56+
name: Code Coverage
57+
if: github.event_name != 'release'
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@v4
61+
- uses: Swatinem/rust-cache@v2
62+
- uses: taiki-e/install-action@v2
63+
with: { tool: 'just,cargo-llvm-cov' }
64+
- name: Generate code coverage
65+
run: just ci-coverage
66+
- name: Upload coverage to Codecov
67+
uses: codecov/codecov-action@v5
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
files: target/llvm-cov/codecov.info
71+
fail_ci_if_error: true
6172

6273
build:
6374
name: Build ${{ matrix.target }}
75+
needs: [ test ]
6476
runs-on: ${{ matrix.os }}
6577
strategy:
6678
fail-fast: false
@@ -155,6 +167,7 @@ jobs:
155167

156168
cross-build:
157169
name: Cross-build
170+
needs: [ test ]
158171
runs-on: ubuntu-latest
159172
steps:
160173
- uses: actions/checkout@v4
@@ -182,10 +195,20 @@ jobs:
182195
env:
183196
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184197

185-
publish:
198+
# This job checks if any of the previous jobs failed or were canceled.
199+
# This approach also allows some jobs to be skipped if they are not needed.
200+
ci-passed:
201+
if: always()
202+
needs: [ test, test-msrv, coverage, build, cross-build ]
203+
runs-on: ubuntu-latest
204+
steps:
205+
- if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
206+
run: exit 1
207+
208+
release:
186209
if: startsWith(github.ref, 'refs/tags/')
187210
name: Publish to crates.io
188-
needs: [ test, msrv, build, cross-build ]
211+
needs: [ ci-passed ]
189212
runs-on: ubuntu-latest
190213
steps:
191214
- uses: actions/checkout@v4

.github/workflows/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- name: Dependabot metadata
1212
id: metadata
13-
uses: dependabot/fetch-metadata@v2.3.0
13+
uses: dependabot/fetch-metadata@v2
1414
with:
1515
github-token: "${{ secrets.GITHUB_TOKEN }}"
1616
- name: Approve Dependabot PRs

Cargo.lock

Lines changed: 40 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ sha2 = { version = "0.10.9", optional = true }
7272
noncrypto-digests = { version = "0.3.3", optional = true }
7373

7474
[dev-dependencies]
75-
criterion = { version = "0.5", features = ["html_reports"] }
75+
criterion = { version = "0.6", features = ["html_reports"] }
7676
ctor = "0.4"
7777
env_logger = "0.11"
7878
insta = { version = "1", features = [] }

0 commit comments

Comments
 (0)