Rework CI: cross Windows on Linux, build only on dispatch/tag
Regular push/PR runs the test job only. workflow_dispatch and v* tags then build linux-amd64, windows-amd64, and macos-arm64 as separate jobs. Windows is cargo-xwin from Ubuntu (MSVC ABI, Unix-host protoc) instead of native windows-latest. Registry/git cache is shared on Ubuntu; release target/ is not cached; xwin splat has its own cache.
This commit is contained in:
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
# Shallow work/ checkout for GitHub Actions.
|
||||
#
|
||||
# Unlike apply-patches.sh this does not clone upstream/ (that copy is a full
|
||||
# history clone for make update). CI only needs the pinned SHA + patches/.
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
REV="$(read_rev)"
|
||||
|
||||
info "Fetching upstream ${REV:0:12} -> work/"
|
||||
rm -rf "$WORK_DIR"
|
||||
git init "$WORK_DIR"
|
||||
git -C "$WORK_DIR" remote add origin "$UPSTREAM_URL"
|
||||
git -C "$WORK_DIR" fetch --depth 1 origin "$REV"
|
||||
git -C "$WORK_DIR" checkout --force --detach FETCH_HEAD
|
||||
git -C "$WORK_DIR" checkout -B "$WORK_BRANCH"
|
||||
git -C "$WORK_DIR" tag -f "$BASE_TAG"
|
||||
git -C "$WORK_DIR" config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git -C "$WORK_DIR" config user.name "github-actions[bot]"
|
||||
|
||||
shopt -s nullglob
|
||||
patches=("$PATCHES_DIR"/*.patch)
|
||||
shopt -u nullglob
|
||||
if ((${#patches[@]})); then
|
||||
git -C "$WORK_DIR" am --3way --keep-cr --whitespace=nowarn "${patches[@]}"
|
||||
fi
|
||||
|
||||
info "work/ ready: upstream ${REV:0:12} + ${#patches[@]} patch(es)"
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copy a cargo --target release binary into dist/ with a checksum sidecar.
|
||||
#
|
||||
# Required env:
|
||||
# TARGET rustc triple (selects work/target/$TARGET/release/)
|
||||
# ARTIFACT basename without extension (grok-linux-amd64, …)
|
||||
# EXE filename cargo wrote (xai-grok-pager or xai-grok-pager.exe)
|
||||
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
: "${TARGET:?TARGET is required}"
|
||||
: "${ARTIFACT:?ARTIFACT is required}"
|
||||
: "${EXE:?EXE is required}"
|
||||
|
||||
src="$WORK_DIR/target/$TARGET/release/$EXE"
|
||||
[[ -f "$src" ]] || {
|
||||
echo "missing $src" >&2
|
||||
ls -la "$WORK_DIR/target/$TARGET/release" >&2 || true
|
||||
exit 1
|
||||
}
|
||||
|
||||
mkdir -p "$ROOT/dist"
|
||||
if [[ "$EXE" == *.exe ]]; then
|
||||
dest="$ROOT/dist/${ARTIFACT}.exe"
|
||||
else
|
||||
dest="$ROOT/dist/${ARTIFACT}"
|
||||
strip "$src" || true
|
||||
fi
|
||||
cp "$src" "$dest"
|
||||
|
||||
{
|
||||
echo "artifact=$(basename "$dest")"
|
||||
echo "target=${TARGET}"
|
||||
echo "git=${GITHUB_SHA:-}"
|
||||
echo "upstream=$(read_rev)"
|
||||
echo "rustc=$(rustc --version)"
|
||||
} > "$ROOT/dist/${ARTIFACT}.txt"
|
||||
|
||||
if command -v sha256sum >/dev/null; then
|
||||
(cd "$ROOT/dist" && sha256sum "$(basename "$dest")" "${ARTIFACT}.txt" > "${ARTIFACT}.sha256")
|
||||
else
|
||||
(cd "$ROOT/dist" && shasum -a 256 "$(basename "$dest")" "${ARTIFACT}.txt" > "${ARTIFACT}.sha256")
|
||||
fi
|
||||
|
||||
info "packaged $dest"
|
||||
Reference in New Issue
Block a user