-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (70 loc) · 2.79 KB
/
Copy pathci.yml
File metadata and controls
86 lines (70 loc) · 2.79 KB
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
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
# Manual re-run from the Actions tab / `gh workflow run`. Runs lint + test only;
# the release job is gated to `push` events, so a manual run never publishes.
workflow_dispatch:
# Cancel superseded PR runs, but never interrupt a master run (it may publish).
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
# Rust version for the style/lint gates. Pinned on purpose: rustfmt and clippy
# change their output/lints between releases, so a floating `stable` would let
# a new toolchain fail CI on otherwise-unrelated commits. Bump this manually
# (and fix any new findings in the same PR) when you want to adopt a newer one.
LINT_TOOLCHAIN: "1.96.0"
jobs:
lint:
name: fmt · clippy (pinned)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.LINT_TOOLCHAIN }}
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --all --check
- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings
test:
name: test (stable)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Tests stay on the current stable so they catch real compiler breakage.
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Pure-Rust unit tests + the output-regression suite. The PDF/image/METS
# snapshot tests need pdfium + the ONNX models, so they are NOT run here —
# this job downloads no ML models and stays fast.
- name: Test
run: cargo test --workspace
publish:
name: release & publish
needs: [lint, test]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write # push the version-bump commit + tag
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history + tags, for the semantic version bump
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Decide the next version from conventional commits since the last tag; if
# there is one, bump + commit + tag it, push to master, and publish the
# crates (in dependency order, skipping any already on crates.io). A no-op
# when no release-worthy commit landed. The release commit is pushed with
# GITHUB_TOKEN and carries [skip ci], so it does not re-trigger CI.
- name: Release & publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: bash scripts/release.sh