Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 27 additions & 7 deletions .github/workflows/build-llvm-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,21 @@ jobs:
path: /tmp/llvm-output/LLVM-${{ inputs.llvm_version }}-Linux-X64-musl.tar.xz
retention-days: 3

# ── Job 2: Commit ─────────────────────────────────────────────────────────────
# ── Job 2: Stage manifest + publish parts (Option B) ──────────────────────────
# Separate job so a commit/push failure can be re-run in seconds without
# repeating the 90-minute builds.
#
# Option B: the LLVM binaries do NOT go into git. This job commits only the
# regenerated manifest.json (checksums) to the prebuilt submodule, and uploads
# the split parts as a workflow artifact. The release operator downloads that
# artifact into prebuilt/ alongside the other staged tools, and release.sh
# publishes the whole set to the release tag (where fetch-artifacts.sh reads
# them). This keeps the slimmed prebuilt repo manifests-only.
#
# Clones prebuilt directly (not via git submodule update) so it is always
# on the main branch — no detached HEAD, no push ambiguity.
commit:
name: Commit to prebuilt/ and update submodule pointer
name: Stage LLVM manifest + publish parts artifact
needs: [build, build-musl]
# Run even if one leg (a distro or musl) failed, so the variants that DID
# build still get staged. The steps below no-op cleanly when nothing is new.
Expand Down Expand Up @@ -388,18 +395,31 @@ jobs:
print("manifest platforms:", list(man["platforms"].keys()))
PY

