refactor(ci): remove retired direct-tag publishing jobs from desktop-bundled-release
This commit is contained in:
committed by
Bear Huddleston
parent
2844c3a182
commit
1011994146
9
.github/workflows/README.md
vendored
9
.github/workflows/README.md
vendored
@@ -511,12 +511,11 @@ Inside one run:
|
||||
outputs. The matching `… result` job collapses them.
|
||||
- `smoke-*` call **`desktop-bundle-smoke.yml`**. It needs a staged SHA and
|
||||
skips after a failed `validate`.
|
||||
- `publish-win32-updater` / `publish-darwin-updater` require
|
||||
`upload_release=true` and no `build_commit`/`channel`.
|
||||
- `stage-receipt-*` run only for `release-phase=candidate`. `stable-*` jobs
|
||||
run only for `release-phase=publish`.
|
||||
- `builds-table` runs only for a plain uploading tag build (canary).
|
||||
`commit-builds-summary` runs only for commit builds.
|
||||
- `commit-builds-summary` runs only for commit builds. Release download tables
|
||||
and channel feeds are published from `stable-release.yml` (for both stable
|
||||
and canary).
|
||||
|
||||
Re-smoke an already staged artifact without rebuilding:
|
||||
|
||||
@@ -585,7 +584,7 @@ gh workflow run windows-install-update-e2e.yml --ref <branch> -f strict_acceptan
|
||||
| `ci-review-comment.yml` | CI review comment | workflow_run(CI in_progress) | none |
|
||||
| `ci.yaml` | CI | PR, main, dispatch, call | stable, canary-e2e |
|
||||
| `deploy-site.yml` | Deploy Site | main (paths), release published, dispatch | skills-index (dispatch) |
|
||||
| `desktop-bundled-release.yml` | Desktop Bundled Release | dispatch, call | stable; canary/release.py (dispatch) |
|
||||
| `desktop-bundled-release.yml` | Desktop Bundled Release | dispatch, call | stable; commit/channel builds (dispatch) |
|
||||
| `desktop-bundle-smoke.yml` | Desktop bundle smoke | dispatch, call | desktop-bundled-release |
|
||||
| `docker.yml` | Docker Build, Test, and Publish | PR, main, call | stable |
|
||||
| `docs-search-monitor.yml` | Docs Search Monitor | cron 6 h, workflow_run(Deploy Site), dispatch | none |
|
||||
|
||||
358
.github/workflows/desktop-bundled-release.yml
vendored
358
.github/workflows/desktop-bundled-release.yml
vendored
@@ -2,37 +2,32 @@ name: Desktop Bundled Release
|
||||
|
||||
# Builds the bundled desktop installer for each (os, arch) target.
|
||||
#
|
||||
# tag admission (shape + pyproject lockstep + ancestry on origin/main,
|
||||
# resolved to an IMMUTABLE full SHA) → per-OS builder jobs → stage
|
||||
# files + receipts to R2 (releases/tag/<tag>/) → gated publish jobs write
|
||||
# feeds → builds table. Stable candidates stop before feed publication.
|
||||
# admission (claim verification via stable-release.yml, commit build, or
|
||||
# channel build — resolved to an IMMUTABLE full SHA) → per-OS builder jobs
|
||||
# → stage files + receipts to R2.
|
||||
#
|
||||
# Per-OS topology (canary feeds follow their own platform builds; stable
|
||||
# publication and Store submission require the accepted cross-platform candidate):
|
||||
# Release tags (stable and canary) run only through stable-release.yml, which
|
||||
# calls this workflow in release-phase=candidate to build/smoke/stage receipts
|
||||
# and in release-phase=publish for stable publication / Store submission.
|
||||
# Channel and commit builds dispatch this workflow directly.
|
||||
#
|
||||
# Per-OS topology:
|
||||
#
|
||||
# build-win32 (win32-x64 + win32-arm64) → stage packages + receipts to R2
|
||||
# Stable runs pick which Windows packages these build: `skip-signed` builds
|
||||
# Release runs pick which Windows packages these build: `skip-signed` builds
|
||||
# only the unsigned Store variant (no Azure signing), `skip-store` only the
|
||||
# signed bundled one.
|
||||
# build-darwin (darwin-arm64 only; there is no Intel macOS build)
|
||||
# → sign + notarize + stage dmg/zip/blockmap + the feed input to the R2 tag archive
|
||||
# build-linux (linux-x64 + linux-arm64) → tag builds only, diagnostic: AppImage
|
||||
# → sign + notarize + stage dmg/zip/blockmap + the feed input to the R2 archive
|
||||
# build-linux (linux-x64 + linux-arm64) → candidate phase only, diagnostic: AppImage
|
||||
# staged to the tag archive; gates nothing and writes no Linux feed
|
||||
# assemble-win32-bundle → native universal bundles
|
||||
# (needs build-win32): all downloadable builds stage without touching feeds.
|
||||
# smoke-darwin / smoke-win32 (per arch) → native install + chat
|
||||
# publish-win32-updater → tested canary bytes + feed
|
||||
# (needs BOTH Windows smoke matrices); stable promotion is sequenced by
|
||||
# the stable publication controller after GitHub publication.
|
||||
# stable-store → verified Store draft
|
||||
# smoke-darwin / smoke-win32 (per arch) → native install + chat
|
||||
# stable-store → verified Store draft
|
||||
# (beside stable-publish): materialize the immutable accepted Store bundle
|
||||
# and upload it via the MSStore CLI without rebuilding; the publication
|
||||
# pass commits it with auto-publish on.
|
||||
# publish-darwin-updater → macOS electron-updater feed
|
||||
# (needs the darwin leg): scripts.releases.r2 finalize turns the arm64
|
||||
# yml into releases/darwin/<channel>/<channel>-mac.yml — the feed
|
||||
# pointer is written LAST, and the job's concurrency group serializes
|
||||
# same-channel publications.
|
||||
#
|
||||
# Feed layout (matches apps/desktop/electron/app-updater.ts's arms):
|
||||
# releases/win32/<stable|canary>/<ch>.appinstaller App Installer feed
|
||||
@@ -40,10 +35,9 @@ name: Desktop Bundled Release
|
||||
# releases/darwin/<stable|canary>/<channel>-mac.yml electron-updater feed
|
||||
# (dmg/zip live once in releases/tag/<tag>/; the merged feed points at
|
||||
# them with absolute object keys)
|
||||
# The publish jobs write the feeds ONCE after their whole build matrix is
|
||||
# green, so a failed leg can never publish a partial channel. Stable candidate
|
||||
# jobs only stage tag-scoped objects; stable-release.yml gates feed promotion
|
||||
# on package acceptance and artifact publication. No GitHub job artifacts
|
||||
# Release candidate jobs only stage tag-scoped objects; stable-release.yml gates
|
||||
# feed promotion and channel-head advancement for both stable and canary on
|
||||
# package acceptance and artifact publication. No GitHub job artifacts
|
||||
# carry release files. Non-publishing tag builds leave output on the runner.
|
||||
# Commit builds stage under releases/commit/<sha>/ and write a run summary.
|
||||
# They never publish a release, updater feed, Store submission, or APT channel.
|
||||
@@ -233,10 +227,8 @@ jobs:
|
||||
outputs:
|
||||
# Resolve the build source once. Every privileged job uses this SHA,
|
||||
# not a mutable tag or the dispatch branch.
|
||||
# The tag's channel (stable | canary). publish-darwin-updater scopes
|
||||
# its concurrency group on this so two dispatches for the SAME
|
||||
# channel can never race their feed writes (a stable and a canary
|
||||
# publish in parallel by design — different feed files).
|
||||
# The tag's channel (stable | canary). build-darwin-arm64-release names
|
||||
# its staged per-arch feed yml after it.
|
||||
channel: ${{ steps.admission.outputs.channel }}
|
||||
sha: ${{ steps.admission.outputs.sha }}
|
||||
tag-object: ${{ steps.admission.outputs.tag-object }}
|
||||
@@ -258,12 +250,6 @@ jobs:
|
||||
termux: ${{ steps.admission.outputs.termux }}
|
||||
# Every group selected: the joins that render or summarize a whole build.
|
||||
all-jobs: ${{ steps.admission.outputs.all-jobs }}
|
||||
canary-table-selected: >-
|
||||
${{ startsWith(inputs.tag, 'canary.') && inputs.release-phase == ''
|
||||
&& inputs.channel == '' && inputs.disposable_channel == ''
|
||||
&& steps.admission.outputs.darwin-arm64 == 'true' && steps.admission.outputs.win32-arm64 == 'true'
|
||||
&& steps.admission.outputs.win32-x64 == 'true' && steps.admission.outputs.win32-bundle == 'true'
|
||||
&& steps.admission.outputs.termux == 'true' }}
|
||||
channel-build: ${{ ((inputs.disposable_channel != '' || inputs.channel != '') && steps.allocate.outputs.channel_build) || '' }}
|
||||
channel-request-sha256: ${{ ((inputs.disposable_channel != '' || inputs.channel != '') && steps.allocate.outputs.channel_request_sha256) || '' }}
|
||||
disposable-run: ${{ (inputs.disposable_channel != '' && github.run_id) || inputs.disposable_run || '' }}
|
||||
@@ -423,7 +409,7 @@ jobs:
|
||||
name: bundled win32-x64
|
||||
if: >-
|
||||
needs.validate.outputs.win32-x64 == 'true'
|
||||
&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')
|
||||
&& inputs.release-phase == 'candidate'
|
||||
&& inputs.build_commit == '' && inputs.channel == ''
|
||||
needs: [validate]
|
||||
runs-on: ${{ matrix.target.runner }}
|
||||
@@ -715,7 +701,7 @@ jobs:
|
||||
name: bundled win32-arm64
|
||||
if: >-
|
||||
needs.validate.outputs.win32-arm64 == 'true'
|
||||
&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')
|
||||
&& inputs.release-phase == 'candidate'
|
||||
&& inputs.build_commit == '' && inputs.channel == ''
|
||||
needs: [validate]
|
||||
runs-on: ${{ matrix.target.runner }}
|
||||
@@ -817,14 +803,13 @@ jobs:
|
||||
# notarize.mjs) when the release-signing environment carries the Apple
|
||||
# credentials; a publishing run FAILS the leg instead of shipping unsigned
|
||||
# (no silent unsigned publish). Binaries stage to releases/tag/<tag>/; the
|
||||
# arch-prefixed feed yml stages beside them and publish-darwin-updater turns
|
||||
# it into releases/darwin/<channel>/<channel>-mac.yml — artifacts first,
|
||||
# feed pointer last, whole channel green before anything publishes.
|
||||
# arch-prefixed feed yml stages beside them and stable-release.yml's
|
||||
# publication pass merges releases/darwin/<channel>/<channel>-mac.yml.
|
||||
build-darwin-arm64-release:
|
||||
name: bundled darwin-arm64
|
||||
if: >-
|
||||
needs.validate.outputs.darwin-arm64 == 'true'
|
||||
&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')
|
||||
&& inputs.release-phase == 'candidate'
|
||||
&& inputs.build_commit == '' && inputs.channel == ''
|
||||
needs: [validate]
|
||||
runs-on: ${{ matrix.target.runner }}
|
||||
@@ -1186,7 +1171,7 @@ jobs:
|
||||
name: bundled linux-x64
|
||||
if: >-
|
||||
needs.validate.outputs.linux-x64 == 'true'
|
||||
&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')
|
||||
&& inputs.release-phase == 'candidate'
|
||||
&& inputs.build_commit == '' && inputs.channel == ''
|
||||
needs: [validate]
|
||||
runs-on: ${{ matrix.target.runner }}
|
||||
@@ -1352,7 +1337,7 @@ jobs:
|
||||
name: bundled linux-arm64
|
||||
if: >-
|
||||
needs.validate.outputs.linux-arm64 == 'true'
|
||||
&& (inputs.release-phase == '' || inputs.release-phase == 'candidate')
|
||||
&& inputs.release-phase == 'candidate'
|
||||
&& inputs.build_commit == '' && inputs.channel == ''
|
||||
needs: [validate]
|
||||
runs-on: ${{ matrix.target.runner }}
|
||||
@@ -1765,150 +1750,6 @@ jobs:
|
||||
--r2-base-url "$(python -c 'from scripts.releases.r2_scope import channel_public_base; print(channel_public_base())')" \
|
||||
--summary-out "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
publish-win32-updater:
|
||||
name: Publish the tested Windows canary bundle
|
||||
needs: [validate, assemble-win32-bundle, smoke-win32-arm64, smoke-win32-x64]
|
||||
if: >-
|
||||
!cancelled() && inputs.build_commit == '' && inputs.channel == '' && inputs.upload_release == true
|
||||
&& inputs.release-phase == ''
|
||||
&& needs.validate.outputs.win32-arm64 == 'true' && needs.validate.outputs.win32-x64 == 'true'
|
||||
&& needs.validate.outputs.win32-bundle == 'true'
|
||||
&& needs.validate.result == 'success' && needs.validate.outputs.sha != ''
|
||||
&& needs.assemble-win32-bundle.result == 'success'
|
||||
&& needs.smoke-win32-arm64.result == 'success' && needs.smoke-win32-x64.result == 'success'
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: release-signing
|
||||
timeout-minutes: 15
|
||||
concurrency:
|
||||
group: win32-updater-feed-canary
|
||||
cancel-in-progress: false
|
||||
env:
|
||||
HERMES_PAYLOAD_TAG: ${{ inputs.tag }}
|
||||
HERMES_DESKTOP_VARIANT: bundled
|
||||
RELEASE_COMMIT: ${{ needs.validate.outputs.sha }}
|
||||
CLOUDFLARE_R2_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }}
|
||||
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
|
||||
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
|
||||
CLOUDFLARE_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET }}
|
||||
CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}
|
||||
steps:
|
||||
- uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1
|
||||
with:
|
||||
ref: ${{ needs.validate.outputs.sha }}
|
||||
- uses: ./.github/actions/setup-pm
|
||||
with:
|
||||
toolchain: all
|
||||
cache-python: false
|
||||
cache-node: false
|
||||
- name: Retrieve the tested universal bundle
|
||||
shell: bash
|
||||
run: |
|
||||
python -m scripts.releases.handoff fetch --tag "$HERMES_PAYLOAD_TAG" --commit "$RELEASE_COMMIT" \
|
||||
--name windows-universal --root staged --include 'HermesBundled-*-win.msixbundle'
|
||||
- name: Publish identical tested bytes without rebuilding
|
||||
shell: bash
|
||||
run: |
|
||||
node --input-type=module -e '
|
||||
import identity from "./apps/desktop/product-identity.cjs";
|
||||
import { appIdentity, OUT_OF_STORE_PUBLISHER } from "./scripts/msix-shared.mjs";
|
||||
const build = appIdentity(process.cwd() + "/apps/desktop");
|
||||
console.log(JSON.stringify({identity: identity.msixAppIdWithOrg, publisher: OUT_OF_STORE_PUBLISHER, version: build.version}));
|
||||
' > staged/expected-identity.json
|
||||
python - <<'PY'
|
||||
import json, os, re
|
||||
from pathlib import Path
|
||||
from scripts.bundles.release_artifacts import main, single
|
||||
expected = json.loads(Path('staged/expected-identity.json').read_text(encoding='utf-8'))
|
||||
bundle = single(Path('staged').glob('HermesBundled-*-win.msixbundle'))
|
||||
# The handoff binds the assembly filename and bytes. Never recompute
|
||||
# its revision against stable tags that can change after native smoke.
|
||||
match = re.fullmatch(r'HermesBundled-(\d+\.\d+\.\d+\.\d+)-win\.msixbundle', bundle.name)
|
||||
if not match:
|
||||
raise ValueError('Missing assembly version in receipt-bound bundle name')
|
||||
version = match[1]
|
||||
if (any(str(int(part)) != part or int(part) > 65535 for part in version.split('.'))
|
||||
or version != expected['version']):
|
||||
raise ValueError('Assembly version differs from the admitted build identity')
|
||||
# publish-appinstaller compares this version to the baked envelope.
|
||||
main(['publish-appinstaller', '--root', 'staged', '--bundle', str(bundle),
|
||||
'--tag', os.environ['HERMES_PAYLOAD_TAG'], '--variant', 'bundled',
|
||||
'--identity', expected['identity'], '--publisher', expected['publisher'],
|
||||
'--version', version])
|
||||
PY
|
||||
|
||||
# ── macOS updater channel (REAL) ───────────────────────────────────────────
|
||||
# Turns the arm64 feed yml (arm64-stable-mac.yml / arm64-canary-mac.yml)
|
||||
# into releases/darwin/<channel>/<channel>-mac.yml via
|
||||
# scripts/releases/r2.py finalize. The binaries were staged by the build
|
||||
# leg (releases/tag/<tag>/); the feed POINTER is written here, last, only
|
||||
# after the darwin leg and its smoke are green — a failed leg can never
|
||||
# publish the channel. The concurrency group is scoped to the channel so two
|
||||
# dispatches for the same channel serialize their feed writes (r2-release
|
||||
# finalize also refuses backward publication); stable and canary still
|
||||
# publish in parallel by design (distinct feed files).
|
||||
publish-darwin-updater:
|
||||
name: Publish the macOS updater feed
|
||||
needs: [validate, build-darwin-arm64, smoke-darwin-arm64]
|
||||
if: >-
|
||||
!cancelled() && inputs.build_commit == '' && inputs.channel == '' && inputs.upload_release == true
|
||||
&& inputs.release-phase == ''
|
||||
&& needs.validate.outputs.darwin-arm64 == 'true'
|
||||
&& needs.validate.result == 'success' && needs.validate.outputs.sha != ''
|
||||
&& needs.build-darwin-arm64.result == 'success'
|
||||
&& needs.smoke-darwin-arm64.result == 'success'
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: release-signing
|
||||
timeout-minutes: 15
|
||||
concurrency:
|
||||
group: darwin-updater-feed-${{ needs.validate.outputs.channel }}
|
||||
cancel-in-progress: false
|
||||
env:
|
||||
HERMES_PAYLOAD_TAG: ${{ inputs.tag }}
|
||||
CLOUDFLARE_R2_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }}
|
||||
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
|
||||
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
|
||||
CLOUDFLARE_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET }}
|
||||
CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}
|
||||
steps:
|
||||
- uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1
|
||||
with:
|
||||
# Privileged job: pin to the SHA validate admitted, not the tag.
|
||||
ref: ${{ needs.validate.outputs.sha }}
|
||||
|
||||
- uses: ./.github/actions/setup-pm
|
||||
with:
|
||||
cache-python: false
|
||||
|
||||
- name: Retrieve macOS feed inputs from R2
|
||||
shell: bash
|
||||
env:
|
||||
RELEASE_COMMIT: ${{ needs.validate.outputs.sha }}
|
||||
run: |
|
||||
python -m scripts.releases.handoff fetch --tag "$HERMES_PAYLOAD_TAG" --commit "$RELEASE_COMMIT" \
|
||||
--name darwin-arm64 --root staged --include '*-mac.yml'
|
||||
|
||||
- name: Assert the arm64 feed is present
|
||||
shell: bash
|
||||
# finalize validates *-mac.yml (feed-side); here we fail fast if the
|
||||
# leg never produced its yml.
|
||||
run: |
|
||||
shopt -s nullglob
|
||||
ymls=(staged/*-mac.yml)
|
||||
if [ ${#ymls[@]} -ne 1 ] || [ "$(basename "${ymls[0]}" | cut -d- -f1)" != arm64 ]; then
|
||||
echo "::error::expected exactly the arm64 feed yml in the staged artifacts, found ${#ymls[@]}: ${ymls[*]}"
|
||||
exit 1
|
||||
fi
|
||||
echo "staged feed: ${ymls[*]}"
|
||||
|
||||
- name: Finalize the macOS updater feeds
|
||||
# Writes releases/darwin/<channel>/<channel>-mac.yml pointing at the
|
||||
# already-staged /releases/tag/<tag>/ binaries. Immutable objects
|
||||
# referenced by the feed are verified before the pointer uploads
|
||||
# (feed-side); the pointer upload is the last write of the run.
|
||||
shell: bash
|
||||
run: |
|
||||
python -m scripts.ci.python_packages ruamel.yaml==0.18.17 -- -m scripts.releases.r2 finalize --tag "$HERMES_PAYLOAD_TAG" --dir staged
|
||||
|
||||
termux-deb:
|
||||
name: Build + publish the termux .deb (aarch64)
|
||||
needs: [validate]
|
||||
@@ -2190,13 +2031,12 @@ jobs:
|
||||
fi
|
||||
printf '%s\n' "$TERMUX_APT_GPG_KEY" > "$RUNNER_TEMP/termux-apt-gpg.asc"
|
||||
|
||||
- name: Stage the APT repo and publish to R2
|
||||
if: inputs.build_commit == ''
|
||||
- name: Stage the APT repo handoff to R2
|
||||
if: inputs.build_commit == '' && inputs.release-phase == 'candidate'
|
||||
shell: bash
|
||||
env:
|
||||
CHANNEL: ${{ steps.channel.outputs.channel }}
|
||||
PREVIOUS_TAG: ${{ inputs.termux_upgrade_from_tag }}
|
||||
RELEASE_PHASE: ${{ inputs.release-phase }}
|
||||
RELEASE_CLAIM_TAG: ${{ inputs.claim-tag }}
|
||||
RELEASE_COMMIT: ${{ needs.validate.outputs.sha }}
|
||||
# Passphrase-protected signing keys only; unset for bare keys.
|
||||
@@ -2205,14 +2045,12 @@ jobs:
|
||||
# stage_apt_repo.py builds dists/<suite>/ + pool/ under --out and
|
||||
# signs Release/InRelease with the key file. Exit 3 (unsigned
|
||||
# Release) must fail the run.
|
||||
# The candidate phase keys the pool by the attempt ref: the pool
|
||||
# The candidate phase keys the pool by the attempt/claim ref: the pool
|
||||
# upload is immutable with a one-year cache header, so a recut of
|
||||
# the same version must never reuse a pool key.
|
||||
stage_args=(--pool termux-build/deb --out termux-build/apt --suite "hermes-$CHANNEL")
|
||||
if [ "$RELEASE_PHASE" = candidate ]; then
|
||||
stage_args+=(--pool-subdir "$RELEASE_CLAIM_TAG")
|
||||
fi
|
||||
python3 scripts/termux/stage_apt_repo.py "${stage_args[@]}" \
|
||||
python3 scripts/termux/stage_apt_repo.py \
|
||||
--pool termux-build/deb --out termux-build/apt \
|
||||
--suite "hermes-$CHANNEL" --pool-subdir "$RELEASE_CLAIM_TAG" \
|
||||
--gpg-key-file "$RUNNER_TEMP/termux-apt-gpg.asc"
|
||||
|
||||
debs=(termux-build/deb/*.deb)
|
||||
@@ -2235,135 +2073,11 @@ jobs:
|
||||
"termux/termux-docker@$digest" bash /tmp/check-apt.sh "hermes-$CHANNEL" "$version"
|
||||
fi
|
||||
|
||||
args=(--include 'deb/*.deb' --include 'apt/**/*')
|
||||
if [ "$RELEASE_PHASE" = candidate ]; then
|
||||
python -m scripts.bundles.release_artifacts record --platform termux --arch aarch64 \
|
||||
--root termux-build --tag "$HERMES_PAYLOAD_TAG" --commit "$RELEASE_COMMIT" \
|
||||
--out termux-build/metadata-termux-aarch64.json
|
||||
args+=(--include 'metadata-*.json')
|
||||
fi
|
||||
python -m scripts.bundles.release_artifacts record --platform termux --arch aarch64 \
|
||||
--root termux-build --tag "$HERMES_PAYLOAD_TAG" --commit "$RELEASE_COMMIT" \
|
||||
--out termux-build/metadata-termux-aarch64.json
|
||||
python -m scripts.releases.handoff stage --tag "${HERMES_ARCHIVE_TAG:-$HERMES_PAYLOAD_TAG}" --commit "$RELEASE_COMMIT" \
|
||||
--name termux --root termux-build "${args[@]}"
|
||||
if [ "$RELEASE_PHASE" = candidate ]; then exit 0; fi
|
||||
# --key-is-full is MANDATORY on every feed-dir upload: without it
|
||||
# scripts.releases.r2 re-prefixes the key into the tag archive
|
||||
# (releases/tag/<tag>/) and the APT feed never lands at
|
||||
# releases/termux/<channel>/.
|
||||
shopt -s globstar nullglob
|
||||
# cd into the staged repo for the glob, but resolve the r2 client
|
||||
# absolutely first -- after the cd, scripts/ is no longer in the
|
||||
# cwd and a bare `python -m scripts.releases.r2` would ENOENT.
|
||||
export PYTHONPATH="$GITHUB_WORKSPACE"
|
||||
cd termux-build/apt
|
||||
files=(pool/**/*.deb "dists/hermes-$CHANNEL"/main/binary-aarch64/by-hash/*/* key.asc
|
||||
"dists/hermes-$CHANNEL/main/binary-aarch64/Packages"
|
||||
"dists/hermes-$CHANNEL/main/binary-aarch64/Packages.gz"
|
||||
"dists/hermes-$CHANNEL/Release"
|
||||
"dists/hermes-$CHANNEL/Release.gpg"
|
||||
"dists/hermes-$CHANNEL/InRelease")
|
||||
# APT reads InRelease first. Publish it only after every referenced
|
||||
# index and package has been uploaded and read back successfully.
|
||||
for f in "${files[@]}"; do
|
||||
test -f "$f"
|
||||
python3 -m scripts.releases.r2 put \
|
||||
--tag "$HERMES_PAYLOAD_TAG" \
|
||||
--key "releases/termux/$CHANNEL/$f" \
|
||||
--file "$f" \
|
||||
--key-is-full
|
||||
done
|
||||
|
||||
# Verify the public CDN path, not only the object-store origin.
|
||||
public_repo="${CLOUDFLARE_R2_PUBLIC_URL%/}/releases/termux/$CHANNEL"
|
||||
curl --fail --silent --show-error "$public_repo/key.asc" -o "$RUNNER_TEMP/termux-public-key.asc"
|
||||
cmp key.asc "$RUNNER_TEMP/termux-public-key.asc"
|
||||
docker run --rm --platform linux/arm64 --user 1000:1000 \
|
||||
-v "$PWD:/apt:ro" \
|
||||
-v "$GITHUB_WORKSPACE/scripts/termux/check_apt.sh:/tmp/check-apt.sh:ro" \
|
||||
-v "$GITHUB_WORKSPACE/scripts/termux/validate_installed.py:/tmp/validate_installed.py:ro" \
|
||||
"termux/termux-docker@$digest" bash /tmp/check-apt.sh "hermes-$CHANNEL" "$version" "$public_repo"
|
||||
|
||||
builds-pending:
|
||||
name: Mark the builds table as in progress
|
||||
needs: validate
|
||||
# Pairs with builds-table: a pending page nothing finalizes must not be written.
|
||||
if: >-
|
||||
inputs.build_commit == '' && inputs.upload_release == true
|
||||
&& (needs.validate.outputs.all-jobs == 'true' || needs.validate.outputs.canary-table-selected == 'true')
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
steps:
|
||||
- uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1
|
||||
with:
|
||||
ref: ${{ needs.validate.outputs.sha }}
|
||||
- name: Render the placeholder
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
HERMES_PAYLOAD_TAG: ${{ inputs.tag }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
run: |
|
||||
if ! gh release view "$HERMES_PAYLOAD_TAG" >/dev/null 2>&1; then
|
||||
echo "::error::no release exists for $HERMES_PAYLOAD_TAG — cannot mark the builds table"
|
||||
exit 1
|
||||
fi
|
||||
python3 scripts/render-builds-table.py \
|
||||
--tag "$HERMES_PAYLOAD_TAG" --repo "$GITHUB_REPOSITORY" \
|
||||
--pending-run-url "$RUN_URL"
|
||||
|
||||
builds-table:
|
||||
name: Render the release builds table
|
||||
needs:
|
||||
[
|
||||
validate,
|
||||
build-win32-x64,
|
||||
build-win32-arm64,
|
||||
build-darwin-arm64,
|
||||
assemble-win32-bundle,
|
||||
smoke-darwin-arm64,
|
||||
smoke-win32-arm64,
|
||||
smoke-win32-x64,
|
||||
publish-win32-updater,
|
||||
publish-darwin-updater,
|
||||
termux-deb
|
||||
]
|
||||
# Failed builds still get a per-tag diagnostic page. The renderer only
|
||||
# advances the channel landing page when every prerequisite succeeded.
|
||||
if: |
|
||||
always() && inputs.build_commit == '' && inputs.channel == '' && inputs.upload_release == true && inputs.release-phase == ''
|
||||
&& needs.validate.result == 'success' && needs.validate.outputs.sha != ''
|
||||
&& (needs.validate.outputs.all-jobs == 'true' || needs.validate.outputs.canary-table-selected == 'true')
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: release-signing
|
||||
steps:
|
||||
- uses: useblacksmith/checkout@25227e61ff9dafe400e22fa487b673eac4e4409a # v1
|
||||
with:
|
||||
# Privileged job: pin to the SHA validate admitted. A bare checkout
|
||||
# here would land on the dispatch branch, not the release bytes.
|
||||
ref: ${{ needs.validate.outputs.sha }}
|
||||
- name: Render
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
HERMES_PAYLOAD_TAG: ${{ inputs.tag }}
|
||||
RELEASE_NEEDS: ${{ toJSON(needs) }}
|
||||
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||
CLOUDFLARE_R2_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_R2_ACCOUNT_ID }}
|
||||
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
|
||||
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
|
||||
CLOUDFLARE_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET }}
|
||||
CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}
|
||||
run: |
|
||||
python3 scripts/render-builds-table.py \
|
||||
--tag "$HERMES_PAYLOAD_TAG" --repo "$GITHUB_REPOSITORY" --run-url "$RUN_URL"
|
||||
|
||||
# Keep this job red when a gating prerequisite failed, even after diagnostics render.
|
||||
- name: Preserve release success gate
|
||||
env:
|
||||
RELEASE_NEEDS: ${{ toJSON(needs) }}
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import json, os
|
||||
from scripts.releases.stable import require_success
|
||||
needs = json.loads(os.environ['RELEASE_NEEDS'])
|
||||
require_success(needs, list(needs))
|
||||
PY
|
||||
--name termux --root termux-build --include 'deb/*.deb' --include 'apt/**/*' --include 'metadata-*.json'
|
||||
|
||||
commit-builds-summary:
|
||||
name: Upload status page to R2
|
||||
|
||||
@@ -114,22 +114,6 @@ def termux_builder(jobs: dict) -> str:
|
||||
return _only([name for name, job in jobs.items() if _stages(job, "termux")], "termux deb")
|
||||
|
||||
|
||||
def updater_publishers(jobs: dict) -> dict[str, str]:
|
||||
"""platform -> the job that publishes that platform's updater feed.
|
||||
|
||||
It is the job gated on exactly that platform's smokes; channel publication
|
||||
and summaries need every platform's smoke.
|
||||
"""
|
||||
smokes = smoke_callers(jobs)
|
||||
publishers = {}
|
||||
for platform in PLATFORMS:
|
||||
own = {smokes[f"{platform}-{arch}"] for arch in PLATFORM_ARCHES[platform]}
|
||||
publishers[platform] = _only(
|
||||
[name for name, job in jobs.items() if set(needs_of(job)) & set(smokes.values()) == own],
|
||||
f"{platform} updater publisher")
|
||||
return publishers
|
||||
|
||||
|
||||
def _renders(job: dict, flag: str) -> bool:
|
||||
return any("render-builds-table.py" in step.get("run", "") and flag in step["run"]
|
||||
for step in job.get("steps", []))
|
||||
@@ -145,12 +129,6 @@ def commit_summary(jobs: dict) -> str:
|
||||
"commit build summary")
|
||||
|
||||
|
||||
def tag_summary(jobs: dict) -> str:
|
||||
"""The tag build table (the final one, not the pending placeholder posted before the builds)."""
|
||||
return _only([name for name, job in jobs.items()
|
||||
if _renders(job, "--tag") and not _renders(job, "--pending-run-url")], "tag build summary")
|
||||
|
||||
|
||||
def phase_result(jobs: dict) -> str:
|
||||
"""The stable-phase verdict: the job that judges every phase job's result."""
|
||||
return _only([name for name, job in jobs.items()
|
||||
@@ -175,8 +153,6 @@ def credential_gate(job: dict) -> dict:
|
||||
|
||||
# Dispatch shapes that produce downloadable artifacts, keyed by trust branch.
|
||||
DOWNLOADABLE_DISPATCHES = {
|
||||
"tag": {"tag": CANARY_TAG, "upload_release": True, "build_commit": "", "channel": "",
|
||||
"release-phase": "", "jobs": ",".join(JOB_GROUPS)},
|
||||
"candidate": {"tag": "v0.28.0", "upload_release": False, "build_commit": "", "channel": "",
|
||||
"release-phase": "candidate", "jobs": ",".join(JOB_GROUPS)},
|
||||
"commit": {"tag": "", "upload_release": False, "build_commit": SHA, "channel": "",
|
||||
|
||||
@@ -507,7 +507,7 @@ def test_tag_and_commit_staging_never_runs_for_a_pinned_channel_build():
|
||||
# it must stand down for a pinned channel build and run otherwise.
|
||||
assert not gate(step.get("if", "true"), DOWNLOADABLE_DISPATCHES["channel"], channel, job_if=False), (
|
||||
f"{name}: {step['name']!r} stages tag/commit receipts for a channel build")
|
||||
for dispatch in ("tag", "candidate", "commit"):
|
||||
for dispatch in ("candidate", "commit"):
|
||||
assert gate(step.get("if", "true"), DOWNLOADABLE_DISPATCHES[dispatch], admitted(["validate"]),
|
||||
job_if=False), (name, dispatch)
|
||||
# The pinned-request stage is the one that runs instead.
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
"""Replay artifact handoffs and publication against a fake R2."""
|
||||
"""Replay artifact handoffs and smoke fetches against a fake R2."""
|
||||
import hashlib
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
import hermes_yaml
|
||||
@@ -12,10 +8,10 @@ import pytest
|
||||
|
||||
from tests.ci.desktop_release_roles import (
|
||||
CANARY_TAG as TAG, NATIVE_TARGETS, SHA, native_builds, needs_of, phase_result, selection_gates,
|
||||
smoke_callers, stage_step, termux_builder, universal_assembler, updater_publishers,
|
||||
smoke_callers, stage_step, termux_builder, universal_assembler,
|
||||
)
|
||||
from tests.ci.test_commit_build_staging import ROOT, shell_step
|
||||
from tests.ci.test_desktop_release_tag_admission import _child_env, _workflow
|
||||
from tests.ci.test_desktop_release_tag_admission import _workflow
|
||||
from tests.scripts.test_release_r2 import r2_server
|
||||
|
||||
|
||||
@@ -181,103 +177,4 @@ def test_stable_phase_result_requires_smoke_but_preserves_other_phases(tmp_path,
|
||||
# (the job names the package for a manual upload), while stable-publish still gates it.
|
||||
assert run_phase('publish', set(), failed=store).returncode == 0
|
||||
assert run_phase('publish', set(), failed=publish).returncode != 0
|
||||
assert jobs[store].get('continue-on-error') is True
|
||||
|
||||
|
||||
|
||||
def test_canary_publisher_consumes_staged_bytes_and_writes_pointer_last(tmp_path, r2_server):
|
||||
tag = 'canary.20260818T101010Z-v0.28.1'
|
||||
env = {**transport_env(tmp_path, r2_server), 'HERMES_DESKTOP_VARIANT': 'bundled',
|
||||
'HERMES_PAYLOAD_TAG': tag, 'RELEASE_TAG': tag}
|
||||
# Use the real assembly identity derivation with a stable base available.
|
||||
for file in ['scripts/msix-shared.mjs', 'scripts/release-content-types.json',
|
||||
'apps/desktop/product-identity.cjs', 'apps/desktop/package.json']:
|
||||
target = tmp_path / file
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(ROOT / file, target)
|
||||
|
||||
def git(*args, date='2026-08-18T08:10:10Z'):
|
||||
subprocess.run(['git', *args], cwd=tmp_path, check=True, capture_output=True,
|
||||
env=_child_env(GIT_AUTHOR_NAME='Fixture', GIT_AUTHOR_EMAIL='fixture@example.invalid',
|
||||
GIT_COMMITTER_NAME='Fixture', GIT_COMMITTER_EMAIL='fixture@example.invalid',
|
||||
GIT_AUTHOR_DATE=date, GIT_COMMITTER_DATE=date,
|
||||
GIT_CONFIG_GLOBAL=str(tmp_path / 'no-git-config'), GIT_CONFIG_NOSYSTEM='1'))
|
||||
|
||||
def assembly_identity():
|
||||
result = subprocess.run(['node', '--input-type=module', '-e',
|
||||
'import {appIdentity} from "./scripts/msix-shared.mjs";'
|
||||
'console.log(JSON.stringify(appIdentity(process.cwd()+"/apps/desktop")));'],
|
||||
cwd=tmp_path, env=_child_env(**env), check=True, capture_output=True, text=True)
|
||||
return json.loads(result.stdout)
|
||||
|
||||
git('init', '-q')
|
||||
git('-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-qm', 'stable base')
|
||||
git('tag', 'v0.28.0')
|
||||
assembled = assembly_identity()
|
||||
version = assembled['version']
|
||||
release = tmp_path / 'apps/desktop/release'
|
||||
release.mkdir(parents=True)
|
||||
filename = f"{assembled['name']}-{version}-win.msixbundle"
|
||||
bundle = release / filename
|
||||
with zipfile.ZipFile(bundle, 'w') as archive:
|
||||
archive.writestr('AppxMetadata/AppxBundleManifest.xml',
|
||||
'<Bundle><Identity Name="NousResearch.HermesBundledCanary" '
|
||||
'Publisher="CN=Nous Research Inc., O=Nous Research Inc., L=Austin, S=Texas, C=US" '
|
||||
f'Version="{version}"/></Bundle>')
|
||||
tested_bytes = bundle.read_bytes()
|
||||
jobs = _workflow()['jobs']
|
||||
publisher = updater_publishers(jobs)['win32']
|
||||
staged = shell_step(tmp_path, r2_server, '', '', env, script=stage_step(jobs[universal_assembler(jobs)])['run'])
|
||||
assert staged.returncode == 0, staged.stdout + staged.stderr
|
||||
assert all(key.startswith(f'releases/tag/{tag}/') for key in r2_server.store)
|
||||
# A newer stable becomes visible after assembly but cannot alter the
|
||||
# timestamp-derived canary identity.
|
||||
git('-c', 'commit.gpgsign=false', 'commit', '--allow-empty', '-qm', 'new stable', date='2026-08-18T11:10:10Z')
|
||||
git('tag', 'v0.28.1')
|
||||
assert assembly_identity()['version'] == version
|
||||
for name in ('Retrieve the tested universal bundle', 'Publish identical tested bytes without rebuilding'):
|
||||
result = shell_step(tmp_path, r2_server, publisher, name, env)
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
assert (tmp_path / 'staged' / filename).read_bytes() == tested_bytes
|
||||
assert r2_server.store[f'releases/win32/canary/{filename}'][0] == tested_bytes
|
||||
writes = [path for method, path, _ in r2_server.requests if method == 'PUT']
|
||||
assert writes[-1].endswith('/canary.appinstaller')
|
||||
descriptor = ET.fromstring(r2_server.store['releases/win32/canary/canary.appinstaller'][0])
|
||||
main_bundle = descriptor.find('{*}MainBundle')
|
||||
assert main_bundle is not None
|
||||
assert descriptor.get('Version') == main_bundle.get('Version') == version
|
||||
|
||||
# The publication job must refuse an ambiguous envelope, even when a
|
||||
# caller accidentally broadens the receipt selector in future.
|
||||
(tmp_path / 'staged/HermesBundled-0.29.0.0-win.msixbundle').write_bytes(tested_bytes)
|
||||
before = len(writes)
|
||||
refused = shell_step(tmp_path, r2_server, publisher,
|
||||
'Publish identical tested bytes without rebuilding', env)
|
||||
assert refused.returncode != 0
|
||||
assert len([row for row in r2_server.requests if row[0] == 'PUT']) == before
|
||||
(tmp_path / 'staged/HermesBundled-0.29.0.0-win.msixbundle').unlink()
|
||||
|
||||
# Filename, tag base, and baked identity must still agree. Reading the
|
||||
# accepted assembly version is not permission to trust arbitrary metadata.
|
||||
staged_bundle = tmp_path / 'staged' / filename
|
||||
for field, wrong in [('Version', '0.28.1.0'), ('Name', 'NousResearch.Other'), ('Publisher', 'CN=Other')]:
|
||||
with zipfile.ZipFile(bundle) as archive:
|
||||
manifest = ET.fromstring(archive.read('AppxMetadata/AppxBundleManifest.xml'))
|
||||
native = manifest.find('Identity')
|
||||
assert native is not None
|
||||
native.set(field, wrong)
|
||||
with zipfile.ZipFile(staged_bundle, 'w') as archive:
|
||||
archive.writestr('AppxMetadata/AppxBundleManifest.xml', ET.tostring(manifest))
|
||||
refused = shell_step(tmp_path, r2_server, publisher,
|
||||
'Publish identical tested bytes without rebuilding', env)
|
||||
assert refused.returncode != 0, field
|
||||
assert len([row for row in r2_server.requests if row[0] == 'PUT']) == before
|
||||
staged_bundle.write_bytes(tested_bytes)
|
||||
for wrong in ['HermesBundled-0.29.0.0-win.msixbundle', 'HermesBundled-0.28.1.65536-win.msixbundle',
|
||||
'HermesBundled-0.28.1-canary.20260818101010-win.msixbundle']:
|
||||
renamed = staged_bundle.rename(staged_bundle.with_name(wrong))
|
||||
refused = shell_step(tmp_path, r2_server, publisher,
|
||||
'Publish identical tested bytes without rebuilding', env)
|
||||
assert refused.returncode != 0, wrong
|
||||
assert len([row for row in r2_server.requests if row[0] == 'PUT']) == before
|
||||
renamed.rename(staged_bundle)
|
||||
assert jobs[store].get('continue-on-error') is True
|
||||
@@ -311,3 +311,13 @@ def test_downloadable_native_builds_refuse_to_ship_unsigned(tmp_path: Path):
|
||||
assert run(**{name: "x" for name in names}).returncode == 0
|
||||
partial = run(**{name: "x" for name in names if name != "AZURE_CLIENT_ID"})
|
||||
assert partial.returncode != 0 and "AZURE_CLIENT_ID" in partial.stdout
|
||||
|
||||
|
||||
def test_retired_direct_tag_publishing_jobs_are_removed():
|
||||
"""Direct release-tag dispatches are rejected by validate; no retired direct-tag
|
||||
publisher or summary job may remain wired in desktop-bundled-release.yml."""
|
||||
jobs = _workflow()["jobs"]
|
||||
for retired in ("publish-win32-updater", "publish-darwin-updater", "publish-canary",
|
||||
"builds-pending", "builds-table"):
|
||||
assert retired not in jobs, retired
|
||||
assert "canary-table-selected" not in jobs["validate"]["outputs"]
|
||||
|
||||
@@ -88,18 +88,19 @@ def test_linux_checkout_exemption_survives_the_preparation_home(tmp_path, target
|
||||
assert "*" in exempt.stdout.split(), exempt.stderr
|
||||
|
||||
|
||||
def test_linux_builds_run_for_tag_builds_only():
|
||||
def test_linux_builds_run_for_candidate_phase_only():
|
||||
jobs = _workflow()["jobs"]
|
||||
builds = linux_builds(jobs)
|
||||
assert set(builds.values()) == DIAGNOSTIC_JOBS
|
||||
for target, name in builds.items():
|
||||
job, needs = jobs[name], admitted(["validate"])
|
||||
for dispatch, runs in (("tag", True), ("candidate", True), ("commit", False), ("channel", False)):
|
||||
for dispatch, runs in (("candidate", True), ("commit", False), ("channel", False)):
|
||||
assert gate(job["if"], DOWNLOADABLE_DISPATCHES[dispatch], needs) is runs, (name, dispatch)
|
||||
assert gate(job["if"], DRY_DISPATCH, needs)
|
||||
assert not gate(job["if"], DRY_DISPATCH, needs)
|
||||
assert not gate(job["if"], {**DOWNLOADABLE_DISPATCHES["candidate"], "release-phase": ""}, needs)
|
||||
assert not gate(job["if"], {**DOWNLOADABLE_DISPATCHES["candidate"], "release-phase": "publish"}, needs)
|
||||
needs["validate"]["outputs"][target] = "false"
|
||||
assert not gate(job["if"], DOWNLOADABLE_DISPATCHES["tag"], needs)
|
||||
assert not gate(job["if"], DOWNLOADABLE_DISPATCHES["candidate"], needs)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("target", ["linux-x64", "linux-arm64"])
|
||||
@@ -107,7 +108,6 @@ def test_linux_builds_run_for_tag_builds_only():
|
||||
def test_linux_stage_archives_the_appimage_under_its_tag_only(tmp_path, r2_server, target, feed): # health: allow F811 -- pytest injects the imported r2_server fixture by parameter name
|
||||
jobs = _workflow()["jobs"]
|
||||
step = _stage_step(jobs[linux_builds(jobs)[target]])
|
||||
assert gate(step["if"], DOWNLOADABLE_DISPATCHES["tag"], {}, job_if=False)
|
||||
assert gate(step["if"], DOWNLOADABLE_DISPATCHES["candidate"], {}, job_if=False)
|
||||
assert not gate(step["if"], DRY_DISPATCH, {}, job_if=False)
|
||||
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
"""Run the tagged-build summary step against a disposable R2 transport."""
|
||||
import json
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.releases import r2
|
||||
from scripts.releases.job_groups import DIAGNOSTIC_JOBS, parse_jobs
|
||||
from tests.ci.desktop_release_roles import (
|
||||
CANARY_TAG, DOWNLOADABLE_DISPATCHES, admitted, evaluate, gate, needs_of, selection_gates, tag_summary,
|
||||
termux_builder, updater_publishers,
|
||||
)
|
||||
from tests.ci.test_commit_build_staging import shell_step
|
||||
from tests.ci.test_desktop_release_tag_admission import _workflow
|
||||
from tests.ci.test_stable_release_graph import ancestors
|
||||
from tests.scripts.test_release_r2 import r2_server
|
||||
|
||||
|
||||
@pytest.mark.parametrize("gh_available", [False, True])
|
||||
def test_admitted_failure_publishes_tag_info_without_promoting_channel(tmp_path, r2_server, gh_available):
|
||||
jobs = _workflow()["jobs"]
|
||||
table = tag_summary(jobs)
|
||||
job = jobs[table]
|
||||
gates = selection_gates(jobs)
|
||||
windows_publisher = updater_publishers(jobs)["win32"]
|
||||
termux = termux_builder(jobs)
|
||||
# This signing-context observer must survive failed needs without admitting
|
||||
# rejected tags, commit builds, dry runs, or stable release phases.
|
||||
tag = DOWNLOADABLE_DISPATCHES["tag"]
|
||||
|
||||
def observes(inputs, **validate):
|
||||
needs = admitted(needs_of(job))
|
||||
needs["validate"]["outputs"]["all-jobs"] = "true"
|
||||
needs["validate"].update(validate)
|
||||
for name in needs:
|
||||
if name != "validate":
|
||||
needs[name]["result"] = "failure"
|
||||
return gate(job["if"], inputs, needs)
|
||||
|
||||
assert observes(tag)
|
||||
assert not observes(tag, result="failure")
|
||||
assert not observes(tag, outputs={"all-jobs": "true", "sha": ""})
|
||||
for rejected in ({"build_commit": "a" * 40}, {"upload_release": False}, {"release-phase": "candidate"},
|
||||
{"release-phase": "publish"}, {"channel": "preview"}):
|
||||
assert not observes({**tag, **rejected}), rejected
|
||||
render = next(step for step in job["steps"] if step.get("name") == "Render")
|
||||
assert render["env"]["RELEASE_NEEDS"] == "${{ toJSON(needs) }}"
|
||||
|
||||
tag = CANARY_TAG
|
||||
run_url = "https://github.example/o/r/actions/runs/12345"
|
||||
base = f"http://127.0.0.1:{r2_server.server_port}/hermes-releases"
|
||||
channel_key = "releases/canary/index.html"
|
||||
previous = b'<meta name="hermes-build" content="canary.20260817T101010Z-v0.27.0">'
|
||||
r2_server.store[channel_key] = (previous, "text/html")
|
||||
helper = tmp_path / "bin"
|
||||
helper.mkdir()
|
||||
gh = helper / "gh"
|
||||
gh.write_text(
|
||||
f"#!{sys.executable}\n"
|
||||
"import json, sys\n"
|
||||
f"sys.exit(1) if not {gh_available!r} else None\n"
|
||||
"if sys.argv[1:3] == ['release', 'view']:\n"
|
||||
" print(json.dumps({'body': '<!-- HERMES_BUILDS_TABLE -->'}))\n"
|
||||
"elif sys.argv[1:3] == ['release', 'edit']:\n"
|
||||
" assert 'Build incomplete' in sys.stdin.read()\n"
|
||||
"else: raise AssertionError(sys.argv)\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
# Use a shell trampoline for interpreters whose full Nix path exceeds
|
||||
# the host's shebang limit.
|
||||
driver = helper / "gh-driver.py"
|
||||
gh.rename(driver)
|
||||
gh.write_text(f'#!/bin/sh\nexec {shlex.quote(sys.executable)} {shlex.quote(str(driver))} "$@"\n')
|
||||
gh.chmod(0o755)
|
||||
needs = {name: {"result": "success"} for name in job["needs"]}
|
||||
for name in [*gates.values(), termux]:
|
||||
needs[name]["result"] = "failure"
|
||||
needs[windows_publisher]["result"] = "skipped"
|
||||
result = shell_step(tmp_path, r2_server, table, "Render", {
|
||||
"HERMES_PAYLOAD_TAG": tag, "GITHUB_REPOSITORY": "o/r",
|
||||
"RUN_URL": run_url,
|
||||
"RELEASE_NEEDS": json.dumps(needs), "CLOUDFLARE_R2_PUBLIC_URL": base,
|
||||
"CLOUDFLARE_R2_ACCOUNT_ID": "loopback", "CLOUDFLARE_R2_ACCESS_KEY_ID": "test-inert",
|
||||
"CLOUDFLARE_R2_SECRET_ACCESS_KEY": "test-inert", "CLOUDFLARE_R2_BUCKET": "hermes-releases",
|
||||
})
|
||||
assert (result.returncode == 0) is gh_available, result.stdout + result.stderr
|
||||
key = f"releases/tag/{tag}/index.html"
|
||||
assert key in r2_server.store, result.stdout + result.stderr
|
||||
page = r2_server.store[key][0].decode()
|
||||
release_url = r2.public_url_for("https://github.com/o/r/releases/tag", tag)
|
||||
assert f'href="{release_url}"' in page
|
||||
assert "Build incomplete" in page
|
||||
assert f"{gates['win32-x64']} (failure)" in page and f"{windows_publisher} (skipped)" in page
|
||||
assert "No downloadable artifacts" in page
|
||||
for name, info in needs.items():
|
||||
if info["result"] != "success":
|
||||
assert f'<td>{name} ({info["result"]})</td><td><a href="{run_url}">View build run</a>' in page
|
||||
assert base not in page
|
||||
assert render["env"]["RUN_URL"] == "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||
assert r2.public_url_for(base, key) in result.stdout
|
||||
assert r2_server.store[channel_key][0] == previous
|
||||
assert set(r2_server.store) == {channel_key, key}
|
||||
|
||||
# Rendering diagnostics must not turn a failed Termux prerequisite into a green job.
|
||||
needs = {name: {"result": "success"} for name in job["needs"]}
|
||||
for state in ("failure", "skipped", "success"):
|
||||
needs[termux]["result"] = state
|
||||
checked = shell_step(tmp_path, r2_server, table, "Preserve release success gate", {
|
||||
"RELEASE_NEEDS": json.dumps(needs),
|
||||
})
|
||||
assert (checked.returncode == 0) is (state == "success"), checked.stdout + checked.stderr
|
||||
|
||||
|
||||
def test_canary_publication_does_not_wait_for_diagnostic_builds():
|
||||
jobs = _workflow()["jobs"]
|
||||
required = ancestors(jobs, tag_summary(jobs))
|
||||
assert termux_builder(jobs) in required
|
||||
assert not DIAGNOSTIC_JOBS.intersection(required)
|
||||
|
||||
|
||||
def test_canary_tables_admit_all_release_groups_without_linux():
|
||||
jobs = _workflow()["jobs"]
|
||||
groups = {"darwin-arm64", "win32-x64", "win32-arm64", "win32-bundle", "termux"}
|
||||
for selected in [groups, *(groups - {group} for group in sorted(groups))]:
|
||||
inputs = dict(DOWNLOADABLE_DISPATCHES["tag"], jobs=",".join(sorted(selected)))
|
||||
admission = {k: str(v).lower() for k, v in parse_jobs(inputs["jobs"]).items()}
|
||||
admission.update({"all-jobs": "false", "sha": "a" * 40})
|
||||
outputs = {}
|
||||
for key, expression in jobs["validate"]["outputs"].items():
|
||||
if "steps.admission.outputs." in expression:
|
||||
value = evaluate(expression, inputs, {}, steps={"admission": {"outputs": admission}})
|
||||
outputs[key] = str(value).lower()
|
||||
for job in (jobs["builds-pending"], jobs[tag_summary(jobs)]):
|
||||
needs = admitted(needs_of(job))
|
||||
needs["validate"]["outputs"] = outputs
|
||||
assert gate(job["if"], inputs, needs) is (selected == groups), (job["name"], selected)
|
||||
@@ -63,7 +63,7 @@ def test_archive_gate_uses_bootstrap_python_and_trusted_exact_revision():
|
||||
assert gate(archive["if"], inputs, {}, job_if=False), dispatch
|
||||
for skipped in ({"disposable_run": "98765"}, {"disposable_channel": "native-preview"},
|
||||
{"release-phase": "publish"}, {"release-phase": "promote"}):
|
||||
assert not gate(archive["if"], {**DOWNLOADABLE_DISPATCHES["tag"], **skipped}, {}, job_if=False), skipped
|
||||
assert not gate(archive["if"], {**DOWNLOADABLE_DISPATCHES["candidate"], **skipped}, {}, job_if=False), skipped
|
||||
assert R2_ENV <= archive["env"].keys()
|
||||
assert validate["environment"] == "release-signing"
|
||||
assert is_checkout(validate["steps"][0])
|
||||
|
||||
Reference in New Issue
Block a user