Repository navigation
105 lines (96 loc) · 3.27 KB
/
Copy pathci.yml
File metadata and controls
105 lines (96 loc) · 3.27 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Continuous integration for origin.
#
# Jobs group the `just` validation recipes by what they compile, so each
# compilation happens once per job:
#
# checks -> fmt-check, deny
# rust -> lint, test, doc-test, on Linux and macOS
# msrv -> the workspace builds with its minimum supported Rust version
#
# `ci` is the single status to require: it fails if any job failed. A run
# cancelled by a newer push skips it, so it never reports that as a failure.
# Caches are saved from main only, so branches never evict them.
name: CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
RUST_BACKTRACE: short
NEXTEST_PROFILE: ci
jobs:
checks:
name: checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2
with:
tool: just,cargo-deny
- run: just fmt-check
- run: just deny
# origin-platform has one implementation per OS, so both run the tests.
rust:
name: rust (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: taiki-e/install-action@3f74d7c16a4242f1c95561e98edc25d36adb4375 # v2
with:
tool: just,cargo-nextest
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: just lint
- run: just test
- name: Preserve test report
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: junit-${{ matrix.os }}
path: target/nextest/ci/junit.xml
retention-days: 7
if-no-files-found: ignore
- run: just doc-test
# Builds with the `rust-version` of Cargo.toml rather than the pinned
# toolchain, so raising the toolchain cannot silently raise the MSRV.
msrv:
name: msrv
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Install the minimum supported Rust version
run: |
msrv=$(sed -n 's/^rust-version = "\(.*\)"$/\1/p' Cargo.toml)
rustup toolchain install "$msrv" --profile minimal
echo "MSRV=$msrv" >> "$GITHUB_ENV"
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2
with:
key: msrv
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo +"$MSRV" check --locked --workspace --all-targets --all-features
ci:
name: ci
if: ${{ !cancelled() }}
needs: [checks, rust, msrv]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0
with:
jobs: ${{ toJSON(needs) }}