mirror of
https://github.com/Twigpine/node.git
synced 2026-11-09 05:20:05 -10:00
sync-release-lock ran cargo update --workspace on whatever Rust the ubuntu-latest image shipped, so the lock it wrote for the release PR came off an undeclared input. Install the same stable toolchain the other cargo jobs use. This does not make resolution identical (stable moves, and the MSRV gate checks the same lock on 1.91), it just removes the runner image from the equation. The release-binaries build, both Dockerfiles and the darwin path of build-bins.sh also resolved without --locked, so a lockfile disagreeing with the manifests was caught on the PR gates but not where artifacts are actually produced. Add --locked to all five. Two of those five cannot reach resolution today and are hardened for when they can: the Dockerfile dep-cache layer at line 24 copies four of the workspace's six member manifests, so cargo dies at workspace load and || true swallows it, and Dockerfile.bins pins rust:1.85 against a 1.91 MSRV. Both are pre-existing and left alone here. The live coverage comes from release.yml, Dockerfile:37 and build-bins.sh. The gitlawb-core dependency-purity gate still resolves without --locked on purpose, but its comment justified that by saying the build and test jobs do the same, which stopped being true when those jobs gained --locked. Restate the real reason: a stale lock would red that gate for something unrelated to the dependency closure it checks.
75 lines
2.2 KiB
Bash
Executable File
75 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Build gl and git-remote-gitlawb binaries for all platforms.
|
|
# Output goes to dist/bin/
|
|
#
|
|
# Usage:
|
|
# ./scripts/build-bins.sh # linux-x86_64 + linux-arm64
|
|
# ./scripts/build-bins.sh linux-x86_64 # single platform
|
|
# ./scripts/build-bins.sh darwin-arm64 # native macOS build
|
|
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
ROOT="$SCRIPT_DIR/.."
|
|
OUT="$ROOT/dist/bin"
|
|
|
|
mkdir -p "$OUT"
|
|
|
|
build_linux() {
|
|
local PLATFORM="$1"
|
|
local DOCKER_PLATFORM="$2"
|
|
local RUST_TARGET="$3"
|
|
|
|
echo ""
|
|
echo "==> Building $PLATFORM (musl static, docker: $DOCKER_PLATFORM)..."
|
|
|
|
docker build \
|
|
--platform "$DOCKER_PLATFORM" \
|
|
--build-arg "TARGET=$RUST_TARGET" \
|
|
-f "$ROOT/Dockerfile.bins" \
|
|
-t "gitlawb-bins-$PLATFORM" \
|
|
"$ROOT"
|
|
|
|
local CONTAINER
|
|
CONTAINER=$(docker create --platform "$DOCKER_PLATFORM" "gitlawb-bins-$PLATFORM")
|
|
docker cp "$CONTAINER:/gl" "$OUT/gl-$PLATFORM"
|
|
docker cp "$CONTAINER:/git-remote-gitlawb" "$OUT/git-remote-gitlawb-$PLATFORM"
|
|
docker rm "$CONTAINER"
|
|
|
|
chmod +x "$OUT/gl-$PLATFORM" "$OUT/git-remote-gitlawb-$PLATFORM"
|
|
echo " ✓ $OUT/gl-$PLATFORM"
|
|
echo " ✓ $OUT/git-remote-gitlawb-$PLATFORM"
|
|
}
|
|
|
|
build_darwin_arm64() {
|
|
echo ""
|
|
echo "==> Building darwin-arm64 (native cargo)..."
|
|
cd "$ROOT"
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
cargo build --release --locked -p gl -p git-remote-gitlawb
|
|
cp target/release/gl "$OUT/gl-darwin-arm64"
|
|
cp target/release/git-remote-gitlawb "$OUT/git-remote-gitlawb-darwin-arm64"
|
|
chmod +x "$OUT/gl-darwin-arm64" "$OUT/git-remote-gitlawb-darwin-arm64"
|
|
echo " ✓ $OUT/gl-darwin-arm64"
|
|
echo " ✓ $OUT/git-remote-gitlawb-darwin-arm64"
|
|
}
|
|
|
|
PLATFORMS="${*:-linux-x86_64 linux-arm64}"
|
|
|
|
for PLATFORM in $PLATFORMS; do
|
|
case "$PLATFORM" in
|
|
linux-x86_64) build_linux linux-x86_64 linux/amd64 x86_64-unknown-linux-musl ;;
|
|
linux-arm64) build_linux linux-arm64 linux/arm64 aarch64-unknown-linux-musl ;;
|
|
darwin-arm64) build_darwin_arm64 ;;
|
|
*)
|
|
echo "Unknown platform: $PLATFORM" >&2
|
|
echo "Supported: linux-x86_64 linux-arm64 darwin-arm64" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo ""
|
|
echo "Done. Binaries in $OUT:"
|
|
ls -lh "$OUT"
|