- name: Commit and push prebuilt
- name: Upload LLVM parts as release-staging artifact
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: llvm-linux-parts-${{ inputs.llvm_version }}
# Option B: the binaries are published to the release by release.sh, not
# committed to git. The operator downloads this into prebuilt/ before
# releasing. Preserve the toolchains/llvm/<ver>/ tree so it drops in place.
path: prebuilt-wr/toolchains/llvm/${{ inputs.llvm_version }}/*.part-*
retention-days: 7
if-no-files-found: warn

- name: Commit manifest only (Option B — binaries stay out of git)
working-directory: prebuilt-wr
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "toolchains/llvm/${LLVM_VERSION}/"
# Commit ONLY the regenerated manifest (checksums). The split parts are
# left untracked here and shipped via the release-staging artifact above.
git add "toolchains/llvm/${LLVM_VERSION}/manifest.json"
if git diff --cached --quiet; then
echo "No new/changed LLVM parts to commit — nothing to do."
echo "Manifest unchanged — nothing to commit."
exit 0
fi
git diff --cached --stat
git commit -m "build: LLVM ${LLVM_VERSION} tools for RHEL/Rocky (per-distro glibc builds)"
git commit -m "build: LLVM ${LLVM_VERSION} manifest (Linux RHEL/Rocky + musl checksums)"
git push

- name: Update submodule pointer in main repo
Expand All @@ -415,5 +435,5 @@ jobs:
fi
echo "Pointing prebuilt submodule → ${PREBUILT_SHA}"
git update-index --cacheinfo "160000,${PREBUILT_SHA},prebuilt"
git commit -m "chore: update prebuilt — LLVM ${LLVM_VERSION} RHEL/Rocky builds"
git commit -m "chore: update prebuilt — LLVM ${LLVM_VERSION} manifest"
git push
11 changes: 5 additions & 6 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ name: Smoke Test

# Full install + run-tests.sh regression suite.
#
# REQUIREMENTS:
# This workflow installs real tools from the prebuilt archives.
# The prebuilt submodule must contain the tool archives (tar.xz / zip),
# OR a self-hosted runner must have them pre-staged at the repo root.
# GitHub-hosted runners can run this only if archives are committed to
# the prebuilt submodule (large files should use Git LFS).
# REQUIREMENTS (Option B):
# The prebuilt submodule ships manifests only; the tool binaries live in the
# matching release's assets. The "Fetch prebuilt binaries" step below rehydrates
# and checksum-verifies this platform's set into prebuilt/ before installing,
# using DEVKIT_ARTIFACT_BASE (defaults to the release tag derived from version.go).
#
# TRIGGERS:
# - Weekly (Monday 06:00 UTC) -- automated regression check
Expand Down
48 changes: 48 additions & 0 deletions scripts/internal/check-prebuilt-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Author: Nima Shafie
# =============================================================================
# check-prebuilt-artifacts.sh
#
# Option B companion to check-prebuilt-manifests.sh. Where that check asserts
# every declared artifact has a resolvable SHA256 (a manifest/authoring check
# that runs in CI with no binaries present), THIS check asserts every declared
# artifact file is actually PRESENT ON DISK in the prebuilt working tree — the
# guarantee a publisher needs before uploading a release (publish-artifacts.sh)
# or building an offline bundle, so the tag/bundle is a complete, installable set.
#
# Enumerates each manifest's required files for all platforms (whole archives and
# split .part-* sets alike) via enumerate-artifacts.py, and fails if any are not
# found under the prebuilt root.
#
# USAGE: bash scripts/internal/check-prebuilt-artifacts.sh [prebuilt-dir]
# EXIT: 0 = every declared artifact file is present on disk; 1 = one or more absent.
# =============================================================================
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
PREBUILT="${1:-$REPO_ROOT/prebuilt}"

command -v python3 >/dev/null 2>&1 || { echo "[!!] python3 not found on PATH" >&2; exit 1; }

missing=0
while IFS= read -r manifest; do
reldir="$(dirname "${manifest#"$PREBUILT"/}")"
while IFS=$'\t' read -r name _sha; do
[[ -z "$name" ]] && continue
if [[ ! -f "$PREBUILT/$reldir/$name" ]]; then
echo "ABSENT $reldir/$name (declared in ${manifest#"$PREBUILT"/})"
missing=$((missing + 1))
fi
done < <(python3 "$SCRIPT_DIR/lib/enumerate-artifacts.py" "$manifest" all | tr -d '\r')
done < <(find "$PREBUILT" -name manifest.json -type f | sort)

if [[ "$missing" -gt 0 ]]; then
echo "" >&2
echo "[!!] $missing declared artifact file(s) are not present on disk in prebuilt/." >&2
echo " This tree is manifests-only or partially staged; a release/bundle built" >&2
echo " from it would be incomplete. Rehydrate with fetch-artifacts.sh (from the" >&2
echo " previous release tag) and overlay any newly-staged tool bumps." >&2
exit 1
fi
echo "[OK] every manifest-declared artifact file is present on disk in prebuilt/."
40 changes: 39 additions & 1 deletion scripts/internal/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
# --skip-sign Skip Authenticode / GPG binary signing
# --skip-vt Skip VirusTotal scan
# --skip-gh-release Skip creating the GitHub release and tag
# --skip-artifacts Skip publishing prebuilt tool artifacts to the release
# (Option B). By default, after the release is created, every
# artifact present in prebuilt/ is uploaded to the tag so
# fetch-artifacts.sh can rehydrate a complete set. The tree
# must therefore hold the FULL artifact set at release time —
# hydrate it first with fetch-artifacts.sh from the previous
# tag, then overlay any newly-staged tool bumps.
#
# Standard full release (new binaries, public):
# bash scripts/internal/release.sh 1.2.3 --upload
Expand All @@ -34,9 +41,10 @@ TEST_PYPI=false
SKIP_SIGN=false
SKIP_VT=false
SKIP_GH_RELEASE=false
SKIP_ARTIFACTS=false

if [[ -z "$VERSION" ]]; then
echo "Usage: bash scripts/internal/release.sh <version> [--no-build] [--upload] [--test] [--skip-sign] [--skip-vt] [--skip-gh-release]" >&2
echo "Usage: bash scripts/internal/release.sh <version> [--no-build] [--upload] [--test] [--skip-sign] [--skip-vt] [--skip-gh-release] [--skip-artifacts]" >&2
echo " version format: 1.2.3 or 1.2.3rc1 or 1.2.3b2" >&2
exit 1
fi
Expand All @@ -50,6 +58,7 @@ for arg in "$@"; do
--skip-sign) SKIP_SIGN=true ;;
--skip-vt) SKIP_VT=true ;;
--skip-gh-release) SKIP_GH_RELEASE=true ;;
--skip-artifacts) SKIP_ARTIFACTS=true ;;
*) echo "Unknown flag: $arg" >&2; exit 1 ;;
esac
done
Expand Down Expand Up @@ -288,6 +297,35 @@ pip install airgap-devkit==$VERSION
"${GH_FLAGS[@]}"

echo " GitHub release: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/tag/$TAG"

# ── Option B: publish the prebuilt tool artifacts to this release ──────
# The prebuilt submodule ships manifests only; the tool binaries live in
# the release's assets and are rehydrated by fetch-artifacts.sh, which
# verifies each file against the manifest SHA256. Upload every artifact
# present in prebuilt/ so the tag is a complete, self-contained set.
if [[ "$SKIP_ARTIFACTS" == false ]]; then
# Guard against publishing an incomplete tag: fetch-artifacts.sh uses
# a single base, so every manifest-declared artifact must end up on
# THIS tag. Verify the working tree holds them all before uploading;
# a manifests-only or partially-staged tree would silently ship a tag
# that cannot install. Hydrate first (fetch-artifacts.sh from the
# previous tag) + overlay new stagings, or pass --skip-artifacts.
echo ""
echo " Verifying prebuilt artifact tree is complete before publish ..."
missing=$(bash "$REPO_ROOT/scripts/internal/check-prebuilt-artifacts.sh" 2>&1) || {
echo "$missing" >&2
echo " [FAIL] prebuilt/ is missing artifacts the manifests declare — refusing to" >&2
echo " publish an incomplete release. Hydrate the full set first:" >&2
echo " DEVKIT_ARTIFACT_BASE=.../releases/download/<prev-tag> \\" >&2
echo " bash scripts/internal/fetch-artifacts.sh --platform all" >&2
echo " then re-stage this version's tool bumps and re-run (or --skip-artifacts)." >&2
exit 1
}
echo " Publishing prebuilt tool artifacts to $TAG ..."
bash "$REPO_ROOT/scripts/internal/publish-artifacts.sh" --gh "$TAG"
else
echo " --skip-artifacts: not publishing prebuilt tool artifacts to $TAG."
fi
fi
fi

Expand Down