Prepare 0.3.2 release candidate
Rust CI vsg-bridge-ls failed CI.
MadGobblins/vsg-bridge-ls/pipeline/head There was a failure building this commit Details

This commit is contained in:
Dandaedre 2026-10-03 03:24:31 +02:00
parent 49d0eb6104
commit c8444c5066
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
12 changed files with 289 additions and 7 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
debug/
target/
coverage/
dist/
# Generated locally by Cargo Tarpaulin.
/lcov.info

2
Cargo.lock generated
View File

@ -1003,7 +1003,7 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65"
[[package]]
name = "vsg-bridge-ls"
version = "0.3.2"
version = "0.3.2-rc.1"
dependencies = [
"anyhow",
"clap",

View File

@ -1,7 +1,7 @@
[package]
name = "vsg-bridge-ls"
description = "A very featureless VSG to lsp bridge"
version = "0.3.2"
version = "0.3.2-rc.1"
edition = "2021"
rust-version = "1.85.1"
categories =["developement-tools"]
@ -10,6 +10,11 @@ keywords = ["lsp", "bridge"]
repository = "https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls"
authors = ["dandaedre"]
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }-v{ version }.tgz"
pkg-fmt = "tgz"
bin-dir = "{ name }-{ target }-v{ version }/{ bin }{ binary-ext }"
[dependencies]
anyhow = "1.0.93"
clap = { version = "4.5.21", features = ["derive"] }

4
Jenkinsfile vendored
View File

