-
Notifications
You must be signed in to change notification settings - Fork 1
230 lines (215 loc) · 8.62 KB
/
ci.yml
File metadata and controls
230 lines (215 loc) · 8.62 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
name: ci
# Core CI: formatting, linting, workspace tests, and a publish dry-run
# of hyperdb-bootstrap. Separate from verify-hyperd-pin.yml, which only
# HEADs the pinned release's URLs.
on:
# Pure-prose changes don't affect Rust compilation, lint output,
# advisory checks, or the publish dry-run. The paths-ignore lists
# below skip CI on docs-only PRs to avoid burning CI minutes. Note:
# `deny.toml` and `.cargo/audit.toml` are deliberately NOT in the
# ignore list — those files configure the security checks themselves
# and a typo would silently disable them. Keep the two lists in sync.
push:
branches: [main]
paths-ignore:
- "**/*.md"
- "docs/**"
- "LICENSE-*"
- "NOTICE"
- ".github/ISSUE_TEMPLATE/**"
- ".github/pull_request_template.md"
pull_request:
paths-ignore:
- "**/*.md"
- "docs/**"
- "LICENSE-*"
- "NOTICE"
- ".github/ISSUE_TEMPLATE/**"
- ".github/pull_request_template.md"
workflow_dispatch: {}
# Cancel a PR's in-progress CI runs when a new push lands on the PR.
# Pushes to main always run to completion.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
fmt:
name: rustfmt
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt
cache: false
# Disable the action's default RUSTFLAGS=-D warnings; workspace
# lint policy lives in [workspace.lints] in Cargo.toml, and
# promoting warn-level lints to errors at the env level would
# break local-friendly behaviors elsewhere.
rustflags: ""
- run: cargo fmt --all --check
clippy:
# Clippy lints are platform-independent, so a single runner is enough.
# If a lint ever diverges by target (rare), broaden the matrix.
name: clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Install system libraries (fontconfig for plotters, mold for fast linking, protobuf)
run: sudo apt-get update -q && sudo apt-get install -y libfontconfig1-dev mold protobuf-compiler
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy
cache-key: clippy
# See fmt job for rationale; clippy enforces -D warnings via
# the explicit `-- -D warnings` arg below, not via env.
rustflags: ""
- name: Clippy (workspace, all targets)
# Every crate in the workspace is linted under the Microsoft Rust
# Guidelines config in `[workspace.lints]` (see Cargo.toml and
# docs/RUST_GUIDELINES.md). Warnings are treated as errors.
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Free disk space (Linux only)
if: runner.os == 'Linux'
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
- name: Install system libraries (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update -q && sudo apt-get install -y libfontconfig1-dev mold protobuf-compiler
- name: Install protobuf (macOS)
if: runner.os == 'macOS'
run: brew install protobuf
- name: Install protobuf (Windows)
if: runner.os == 'Windows'
run: choco install protoc -y
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
# Keep this cache separate from the clippy job's; the test
# profile has different artifacts and mixing them causes
# unnecessary rebuilds.
cache-key: test-${{ matrix.os }}
# See fmt job for rationale.
rustflags: ""
- name: Cache hyperd binary
# Keyed on the pinned release file, so bumping the pin
# (hyperdb-bootstrap/hyperd-version.toml) invalidates the cache
# automatically and the next run re-downloads.
id: hyperd-cache
uses: actions/cache@v5
with:
path: .hyperd
key: hyperd-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('hyperdb-bootstrap/hyperd-version.toml') }}
- name: Download hyperd
if: steps.hyperd-cache.outputs.cache-hit != 'true'
run: cargo run --release -p hyperdb-bootstrap --bin hyperdb-bootstrap -- download
- name: Workspace tests
shell: bash
env:
# .hyperd/current accepts either a file or directory per the
# hyperdb-api process loader; passing the directory keeps the
# command identical across OSes (hyperd vs hyperd.exe).
HYPERD_PATH: ${{ github.workspace }}/.hyperd/current
run: |
cargo test --workspace \
--exclude hyperdb-api-node \
--exclude hyperdb-bootstrap
# hyperdb-api-node needs napi-rs + a Node.js toolchain; it gets
# its own workflow when wired up. hyperdb-bootstrap has its own
# coverage (next step) and doesn't need hyperd running.
- name: hyperdb-bootstrap tests
run: cargo test -p hyperdb-bootstrap
publish-dry-run:
# Catches Cargo.toml metadata regressions (missing license, bad
# include paths, etc.) on the subset of crates that have no
# workspace deps — those are the only ones `cargo publish --dry-run`
# can check before anything's on crates.io. The other 4 crates
# (hyperdb-api-core, hyperdb-api-salesforce, hyperdb-api, hyperdb-mcp)
# resolve their path+version deps against the live index, which can't
# succeed until those deps are themselves published. (Note:
# hyperdb-api-core has an optional workspace dep on
# hyperdb-api-salesforce via its `salesforce-auth` feature, which
# triggers the same path-resolution failure even though the dep is
# optional.) They're exercised end-to-end by release.yml at tag
# time, when the whole wave ships together.
name: publish dry-run
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- name: Install mold linker
run: sudo apt-get update -q && sudo apt-get install -y mold
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache-key: publish-dry-run
rustflags: ""
- run: |
cargo publish -p hyperdb-bootstrap --dry-run
cargo publish -p sea-query-hyperdb --dry-run
deny:
# Enforces license allowlist, advisory ignore list, and banned-source
# rules from deny.toml. Pairs with the `audit` job — `cargo-deny` and
# `cargo-audit` have separate ignore mechanisms; both must agree.
name: cargo-deny
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
arguments: --all-features --workspace
audit:
# Enforces the RustSec advisory ignore list in .cargo/audit.toml.
# Fails on any unfixed advisory for a crate in the lockfile.
name: cargo-audit
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache-key: audit
rustflags: ""
- run: cargo install cargo-audit --locked
- run: cargo audit --deny warnings
version-consistency:
# Ensures version.txt (release-please source of truth) stays in sync
# with Cargo.toml workspace version. Catches release-please PRs that
# bump one but not the other.
name: version consistency
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Check version.txt matches Cargo.toml workspace version
run: |
set -euo pipefail
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')
TXT_VERSION=$(cat version.txt | tr -d '[:space:]')
if [[ "$CARGO_VERSION" != "$TXT_VERSION" ]]; then
echo "::error::version.txt ($TXT_VERSION) does not match Cargo.toml workspace version ($CARGO_VERSION)"
exit 1
fi