Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c556a13857 | ||
|
|
b560909a76 | ||
|
|
53f226981f |
No files matched your search
+21
-4
@@ -1,8 +1,7 @@
|
||||
# CI: the three checks CLAUDE.md requires before any work is finished,
|
||||
# enforced on every push. Runs on the self-hosted mac-arm64 runner in host
|
||||
# mode (no containers), so the toolchain is the same one releases are built
|
||||
# with. The corpus is not in the repository, so corpus scoring stays a
|
||||
# local-only check (scripts/score.sh).
|
||||
# plus the corpus gate, enforced on every push. Runs on the self-hosted
|
||||
# mac-arm64 runner in host mode (no containers), so the toolchain is the
|
||||
# same one releases are built with.
|
||||
name: ci
|
||||
on:
|
||||
push:
|
||||
@@ -20,3 +19,21 @@ jobs:
|
||||
run: cargo clippy --all-targets -- -D warnings
|
||||
- name: cargo test
|
||||
run: cargo test --workspace
|
||||
|
||||
# The 99.1% headline, enforced: score the 820-file corpus and fail on any
|
||||
# regression below scripts/corpus-baseline (verification errors and
|
||||
# crashes fail outright). The corpus is pinned-rev clones (not in the
|
||||
# repo), cached on the runner host and fetched once on a cache miss.
|
||||
corpus:
|
||||
runs-on: macos-arm64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Ensure the cached corpus
|
||||
run: |
|
||||
corpus="$HOME/.cache/lucisv-corpus"
|
||||
[ -d "$corpus" ] || tools/corpus_fetch.sh "$corpus"
|
||||
echo "CORPUS=$corpus" >> "$GITHUB_ENV"
|
||||
- name: Build the release binary the scorer drives
|
||||
run: cargo build --release -p lucisv
|
||||
- name: Score and gate
|
||||
run: scripts/corpus_gate.sh "$CORPUS"
|
||||
@@ -21,6 +21,8 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build release artifacts for every target
|
||||
run: tools/release.sh --cross
|
||||
- name: Audit the cross-built artifacts
|
||||
run: tools/audit_artifacts.sh dist
|
||||
- name: Check the tag against the crate version
|
||||
run: |
|
||||
v=$(target/release/lucisv --version | awk '{print $2}')
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
/dist
|
||||
/.lucisv_cache
|
||||
/.score-results.tsv
|
||||
.DS_Store
|
||||
@@ -4,6 +4,47 @@ All notable changes to lucisv are recorded here. Versions follow
|
||||
[semantic versioning](https://semver.org/); until 1.0 the CLI's exit codes
|
||||
(see `README.md`) are the only frozen contract.
|
||||
|
||||
## 0.7.2 — 2026-08-26
|
||||
|
||||
Honest columns, honest docs, and a CI that enforces the headline number.
|
||||
|
||||
### Formatter: the printer's column survives multi-line raw text
|
||||
|
||||
Raw text that carries a string literal across a line break, and the
|
||||
`#( ... )` of a parameterized type reference, were emitted as a single
|
||||
text node with embedded newlines — leaving the printer's column tracker
|
||||
stale for the rest of the line, so later width checks broke
|
||||
conservatively. Both now ride the `Doc::Inline` path, which resumes
|
||||
measuring from the text's own last line. Bytes only change where the
|
||||
stale column forced a spurious break: across the 813-file passing corpus
|
||||
exactly one file improves (a `= new;` initializer after a multi-line
|
||||
`#( ... )` rejoins its line). Found by adversarial QA during 0.7.1's
|
||||
directive-split round.
|
||||
|
||||
### README truth pass
|
||||
|
||||
0.7.1's release page made the README wrong in three places, now fixed:
|
||||
prebuilt downloads exist (five platforms + the `.vsix` per release, with
|
||||
`SHA256SUMS`), `tools/release.sh` grew `--cross` a while ago, and the
|
||||
sideload example no longer hardcodes `0.5.0`. One claim was stale in the
|
||||
other direction: the "server does not read `lucisv.toml` yet" caveat —
|
||||
the server has read it since the config ladder landed; the README now
|
||||
states the actual precedence (`lucisv.toml` > `lucisv.*` settings >
|
||||
editor tab size > defaults). The README also now says plainly that
|
||||
Linux/Windows artifacts are cross-built and audited, not executed.
|
||||
`.DS_Store` is untracked and ignored.
|
||||
|
||||
### CI: the corpus score is a gate, and releases audit their artifacts
|
||||
|
||||
The 99.1% corpus number is now CI-enforced: every push scores the
|
||||
820-file corpus (pinned-rev cache on the runner) and fails on any drop
|
||||
below `scripts/corpus-baseline` — and on any verification error or
|
||||
crash, which are formatter bugs at any count. Release builds audit every
|
||||
cross-built binary before publishing (`tools/audit_artifacts.sh`): the
|
||||
musl build must be fully static, the linux-gnu build's glibc ceiling
|
||||
must stay ≤ 2.28 (RHEL 8), and every file must be the object format its
|
||||
name claims. Details: `docs/features/ci-release/README.md`.
|
||||
|
||||
## 0.7.1 — 2026-08-26
|
||||
|
||||
Conditional-split recovery and an automated release.
|
||||
|
||||
Generated
+8
-8
@@ -97,7 +97,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lucisv"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"lucisv_core",
|
||||
"rayon",
|
||||
@@ -108,11 +108,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "lucisv_core"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
|
||||
[[package]]
|
||||
name = "lucisv_server"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"lsp-server",
|
||||
"lsp-types",
|
||||
@@ -248,14 +248,14 @@ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
||||
|
||||
[[package]]
|
||||
name = "vlog_formatter"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"vlog_parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "vlog_linter"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"vlog_formatter",
|
||||
"vlog_parser",
|
||||
@@ -264,11 +264,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vlog_parser"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
|
||||
[[package]]
|
||||
name = "vlog_refactor"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"vlog_parser",
|
||||
"vlog_semantic",
|
||||
@@ -276,7 +276,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vlog_semantic"
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
dependencies = [
|
||||
"vlog_parser",
|
||||
]
|
||||
+1
-1
@@ -12,7 +12,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.7.1"
|
||||
version = "0.7.2"
|
||||
authors = ["Guoliang Chen"]
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
||||
@@ -610,8 +610,9 @@ go-to-definition, references and document/workspace symbols — the full list,
|
||||
and what is deliberately *not* advertised yet, is in
|
||||
`docs/features/lucisv-server/README.md`.
|
||||
|
||||
**The binary comes from the same build as the CLI**, and nothing downloads it
|
||||
for you:
|
||||
**The binary comes from the same build as the CLI.** Download it from the
|
||||
[releases page](https://git.luci.ooo/lucio/lucisv/releases) for your
|
||||
platform, or build it yourself:
|
||||
|
||||
```bash
|
||||
cargo build --release # target/release/lucisv-server (and target/release/lucisv)
|
||||
@@ -626,11 +627,12 @@ registering the file types and starting the server:
|
||||
|
||||
```bash
|
||||
tools/release.sh # builds dist/lucisv-<version>.vsix
|
||||
code --install-extension dist/lucisv-0.5.0.vsix
|
||||
code --install-extension dist/lucisv-<version>.vsix
|
||||
```
|
||||
|
||||
Sideloading that `.vsix` is the supported install; the extension is not on any
|
||||
marketplace. To package it by hand instead: `cd editors/vscode && npm ci &&
|
||||
The `.vsix` is also attached to every release on the
|
||||
[releases page](https://git.luci.ooo/lucio/lucisv/releases). Sideloading it
|
||||
is the supported install; the extension is not on any marketplace. To package it by hand instead: `cd editors/vscode && npm ci &&
|
||||
npx @vscode/vsce package`.
|
||||
|
||||
Settings are listed in `editors/vscode/README.md`, along with the full steps,
|
||||
@@ -665,10 +667,13 @@ to the folder walk, so the index is never silently empty.
|
||||
the handshake and the advertised capabilities are intact — which tells you
|
||||
whether a failure is the server or your editor config.
|
||||
|
||||
One caveat, stated up front: the server does **not** read `lucisv.toml` yet, so
|
||||
formatting through an editor uses the defaults (100 columns, 2-space indent)
|
||||
with the editor's tab size overriding the indent. `lucisv` on the command line
|
||||
does read it.
|
||||
**Formatting through an editor reads `lucisv.toml` too**, discovered from the
|
||||
buffer's own path by the CLI's rule, so format-on-save agrees with what
|
||||
`lucisv --check` does in CI. Precedence, highest first: `lucisv.toml`, then
|
||||
the editor's `lucisv.lineLength`/`lucisv.indent` settings, then the editor's
|
||||
tab size (indent only — the protocol carries no line-length), then the
|
||||
defaults. A broken config never blocks formatting: the buffer is formatted
|
||||
with the next rung down and the error is surfaced in the editor.
|
||||
|
||||
## Contributing / workflow
|
||||
|
||||
@@ -687,18 +692,27 @@ expected outputs with `UPDATE_SNAPSHOTS=1 cargo test -p vlog_formatter`.
|
||||
|
||||
## Install and releases
|
||||
|
||||
There are no prebuilt downloads: you build the artifacts, or someone builds
|
||||
them for your platform and hands you the files.
|
||||
Prebuilt downloads live on the
|
||||
[releases page](https://git.luci.ooo/lucio/lucisv/releases): every tagged
|
||||
version carries `lucisv` and `lucisv-server` for Apple Silicon and Intel
|
||||
macOS, static-musl and RHEL 8-compatible glibc Linux, and Windows, plus the
|
||||
`.vsix` and a `SHA256SUMS` to verify them with
|
||||
(`shasum -a 256 -c SHA256SUMS`). Copy the two binaries onto your `PATH` and
|
||||
sideload the extension with `code --install-extension`. The macOS binaries
|
||||
are smoke-tested on the build machine; the Linux and Windows ones are
|
||||
cross-built and audited (file type, dynamic-linkage, glibc-version ceiling),
|
||||
not executed — there is no Linux or Windows machine in the loop.
|
||||
|
||||
To build the same artifact set yourself:
|
||||
|
||||
```bash
|
||||
tools/release.sh # release binaries + the .vsix + SHA256SUMS, into dist/
|
||||
tools/release.sh # host binaries + the .vsix + SHA256SUMS, into dist/
|
||||
tools/release.sh --cross # ...plus the four cross-built platforms
|
||||
```
|
||||
|
||||
`dist/` then holds `lucisv-<version>-<host-triple>`,
|
||||
`lucisv-server-<version>-<host-triple>`, `lucisv-<version>.vsix` and `SHA256SUMS`
|
||||
(verify with `cd dist && shasum -a 256 -c SHA256SUMS`). Copy the two binaries
|
||||
onto your `PATH` and sideload the extension with `code --install-extension`.
|
||||
The script builds for the host triple only and publishes nothing anywhere.
|
||||
The script itself publishes nothing anywhere; publishing is CI's job —
|
||||
pushing a `vX.Y.Z` tag builds all of the above on Gitea Actions and attaches
|
||||
it to a release, with that version's `CHANGELOG.md` section as the notes.
|
||||
|
||||
Release notes are in [`CHANGELOG.md`](CHANGELOG.md); the full checklist —
|
||||
where the version number lives, how the `.vsix` is packaged, and what
|
||||
|
||||
@@ -8,7 +8,9 @@ pub enum Doc {
|
||||
/// Verbatim text. Must not contain newlines (use `HardLine`).
|
||||
Text(String),
|
||||
/// Verbatim text spliced into the *middle* of a line, newlines and all:
|
||||
/// the `{ ... }` of a `randomize() with { ... }` constraint block. It
|
||||
/// the `{ ... }` of a `randomize() with { ... }` constraint block, the
|
||||
/// `#( ... )` of a parameterized type reference, or raw text that
|
||||
/// carries a string literal across a line break. It
|
||||
/// carries its own indentation, so the printer copies it through
|
||||
/// untouched and resumes measuring from its last line. Unlike
|
||||
/// [`Doc::Verbatim`] it does not force enclosing groups to break — the
|
||||
|
||||
@@ -219,12 +219,14 @@ impl<'a> Fmt<'a> {
|
||||
/// A token that carries a string literal across a line break is emitted
|
||||
/// completely untouched instead: the leading whitespace of such a
|
||||
/// continuation line is part of the string's *value*, and re-indenting it
|
||||
/// would rewrite the string. Emitting the text as a single `Doc::Text`
|
||||
/// means the printer copies the newlines through without adding indent,
|
||||
/// so nothing changes and the result is a fixed point by construction.
|
||||
/// would rewrite the string. Emitting the text as a `Doc::Inline` means
|
||||
/// the printer copies the newlines through without adding indent — so
|
||||
/// nothing changes and the result is a fixed point by construction —
|
||||
/// while its column tracking resumes from the text's own last line
|
||||
/// (`Doc::Text` must not contain newlines).
|
||||
fn raw_text(&self, raw: &RawText) -> Doc {
|
||||
if crosses_line_inside_string(&raw.text) {
|
||||
return text(raw.text.clone());
|
||||
return Doc::Inline(raw.text.clone());
|
||||
}
|
||||
self.raw_lines(&raw.text, raw.col)
|
||||
}
|
||||
@@ -236,9 +238,11 @@ impl<'a> Fmt<'a> {
|
||||
/// `raw_lines`'s dedent-by-column only reaches a fixed point when the text
|
||||
/// begins its own line — the dedent has to cancel the indent the printer
|
||||
/// adds back — and this text never does, so re-indenting it would drift.
|
||||
/// Emitting it unchanged is idempotent by construction.
|
||||
/// Emitting it unchanged is idempotent by construction. `Doc::Inline`
|
||||
/// rather than `Doc::Text` so a multi-line `#( ... )` keeps the printer's
|
||||
/// column honest (`Doc::Text` must not contain newlines).
|
||||
fn raw_inline(&self, raw: &RawText) -> Doc {
|
||||
text(raw.text.clone())
|
||||
Doc::Inline(raw.text.clone())
|
||||
}
|
||||
|
||||
/// The `{ ... }` of a `randomize() with { ... }`: verbatim source spliced
|
||||
|
||||
@@ -254,6 +254,22 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// After a multi-line `Inline` is *printed*, `col` is the width of its
|
||||
/// last line — so a group that follows it on that line is measured from
|
||||
/// there, not from an accumulated character count. Raw text that carries
|
||||
/// a string literal across a line break rides this arm; when it was
|
||||
/// emitted as `Doc::Text` (whose printer arm never resets `col` on the
|
||||
/// embedded newlines it is not supposed to contain), the stale column
|
||||
/// forced every later fit check on the line into a conservative break.
|
||||
#[test]
|
||||
fn a_group_after_a_multi_line_inline_measures_from_its_last_line() {
|
||||
let d = concat(vec![
|
||||
Doc::Inline("x = \"aaaaaaaaaaaaaaaaaaaaaaaa\nbbb\" ".into()),
|
||||
group(vec![text("+"), indent(vec![Doc::Line, text("yyyy")]), text(";")]),
|
||||
]);
|
||||
assert_eq!(p(20, d), "x = \"aaaaaaaaaaaaaaaaaaaaaaaa\nbbb\" + yyyy;");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hard_line_forces_break() {
|
||||
let d = group(vec![text("a"), Doc::HardLine, text("b")]);
|
||||
|
||||
@@ -560,3 +560,16 @@ class c;
|
||||
g = 1;
|
||||
endfunction
|
||||
endclass
|
||||
====
|
||||
# the printer's column stays honest after a multi-line #( ... ): the
|
||||
# initializer is measured from the raw text's last line, not from an
|
||||
# accumulated count, so a call that fits the real line stays on it
|
||||
class c;
|
||||
uvm_analysis_port #(bit [31:0],
|
||||
foo_t) p = new("a_fairly_long_component_name", some_parent_handle, extra_argument);
|
||||
endclass
|
||||
----
|
||||
class c;
|
||||
uvm_analysis_port #(bit [31:0],
|
||||
foo_t) p = new("a_fairly_long_component_name", some_parent_handle, extra_argument);
|
||||
endclass
|
||||
@@ -25,8 +25,10 @@ green checks, matching versions, and written notes.
|
||||
- One runner, capacity 1: CI and release jobs queue rather than race. A
|
||||
release build and a local `cargo build` can still contend for the
|
||||
machine; acceptable on a solo project.
|
||||
- The corpus is not in the repository, so CI does not score it;
|
||||
`scripts/score.sh` stays a local check.
|
||||
- The corpus is not in the repository; CI scores it from a pinned-rev
|
||||
cache on the runner host (`~/.cache/lucisv-corpus`, fetched once by
|
||||
`tools/corpus_fetch.sh` on a miss) and gates on
|
||||
`scripts/corpus-baseline` via `scripts/corpus_gate.sh`.
|
||||
- `secrets.GITHUB_TOKEN` is auto-provided by Gitea Actions with rights to
|
||||
create releases and attach assets on this repo.
|
||||
- Release notes are written by hand (by the lead/Claude, specific to the
|
||||
@@ -58,6 +60,14 @@ green checks, matching versions, and written notes.
|
||||
- [x] `tools/release_notes.sh` (+ missing-section failure path tested),
|
||||
`tools/publish_release.sh` (get-or-create, skip-attached re-run safety).
|
||||
- [x] End-to-end verification with a real tag (v0.7.1).
|
||||
- [x] Corpus score as a CI gate (`corpus` job: cached corpus +
|
||||
`scripts/corpus_gate.sh` against `scripts/corpus-baseline`; regression,
|
||||
verification error or crash fails the push).
|
||||
- [x] Release-time artifact audit (`tools/audit_artifacts.sh`: musl
|
||||
static-ness, linux-gnu glibc ceiling <= 2.28, PE/Mach-O file types) —
|
||||
automates what RELEASING.md documented as manual; Linux/Windows binaries
|
||||
remain audited, never executed (no such machine in the loop, and no
|
||||
container runtime on the runner).
|
||||
- [ ] A second runner on a non-macOS host, if native-built (rather than
|
||||
cross-built) Linux artifacts are ever wanted.
|
||||
|
||||
@@ -74,6 +84,14 @@ green checks, matching versions, and written notes.
|
||||
than a fallback body. Version bumped to 0.7.1 and released end-to-end as
|
||||
the verification.
|
||||
|
||||
- 2026-08-26 — lead (round 2, after external review). Added the corpus
|
||||
gate job and the release artifact audit; both tested before landing (the
|
||||
gate against the local corpus at exactly the 813 baseline, the audit
|
||||
against the 10 downloaded v0.7.1 release binaries — all pass). Docker
|
||||
was considered for executing the musl build's tests on Linux and
|
||||
rejected: no container runtime exists on the runner Mac, and installing
|
||||
a VM stack is an owner decision, not a CI increment.
|
||||
|
||||
## QA log
|
||||
|
||||
_(no QA round — infrastructure, verified by the live v0.7.1 run; see work log)_
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "lucisv",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "lucisv",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"vscode-languageclient": "9.0.1"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "lucisv",
|
||||
"displayName": "lucisv — Verilog/SystemVerilog",
|
||||
"description": "Formatting, diagnostics, navigation and semantic highlighting for Verilog and SystemVerilog, served by the lucisv language server.",
|
||||
"version": "0.7.1",
|
||||
"version": "0.7.2",
|
||||
"publisher": "guoliangchen",
|
||||
"author": "Guoliang Chen",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
813
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# CI gate over the corpus score: fail on any regression from the recorded
|
||||
# baseline. `scripts/corpus-baseline` holds the passing-file count the tree
|
||||
# must sustain; a verification error or a crash fails regardless of the
|
||||
# count — those are formatter bugs by definition (see tools/corpus_check.sh).
|
||||
#
|
||||
# Usage: scripts/corpus_gate.sh [corpus-dir]
|
||||
#
|
||||
# An improvement does not fail, it nags: bump the baseline in the same
|
||||
# change that earns it, so the gate ratchets and never slides back.
|
||||
|
||||
set -eu
|
||||
|
||||
here=$(cd "$(dirname "$0")" && pwd)
|
||||
corpus=${1:-corpus}
|
||||
baseline=$(cat "$here/corpus-baseline")
|
||||
|
||||
json=$("$here/score.sh" "$corpus")
|
||||
printf '%s\n' "$json"
|
||||
|
||||
passing=$(printf '%s' "$json" | jq .passing)
|
||||
verr=$(printf '%s' "$json" | jq '.failures_by_category["verification-error"] // 0')
|
||||
crash=$(printf '%s' "$json" | jq '.failures_by_category.crash // 0')
|
||||
|
||||
status=0
|
||||
[ "$verr" -eq 0 ] || { echo "FAIL: $verr verification error(s) — always a formatter bug" >&2; status=1; }
|
||||
[ "$crash" -eq 0 ] || { echo "FAIL: $crash crash(es) — always a formatter bug" >&2; status=1; }
|
||||
if [ "$passing" -lt "$baseline" ]; then
|
||||
echo "FAIL: corpus regression — $passing passing, baseline is $baseline" >&2
|
||||
status=1
|
||||
elif [ "$passing" -gt "$baseline" ]; then
|
||||
echo "note: $passing passing beats the baseline $baseline — bump scripts/corpus-baseline"
|
||||
fi
|
||||
exit $status
|
||||
@@ -230,3 +230,9 @@ mode), running via `brew services start gitea-runner`; config at
|
||||
one-time and minted in Gitea's admin UI; nothing secret lives in this
|
||||
repo — the release workflow authenticates with the `GITHUB_TOKEN` Gitea
|
||||
Actions injects per job.
|
||||
|
||||
Since 0.7.2 the release workflow also runs `tools/audit_artifacts.sh`
|
||||
before publishing — the automated form of the manual symbol/file-type
|
||||
audit above (musl static-ness, the GLIBC_2.28 ceiling, PE/Mach-O types) —
|
||||
and ordinary CI gates every push on the corpus score
|
||||
(`scripts/corpus_gate.sh` against `scripts/corpus-baseline`).
|
||||
Executable
+88
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bash
|
||||
# Audit the cross-built release artifacts in a dist directory.
|
||||
#
|
||||
# Usage: tools/audit_artifacts.sh [dist-dir]
|
||||
#
|
||||
# There is no Linux or Windows machine in the release loop, so the
|
||||
# non-macOS artifacts are never executed; this automates the audit
|
||||
# tools/RELEASING.md documented as manual, and the release fails if any
|
||||
# check does:
|
||||
# *-linux-musl ELF x86-64, statically linked (zero NEEDED entries)
|
||||
# *-linux-gnu ELF x86-64, glibc symbol ceiling <= 2.28 (RHEL 8)
|
||||
# *-windows-gnu.exe PE32+ x86-64
|
||||
# *-apple-darwin Mach-O 64-bit (arm64 / x86_64 per triple)
|
||||
#
|
||||
# Needs the messense x86_64-unknown-linux-gnu toolchain's objdump for the
|
||||
# ELF checks (the same toolchain the linux-gnu build itself needs).
|
||||
|
||||
set -eu
|
||||
|
||||
dist=${1:-dist}
|
||||
objdump=x86_64-unknown-linux-gnu-objdump
|
||||
glibc_max=2.28
|
||||
|
||||
command -v "$objdump" >/dev/null || { echo "no $objdump on PATH" >&2; exit 2; }
|
||||
[ -d "$dist" ] || { echo "no dist directory at $dist" >&2; exit 2; }
|
||||
|
||||
status=0
|
||||
fail() { echo "FAIL: $*" >&2; status=1; }
|
||||
checked=0
|
||||
|
||||
for f in "$dist"/lucisv-*; do
|
||||
[ -f "$f" ] || continue
|
||||
name=$(basename "$f")
|
||||
case $name in
|
||||
*.vsix | SHA256SUMS | RELEASE_NOTES.md) continue ;;
|
||||
esac
|
||||
kind=$(file -b "$f")
|
||||
case $name in
|
||||
*x86_64-unknown-linux-musl)
|
||||
case $kind in
|
||||
*ELF*x86-64*) ;;
|
||||
*) fail "$name: not an x86-64 ELF: $kind" ;;
|
||||
esac
|
||||
if "$objdump" -p "$f" | grep -q NEEDED; then
|
||||
fail "$name: musl build has dynamic dependencies (must be static)"
|
||||
fi
|
||||
;;
|
||||
*x86_64-unknown-linux-gnu)
|
||||
case $kind in
|
||||
*ELF*x86-64*) ;;
|
||||
*) fail "$name: not an x86-64 ELF: $kind" ;;
|
||||
esac
|
||||
top=$("$objdump" -T "$f" | grep -o 'GLIBC_[0-9.]*' | sort -Vu | tail -1)
|
||||
top=${top#GLIBC_}
|
||||
highest=$(printf '%s\n%s\n' "$top" "$glibc_max" | sort -V | tail -1)
|
||||
if [ "$highest" != "$glibc_max" ]; then
|
||||
fail "$name: glibc ceiling $top exceeds $glibc_max (breaks RHEL 8)"
|
||||
fi
|
||||
;;
|
||||
*x86_64-pc-windows-gnu.exe)
|
||||
case $kind in
|
||||
*PE32+*x86-64*) ;;
|
||||
*) fail "$name: not a PE32+ x86-64 executable: $kind" ;;
|
||||
esac
|
||||
;;
|
||||
*aarch64-apple-darwin)
|
||||
case $kind in
|
||||
*Mach-O*arm64*) ;;
|
||||
*) fail "$name: not a Mach-O arm64 binary: $kind" ;;
|
||||
esac
|
||||
;;
|
||||
*x86_64-apple-darwin)
|
||||
case $kind in
|
||||
*Mach-O*x86_64*) ;;
|
||||
*) fail "$name: not a Mach-O x86_64 binary: $kind" ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
fail "$name: unrecognized artifact name — teach this script about it"
|
||||
;;
|
||||
esac
|
||||
checked=$((checked + 1))
|
||||
echo "ok: $name"
|
||||
done
|
||||
|
||||
[ "$checked" -gt 0 ] || { echo "no binaries found under $dist" >&2; exit 2; }
|
||||
echo "audited $checked binaries"
|
||||
exit $status
|
||||
Reference in new issue
Block a user