Fix Windows release builds
Rust CI vsg-bridge-ls failed CI.
MadGobblins/vsg-bridge-ls/pipeline/head There was a failure building this commit
Details
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:
parent
c8444c5066
commit
df7e8a0049
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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 \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -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()))));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
Loading…
Reference in New Issue