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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build
on:
push:
branches:
- '**'
pull_request:
branches:
- main
- 'release/**'
permissions:
contents: read
concurrency:
group: build-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 3
RUSTUP_MAX_RETRIES: 3
jobs:
# Portability. The crate is pure Rust over rust_decimal with no platform
# code, so one job per supported OS family is enough to catch a regression;
# the previous matrix ran two Ubuntu versions, which tested nothing the other
# did not.
build:
name: build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout
# actions/checkout v7.0.1
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
# One toolchain step, no curl, no retry wrapper, no failure-only
# fallback. The previous job installed rustup by piping curl into sh
# inside a retry action, then ran a second setup step, then declared a
# fallback `if: failure()` that could never run because the steps before
# it had already failed the job.
- name: Install Rust
# dtolnay/rust-toolchain master (the generic action; the version branches
# such as `1.14` hardcode that Rust release and reject a `toolchain` input)
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
id: toolchain
with:
toolchain: stable
- name: Cache Rust dependencies
# actions/cache v6.1.0
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
# Keyed on the toolchain as well as the manifest: a cache built by a
# different rustc cannot be reused, and the previous key omitted it.
# `cachekey` comes from the `id: toolchain` step above — without that
# id the expression expands empty and the scoping silently does
# nothing. The restore key carries the toolchain too, so a partial
# restore cannot cross toolchains either.
# ~/.cargo/bin is no longer cached, so a stale binary cannot shadow a
# pinned install.
key: ${{ runner.os }}-build-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-build-${{ steps.toolchain.outputs.cachekey }}-
- name: Build
run: cargo build --all-features --all-targets
# Minimum supported Rust version. `rust-version` in Cargo.toml is a promise
# to consumers, so it is verified rather than asserted.
#
# The library only: dev-dependencies such as criterion do not constrain
# anyone depending on this crate. 1.88 is required by utoipa 6.
msrv:
name: msrv (1.88, library)
runs-on: ubuntu-latest
steps:
- name: Checkout
# actions/checkout v7.0.1
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Install MSRV toolchain
# dtolnay/rust-toolchain master (the generic action; the version branches
# such as `1.14` hardcode that Rust release and reject a `toolchain` input)
uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
with:
toolchain: '1.88'
- name: Cache Rust dependencies
# actions/cache v6.1.0
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-msrv-1.88-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-msrv-1.88-
# `+1.88` overrides rust-toolchain.toml, which pins `stable` for local
# development; without it cargo would silently use stable here and the
# job would prove nothing.
# Printed and asserted, not assumed. rust-toolchain.toml pins `stable`
# for local development and silently overrides whatever the runner has
# installed, so without the `+1.88` override and this check the job
# would go green while compiling on stable and proving nothing.
- name: Confirm the toolchain really is 1.88
run: |
rustc +1.88 --version
rustc +1.88 --version | grep -q '^rustc 1\.88\.' \
|| { echo "MSRV job is not running on 1.88"; exit 1; }
- name: Check the library at MSRV, in every feature configuration
run: |
cargo +1.88 check --lib --all-features
cargo +1.88 check --lib --no-default-features