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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# We use `actions-rs` for most of our actions
#
# This file is for the main tests. clippy & rustfmt are separate workflows
on:
name: Cargo Test
env:
CARGO_TERM_COLOR: always
# has a history of occasional bugs (especially on old versions)
#
# the ci is free so we might as well use it ;)
CARGO_INCREMENTAL: 0
jobs:
test:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false # Even if one job fails we still want to see the other ones
matrix:
rust:
# Minimum Supported Rust Version
#
# This is hardcoded and needs to be in sync with Cargo.toml and the README
#
# If one of the features does not support this MSRV,
# you need to remove this from the main list and manually add the desired
# feature/version combinations to 'include'
# This hack is not currently needed because serde-erased v0.3 supports our MSRV.
- 1.63
# Intermediate Releases (between MSRV and latest stable)
# Be careful not to add these needlessly; they hold up CI
# The most recent version of stable rust (automatically updated)
- stable
- nightly
# NOTE: Features to test must be specified manually. They are applied to all versions separately.
features:
- "std"
- "std bytemuck slog serde"
include:
- rust: stable
features: "std parking_lot"
- rust: nightly
features: "nightly" # no features except nightly
- rust: nightly
features: "nightly alloc" # no features except nightly + alloc
- rust: nightly
features: "std nightly"
- rust: nightly
features: "std unique-wrap-std nightly"
- rust: nightly
features: "std nightly parking_lot"
- rust: nightly
features: "std nightly parking_lot bytemuck slog serde"
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Cache Cargo Registry
id: cache-index
uses: actions/cache@v4
with:
path:
# Before the sparse index, updating the registry took forever
~/.cargo/registry/index/
key: ${{ runner.os }}-cargo-${{ matrix.rust }}
restore-keys: |
${{ runner.os }}-cargo-
continue-on-error: false
- name: Test
# NOTE: Running --all-targets does not include doc tests
# Does not compile benchmarks because they break on MSRV. Still checked by clippy
run: |
cargo test --all --verbose --no-default-features --features "${{ matrix.features }}" --exclude "threadid-benchmarks"
clippy:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust:
# in hardcoded versions, warnings will fail the build
- 1.92
# in auto-updated versions, warnings will not fail the build
- stable
- nightly
features:
# NOTE: Unfortunately, the benchmarks crate implicitly requires 'std'
- "std parking_lot bytemuck slog serde"
include:
- rust: nightly
features: "std slog bytemuck parking_lot serde nightly"
- rust: nightly
features: "std nightly unique-wrap-std"
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: clippy
- name: Clippy
run: |
cargo clippy --all --all-targets --verbose --no-default-features --features "${{ matrix.features }}" -- -D warnings
# When using hardcoded/pinned versions, warnings are forbidden.
#
# On automatically updated versions of rust (both stable & nightly) we allow clippy to fail.
# This is because automatic updates can introduce new lints or change existing lints.
continue-on-error: ${{ !contains(matrix.rust, '1.') }}
docs:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: "-D warnings"
strategy:
fail-fast: false
matrix:
rust:
- nightly
- stable
features:
- "std parking_lot bytemuck slog serde"
include:
- rust: nightly
features: "std parking_lot bytemuck slog serde nightly nightly-docs"
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Docs
run: |
cargo doc --verbose --no-default-features --features "${{ matrix.features }}"
cargo-rdme:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
components: rust-src
# need to cache cargo-rdme to avoid redundant install
- name: Cache Binaries
id: cache-binaries
uses: actions/cache@v4
with:
path:
~/.cargo/bin/cargo-rdme
key: ${{ runner.os }}-binary-cargo-rdme
- name: Install cargo-rdme
shell: bash
# NOTE: This doesn't worry about installing updates
run: |
if test ! -f "$HOME/.cargo/bin/cargo-rdme"; then
cargo install cargo-rdme
fi
- name: Run cargo-rdme
run: |
cargo rdme --check