@ -154,6 +154,10 @@ pipeline {
echo "Running tests..."
sh -n release.sh
sh -n tests/release-wrapper.sh
tests/release-wrapper.sh
cargo test \
--locked \
--all-targets \

View File

@ -54,7 +54,7 @@ vsg-bridge-ls --version
```
The version includes both the Cargo release and build commit, for example
`0.3.2+git.0123abcd`, so editor logs can identify the exact binary.
`0.3.2-rc.1+git.0123abcd`, so editor logs can identify the exact binary.
## 3. Configure Helix
@ -130,6 +130,7 @@ process environment variables. See the [debug-mode reference](doc/debug-mode.md)
- [Experimental individual rule fixes](doc/experimental-rule-fix.md)
- [Debug-information mode](doc/debug-mode.md)
- [Development and packaging](doc/development.md)
- [Release procedure](doc/releasing.md)
The bridge is deliberately small. Contributions should preserve clean LSP
standard output and keep the VSG subprocess boundary explicit.

89
doc/releasing.md Normal file
View File

@ -0,0 +1,89 @@
# Release procedure
`release.sh` is the project-local wrapper for `rust_realease`. It releases the
single Cargo package and binary named `vsg-bridge-ls` using the release profile
and both cargo-binstall `.tgz` archives and standalone binaries.
The default target matrix is owned by `rust_realease`:
- `x86_64-unknown-linux-musl`;
- `aarch64-unknown-linux-musl`; and
- `x86_64-pc-windows-gnu`.
Cross and a working Docker or Podman backend are required for those builds.
`cargo-binstall` is required to verify the archives. Install the publisher from
its authoritative repository if `rust_realease --version` is unavailable:
```sh
cargo install --git \
https://proxy.dandaedre.com/gitea/idle-org/rust_realease.git \
--locked rust_realease
```
## Release identity
The Cargo version is authoritative and produces a `v`-prefixed tag. For
example, version `0.3.2-rc.1` requires tag `v0.3.2-rc.1`. A hyphenated Cargo
version makes the wrapper add `--prerelease` automatically.
Development uses the SSH origin
`git@git.dandaedre.com:MadGobblins/vsg-bridge-ls.git`. The exact fallback in
`rust-release.toml` directs release creation, downloads, and cargo-binstall to
the public HTTPS repository without changing the Git remote.
This repository does not currently maintain a changelog file. Release notes and
version selection must therefore be reviewed from the commits since the prior
tag before publication.
## Token handling
Pass a readable token file as the first wrapper argument. Only its first line is
exported as `GITEA_TOKEN`; the value is never placed in process arguments. Do
not commit the token or its path. The usual workspace-local invocation is:
```sh
./release.sh ../gitea_token.txt --dry-run
```
The token needs repository read and release write access. This is a public
repository, so generated downloads and cargo-binstall verification can be
performed anonymously after upload.
## Verification and publication
Run the wrapper test and a non-mutating publisher inspection first:
```sh
sh -n release.sh
sh -n tests/release-wrapper.sh
tests/release-wrapper.sh
./release.sh ../gitea_token.txt --dry-run
```
The dry run must report the expected package, version, tag, three targets,
artifact names, and HTTPS destination. It does not build, tag, push, create a
release, or upload files.
A local build and package inspection is also non-publishing:
```sh
./release.sh ../gitea_token.txt --compile-only
```
Inspect the resulting `dist/release-*` directory, `SHA256SUMS`, archives,
executables, and cargo-binstall metadata. Generated `dist/` content is ignored
by Git.
Before a live run, require a clean checkout, confirm that the expected signed
tag points to `HEAD`, push the commit and tag, and verify the same tag exists on
the remote. Recheck Gitea for an existing release and asset-name collisions.
Then publish explicitly:
```sh
./release.sh ../gitea_token.txt
```
The wrapper itself never edits Git metadata, creates or pushes a tag, or
publishes without `rust_realease`. An existing asset is a hard stop. Never pass
`--replace-assets` unless the exact existing release and assets were inspected
and replacement was separately approved.

48
release.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
set -eu
usage() {
echo "usage: $0 <gitea-token-file> [rust_realease options...]" >&2
exit 2
}
[ "$#" -ge 1 ] || usage
token_file=$1
shift
if [ ! -f "$token_file" ] || [ ! -r "$token_file" ]; then
echo "token file is not a readable regular file: $token_file" >&2
exit 2
fi
if ! command -v rust_realease >/dev/null 2>&1; then
echo "rust_realease is not installed or not available in PATH" >&2
exit 2
fi
GITEA_TOKEN=
IFS= read -r GITEA_TOKEN <"$token_file" || :
if [ -z "$GITEA_TOKEN" ]; then
echo "token file is empty: $token_file" >&2
exit 2
fi
export GITEA_TOKEN
repository_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
manifest_version=$(sed -n 's/^version = "\([^"]*\)"/\1/p' \
"$repository_dir/Cargo.toml" | head -n 1)
if [ -z "$manifest_version" ]; then
echo "could not determine the selected package version" >&2
exit 2
fi
set -- \
"$repository_dir" \
--package vsg-bridge-ls \
--artifact-format both \
"$@"
case "$manifest_version" in
*-*) set -- "$@" --prerelease ;;
esac
exec rust_realease "$@"

3
rust-release.toml Normal file
View File

@ -0,0 +1,3 @@
[[repository.fallbacks]]
origin = "git@git.dandaedre.com:MadGobblins/vsg-bridge-ls.git"
fallback-url = "https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls"

View File

@ -312,9 +312,9 @@ mod tests {
#[test]
fn version_includes_source_revision() {
assert_eq!(Options::command().get_version(), Some(VERSION));
assert!(VERSION.starts_with("0.3.2+git."));
assert!(VERSION.starts_with("0.3.2-rc.1+git."));
assert!(VERSION
.strip_prefix("0.3.2+git.")
.strip_prefix("0.3.2-rc.1+git.")
.is_some_and(|revision| revision == "unknown"
|| (revision.len() == 8 && revision.bytes().all(|byte| byte.is_ascii_hexdigit()))));
}

View File

@ -219,7 +219,7 @@ mod tests {
#[test]
fn appends_debug_information_to_hover() {
let hover = hover_for_line(&[diagnostic(None, None)], 2);
let hover = append_debug_hover(hover, r#"{"version":"0.3.2","note":"```"}"#);
let hover = append_debug_hover(hover, r#"{"version":"0.3.2-rc.1","note":"```"}"#);
let HoverContents::Markup(markup) = hover.contents else {
panic!("expected Markdown hover")
};

View File

@ -1292,7 +1292,7 @@ mod tests {
assert!(report["bridge"]["version"]
.as_str()
.is_some_and(|version| version.starts_with("0.3.2+git.")));
.is_some_and(|version| version.starts_with("0.3.2-rc.1+git.")));
assert_eq!(report["modes"]["debug"], true);
assert_eq!(report["modes"]["experimental_rule_fix"], true);
assert_eq!(report["modes"]["experimental_multi_rule_line_fix"], true);

131
tests/release-wrapper.sh Executable file
View File

@ -0,0 +1,131 @@
#!/bin/sh
set -eu
fail() {
echo "release wrapper test failed: $*" >&2
exit 1
}
assert_line() {
expected=$1
file=$2
line=$3
actual=$(sed -n "${line}p" "$file")
[ "$actual" = "$expected" ] ||
fail "line $line of $file: expected '$expected', got '$actual'"
}
repository_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
temporary_dir=$(mktemp -d "${TMPDIR:-/tmp}/vsg-bridge-release-test.XXXXXX")
trap 'chmod -R u+rw "$temporary_dir" 2>/dev/null || :; rm -rf "$temporary_dir"' EXIT HUP INT TERM
fake_bin="$temporary_dir/fake-bin"
capture="$temporary_dir/capture"
mkdir -p "$fake_bin" "$capture"
cat >"$fake_bin/rust_realease" <<'EOF'
#!/bin/sh
set -eu
: "${RELEASE_TEST_CAPTURE:?}"
printf '%s\n' "${GITEA_TOKEN-}" >"$RELEASE_TEST_CAPTURE/token"
: >"$RELEASE_TEST_CAPTURE/arguments"
for argument do
printf '%s\n' "$argument" >>"$RELEASE_TEST_CAPTURE/arguments"
done
if [ -f "$1/rust-release.toml" ]; then
cp "$1/rust-release.toml" "$RELEASE_TEST_CAPTURE/rust-release.toml"
fi
git -C "$1" remote get-url origin >"$RELEASE_TEST_CAPTURE/origin" 2>/dev/null || :
exit "${RELEASE_TEST_EXIT_STATUS:-0}"
EOF
chmod +x "$fake_bin/rust_realease"
token_file="$temporary_dir/token.txt"
printf '%s\n%s\n' 'wrapper-test-token' 'ignored-second-line' >"$token_file"
output="$temporary_dir/output"
RELEASE_TEST_CAPTURE=$capture PATH="$fake_bin:$PATH" \
"$repository_dir/release.sh" "$token_file" --dry-run "value with spaces" \
>"$output" 2>&1
assert_line 'wrapper-test-token' "$capture/token" 1
assert_line "$repository_dir" "$capture/arguments" 1
assert_line '--package' "$capture/arguments" 2
assert_line 'vsg-bridge-ls' "$capture/arguments" 3
assert_line '--artifact-format' "$capture/arguments" 4
assert_line 'both' "$capture/arguments" 5
assert_line '--dry-run' "$capture/arguments" 6
assert_line 'value with spaces' "$capture/arguments" 7
assert_line '--prerelease' "$capture/arguments" 8
[ "$(wc -l <"$capture/arguments" | tr -d ' ')" = 8 ] ||
fail 'unexpected extra publisher arguments'
if grep -F 'wrapper-test-token' "$capture/arguments" "$output" >/dev/null; then
fail 'token leaked through publisher arguments or output'
fi
grep -F 'git@git.dandaedre.com:MadGobblins/vsg-bridge-ls.git' \
"$capture/rust-release.toml" >/dev/null || fail 'SSH fallback origin was not visible'
grep -F 'https://proxy.dandaedre.com/gitea/MadGobblins/vsg-bridge-ls' \
"$capture/rust-release.toml" >/dev/null || fail 'HTTPS fallback URL was not visible'
assert_line 'git@git.dandaedre.com:MadGobblins/vsg-bridge-ls.git' "$capture/origin" 1
stable_repository="$temporary_dir/repository with spaces"
stable_capture="$temporary_dir/stable capture"
mkdir -p "$stable_repository" "$stable_capture"
cp "$repository_dir/release.sh" "$stable_repository/release.sh"
chmod +x "$stable_repository/release.sh"
printf '%s\n' '[package]' 'name = "vsg-bridge-ls"' 'version = "1.2.3"' \
>"$stable_repository/Cargo.toml"
RELEASE_TEST_CAPTURE=$stable_capture PATH="$fake_bin:$PATH" \
"$stable_repository/release.sh" "$token_file" "option with spaces" \
>"$output" 2>&1
assert_line "$stable_repository" "$stable_capture/arguments" 1
assert_line 'option with spaces' "$stable_capture/arguments" 6
if grep -Fx -- '--prerelease' "$stable_capture/arguments" >/dev/null; then
fail 'stable version unexpectedly enabled prerelease mode'
fi
set +e
RELEASE_TEST_CAPTURE=$capture RELEASE_TEST_EXIT_STATUS=23 PATH="$fake_bin:$PATH" \
"$repository_dir/release.sh" "$token_file" >"$output" 2>&1
publisher_status=$?
set -e
[ "$publisher_status" = 23 ] || fail "publisher status became $publisher_status"
if "$repository_dir/release.sh" >"$output" 2>&1; then
fail 'missing token argument succeeded'
fi
if "$repository_dir/release.sh" "$temporary_dir/missing-token" >"$output" 2>&1; then
fail 'missing token file succeeded'
fi
empty_token="$temporary_dir/empty-token"
: >"$empty_token"
if PATH="$fake_bin:$PATH" "$repository_dir/release.sh" "$empty_token" >"$output" 2>&1; then
fail 'empty token file succeeded'
fi
unreadable_token="$temporary_dir/unreadable-token"
printf '%s\n' 'unreadable' >"$unreadable_token"
chmod 000 "$unreadable_token"
if [ ! -r "$unreadable_token" ]; then
if PATH="$fake_bin:$PATH" "$repository_dir/release.sh" "$unreadable_token" \
>"$output" 2>&1; then
fail 'unreadable token file succeeded'
fi
fi
chmod 600 "$unreadable_token"
missing_bin="$temporary_dir/missing-bin"
mkdir "$missing_bin"
if PATH="$missing_bin" "$repository_dir/release.sh" "$token_file" >"$output" 2>&1; then
fail 'missing publisher succeeded'
fi
invalid_repository="$temporary_dir/invalid-repository"
mkdir "$invalid_repository"
cp "$repository_dir/release.sh" "$invalid_repository/release.sh"
chmod +x "$invalid_repository/release.sh"
printf '%s\n' '[package]' 'name = "vsg-bridge-ls"' >"$invalid_repository/Cargo.toml"
if RELEASE_TEST_CAPTURE=$capture PATH="$fake_bin:$PATH" \
"$invalid_repository/release.sh" "$token_file" >"$output" 2>&1; then
fail 'manifest without a version succeeded'
fi
echo 'release wrapper tests passed'