-
Notifications
You must be signed in to change notification settings - Fork 1
262 lines (243 loc) · 10.2 KB
/
Copy pathrust.yml
File metadata and controls
262 lines (243 loc) · 10.2 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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
# `scripts/ci-local.sh` runs `cargo fmt --all --check` as its first step. CI
# did not, which made the script stricter than CI instead of equal to it, and
# formatting drift reached master unnoticed. Same command, same arguments.
fmt:
name: Formatting
runs-on: ubicloud-standard-2
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Formatting (cargo fmt --all --check)
run: cargo fmt --all --check
build:
name: Build and test (${{ matrix.name }})
runs-on: ubicloud-standard-2
# A cold all-target workspace build plus compile-fail's nested Cargo checks
# exceeded 30 minutes when GitHub's cache service was unavailable. Keep
# enough room for a real from-scratch release gate.
timeout-minutes: 45
# Manual only. `cargo test --workspace --all-targets` is a ten-minute
# compile before it runs anything, and three legs of it is half an hour.
# Nothing waits on it: it does not gate a pull request and it does not gate
# `publish`, so a release is not held up by a matrix re-answering what the
# smoke job and a developer's own `scripts/ci-local.sh` already answered.
#
# Ask for it with `workflow_dispatch` when a change deserves it.
if: github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
include:
- name: default
args: ""
test_debug: 2
- name: versioned-publication
args: "--features versioned-row-publication"
test_debug: 2
- name: all-features
args: "--all-features"
# Full DWARF makes Rust 1.98's bundled rust-lld crash while linking
# the large integration-test binary on a small runner.
test_debug: 0
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
# There is no separate build step. `cargo test --all-targets` builds every
# target it is about to run, and the build step ran without
# `CARGO_PROFILE_TEST_DEBUG`: the two commands disagreed about the test
# profile, so the second one missed the first one's cache and compiled the
# workspace a second time. On the all-features leg it also compiled with the
# full DWARF that `test_debug: 0` is set to avoid, which is what makes
# rust-lld crash linking the integration-test binary on a two-core runner.
- name: Build and run tests
run: cargo test --workspace --all-targets ${{ matrix.args }} --verbose
env:
CARGO_PROFILE_TEST_DEBUG: ${{ matrix.test_debug }}
# What every push and pull request gets instead of the full matrix: the
# library tests of every crate, without `--all-targets`.
#
# That leaves out the integration-test binary and the compile-fail harness,
# which is where the ten minutes live -- the trybuild tests shell out to
# nested cargo builds, and one of them alone took 56 seconds. The lib tests
# are the part that answers "did this change break something" quickly, and
# they are not a token gesture: the assertion that turned this whole workflow
# red was `worktable_dsl`'s `legacy_in_place_section_is_rejected`, a lib test
# this job runs and the fmt/clippy/no-std jobs all passed straight over.
#
# The full matrix still runs on master and on demand.
smoke:
name: Smoke test (lib tests)
runs-on: ubicloud-standard-2
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
- name: Library tests (cargo test --workspace --lib)
run: cargo test --workspace --lib --verbose
clippy_check:
name: Clippy (${{ matrix.name }})
runs-on: ubicloud-standard-2
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: default
args: ""
- name: all-features
args: "--all-features"
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
- name: Clippy (deny warnings)
run: cargo clippy --workspace --all-targets ${{ matrix.args }} -- -D warnings
cell_lock_models:
name: Archived-row lock concurrency models
runs-on: ubicloud-standard-2
timeout-minutes: 15
# Manual only, for the same reason as `build`. The models explore an
# interleaving space rather than run a suite, and they build into their own
# CARGO_TARGET_DIR so they share no cache and pay a cold compile every time.
if: github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --release --lib cell_lock_models
env:
RUSTFLAGS: --cfg wt_loom
CARGO_TARGET_DIR: target/cell-lock-loom
no_default_features:
name: Library without default features
runs-on: ubicloud-standard-2
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: sh scripts/check-no-std.sh -p worktable --lib --no-default-features
- run: sh scripts/check-no-std.sh --manifest-path tests/nostd-consumer/Cargo.toml
- run: cargo test --manifest-path tests/nostd-consumer/Cargo.toml
- run: rustup target add x86_64-pc-windows-gnu
- run: sh scripts/check-no-std.sh -p worktable --lib --no-default-features
env:
NO_STD_TARGET: x86_64-pc-windows-gnu
CARGO_TARGET_DIR: target/no-std-cross
- name: Portable search feature combinations
run: |
for search in wti-predictable-search wti-hybrid-search wti-std-search; do
sh scripts/check-no-std.sh -p worktable --lib --no-default-features --features "$search,logical-index-persistence,versioned-row-publication,runtime-backends"
done
- run: cargo clippy -p worktable --lib --no-default-features -- -D warnings
duplicate_index_crates:
name: One version of each shared index crate
runs-on: ubicloud-standard-2
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "true"
add-job-id-key: "false"
# Two versions of WorkTablesIndex in one graph split the type identity of
# `Pair` and `ChangeEvent`, and the build then fails with "expected
# ChangeEvent<Pair<T, Link>>, found a different ChangeEvent<Pair<T,
# Link>>" across dozens of unrelated-looking lines. It happens whenever
# data_bucket and worktable disagree about which version they want, which
# is every time one is bumped and released without the other.
#
# The caret requirements are correct and stay. This turns the mismatch
# into one named failure instead of a wall of trait errors, which is the
# guard WT-8 asked for.
- name: Refuse a duplicated WorkTablesIndex or data_bucket
run: |
duplicates=$(cargo tree --duplicates --edges normal 2>/dev/null \
| grep -E '^(WorkTablesIndex|data_bucket) v' | sort -u)
if [ -n "$duplicates" ]; then
echo "More than one version of a shared index crate is in the graph:"
echo "$duplicates"
echo
echo "WorkTablesIndex, data_bucket and worktable move as one train."
echo "Publish compatible releases in dependency order."
exit 1
fi
echo "one version of each: ok"
publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
# `build` and `cell_lock_models` are deliberately absent: they are manual
# only, so needing them would mean a skipped job blocks every release.
needs: [fmt, smoke, clippy_check, no_default_features, duplicate_index_crates]
runs-on: ubicloud-standard-2
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish when master carries a new version
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
set -euo pipefail
if [ -z "${CARGO_REGISTRY_TOKEN:-}" ]; then
echo "CARGO_REGISTRY_TOKEN is not set on this repository" >&2
exit 1
fi
# Publish in dependency order. worktable_codegen depends on
# worktable_dsl and worktable depends on worktable_codegen, both by
# path with a caret requirement, so each must be on the registry before
# the next is packaged. Omitting worktable_dsl here is what made
# `cargo publish -p worktable_codegen` fail with "no matching package
# named `worktable_dsl` found" the moment the DSL extraction landed.
manifest_version() {
cargo read-manifest --manifest-path "$1" | jq -er '.version'
}
is_published() {
cargo info --registry crates-io "$1@$2" >/dev/null 2>&1
}
wait_until_published() {
package=$1
version=$2
for _ in $(seq 1 60); do
if is_published "$package" "$version"; then
return 0
fi
sleep 5
done
echo "$package $version did not appear on crates.io in five minutes" >&2
return 1
}
publish_if_new() {
package="$1"
manifest="$2"
version=$(manifest_version "$manifest")
if is_published "$package" "$version"; then
echo "$package $version is already on crates.io; skipping"
return 0
fi
echo "publishing $package $version"
cargo publish -p "$package"
wait_until_published "$package" "$version"
}
publish_if_new worktable_dsl dsl/Cargo.toml
publish_if_new worktable_codegen codegen/Cargo.toml
publish_if_new worktable Cargo.toml