From df7e8a00490a9ae4a9d56b89929d65222a74a57e Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Sat, 3 Oct 2026 04:03:17 +0200 Subject: [PATCH] Fix Windows release builds --- Cargo.lock | 2 +- Cargo.toml | 2 +- Cross.toml | 15 +++++ Jenkinsfile | 4 -- README.md | 2 +- doc/releasing.md | 8 +-- src/lib.rs | 4 +- src/presentation.rs | 2 +- src/server.rs | 2 +- tests/release-wrapper.sh | 131 --------------------------------------- 10 files changed, 26 insertions(+), 146 deletions(-) create mode 100644 Cross.toml delete mode 100755 tests/release-wrapper.sh diff --git a/Cargo.lock b/Cargo.lock index 39843a4..793ade4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1003,7 +1003,7 @@ checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vsg-bridge-ls" -version = "0.3.2-rc.1" +version = "0.3.2-rc.2" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index c1002e3..db11c7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "vsg-bridge-ls" description = "A very featureless VSG to lsp bridge" -version = "0.3.2-rc.1" +version = "0.3.2-rc.2" edition = "2021" rust-version = "1.85.1" categories =["developement-tools"] diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..fbb7371 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,15 @@ +[build] + +[build.env] +passthrough = ["RUSTUP_TOOLCHAIN"] + +[target] + +[target.x86_64-unknown-linux-musl] +image = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main" + +[target.aarch64-unknown-linux-musl] +image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main" + +[target.x86_64-pc-windows-gnu] +image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:main" diff --git a/Jenkinsfile b/Jenkinsfile index c563925..05a8031 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -154,10 +154,6 @@ pipeline { echo "Running tests..." - sh -n release.sh - sh -n tests/release-wrapper.sh - tests/release-wrapper.sh - cargo test \ --locked \ --all-targets \ diff --git a/README.md b/README.md index 9c20adf..b3b236f 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ vsg-bridge-ls --version ``` The version includes both the Cargo release and build commit, for example -`0.3.2-rc.1+git.0123abcd`, so editor logs can identify the exact binary. +`0.3.2-rc.2+git.0123abcd`, so editor logs can identify the exact binary. ## 3. Configure Helix diff --git a/doc/releasing.md b/doc/releasing.md index 08df1f1..cd6e274 100644 --- a/doc/releasing.md +++ b/doc/releasing.md @@ -11,6 +11,8 @@ The default target matrix is owned by `rust_realease`: - `x86_64-pc-windows-gnu`. Cross and a working Docker or Podman backend are required for those builds. +`Cross.toml` selects the current upstream Cross images because older tagged +Windows GNU images lack the import libraries required by current Rust releases. `cargo-binstall` is required to verify the archives. Install the publisher from its authoritative repository if `rust_realease --version` is unavailable: @@ -23,7 +25,7 @@ cargo install --git \ ## 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 +example, version `0.3.2-rc.2` requires tag `v0.3.2-rc.2`. A hyphenated Cargo version makes the wrapper add `--prerelease` automatically. Development uses the SSH origin @@ -51,12 +53,10 @@ performed anonymously after upload. ## Verification and publication -Run the wrapper test and a non-mutating publisher inspection first: +Run a syntax check and 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 ``` diff --git a/src/lib.rs b/src/lib.rs index 8ba7922..1b8b20c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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-rc.1+git.")); + assert!(VERSION.starts_with("0.3.2-rc.2+git.")); assert!(VERSION - .strip_prefix("0.3.2-rc.1+git.") + .strip_prefix("0.3.2-rc.2+git.") .is_some_and(|revision| revision == "unknown" || (revision.len() == 8 && revision.bytes().all(|byte| byte.is_ascii_hexdigit())))); } diff --git a/src/presentation.rs b/src/presentation.rs index 62b9563..39a1209 100644 --- a/src/presentation.rs +++ b/src/presentation.rs @@ -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-rc.1","note":"```"}"#); + let hover = append_debug_hover(hover, r#"{"version":"0.3.2-rc.2","note":"```"}"#); let HoverContents::Markup(markup) = hover.contents else { panic!("expected Markdown hover") }; diff --git a/src/server.rs b/src/server.rs index d21d6c5..a7a2525 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1292,7 +1292,7 @@ mod tests { assert!(report["bridge"]["version"] .as_str() - .is_some_and(|version| version.starts_with("0.3.2-rc.1+git."))); + .is_some_and(|version| version.starts_with("0.3.2-rc.2+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); diff --git a/tests/release-wrapper.sh b/tests/release-wrapper.sh deleted file mode 100755 index 75bbc62..0000000 --- a/tests/release-wrapper.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/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'