diff options
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/beta-continue.yml | 71 | ||||
| -rw-r--r-- | .github/workflows/beta-cut.yml | 69 | ||||
| -rw-r--r-- | .github/workflows/build-linux-sanitizers.yml | 9 | ||||
| -rw-r--r-- | .github/workflows/build-linux.yml | 268 | ||||
| -rw-r--r-- | .github/workflows/build-macos.yml | 207 | ||||
| -rw-r--r-- | .github/workflows/build-selected-artifacts.yml | 22 | ||||
| -rw-r--r-- | .github/workflows/build-windows.yml | 125 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 32 | ||||
| -rw-r--r-- | .github/workflows/prepare-release-dependencies.yml | 104 | ||||
| -rw-r--r-- | .github/workflows/promote-release.yml | 104 | ||||
| -rw-r--r-- | .github/workflows/public-release.yml | 178 | ||||
| -rw-r--r-- | .github/workflows/publish-linux-ci-images.yml | 63 | ||||
| -rw-r--r-- | .github/workflows/release-tag-helper.yml | 5 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 65 | ||||
| -rw-r--r-- | .github/workflows/sign-windows-release.yml | 9 | ||||
| -rw-r--r-- | .github/workflows/warm-dependency-caches.yml | 119 |
16 files changed, 1108 insertions, 342 deletions
diff --git a/.github/workflows/beta-continue.yml b/.github/workflows/beta-continue.yml new file mode 100644 index 00000000..5c1f2347 --- /dev/null +++ b/.github/workflows/beta-continue.yml @@ -0,0 +1,71 @@ +name: Scheduled Beta Continue + +on: + workflow_run: + workflows: ["CI", "Prepare Release Candidate", "Prepare Release Dependencies", "Promote Release Source"] + types: [completed] + branches: ["release/**", "develop"] + +permissions: {} + +jobs: + gate: + if: >- + github.event.workflow_run.actor.type == 'Bot' && + (github.event.workflow_run.head_branch != 'develop' || + github.event.workflow_run.path == '.github/workflows/prepare-release-dependencies.yml') + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + enabled: ${{ steps.gate.outputs.enabled }} + steps: + - name: Require BETA_AUTOMATION=enabled + id: gate + env: + BETA_AUTOMATION: ${{ vars.BETA_AUTOMATION }} + RUN_URL: ${{ github.event.workflow_run.html_url }} + run: | + if [ "$BETA_AUTOMATION" = enabled ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "Scheduled betas are paused: BETA_AUTOMATION is '${BETA_AUTOMATION:-<unset>}', not 'enabled'. Nothing was done after $RUN_URL." >> "$GITHUB_STEP_SUMMARY" + fi + + continuation: + needs: gate + if: needs.gate.outputs.enabled == 'true' + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: beta-automation + # Shared with the cut, so only one scheduler step acts at a time. + concurrency: + group: beta-scheduler + cancel-in-progress: false + permissions: + contents: read + issues: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + - name: Mint the release-bot token + id: app-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + # The token's JWT issuer may be the App ID or the client ID. + client-id: ${{ vars.RELEASE_BOT_APP_ID }} + private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} + permission-actions: write + permission-contents: read + - name: Continue the beta + id: scheduler + env: + RELEASE_BOT_TOKEN: ${{ steps.app-token.outputs.token }} + RELEASE_BOT_SLUG: ${{ steps.app-token.outputs.app-slug }} + GITHUB_TOKEN: ${{ github.token }} + run: python3 .github/scripts/beta-scheduler.py continue + - name: Record an unreported failure + if: failure() && steps.scheduler.outputs.alerted != 'true' + env: + GITHUB_TOKEN: ${{ github.token }} + run: python3 .github/scripts/beta-scheduler.py alert --stage continue --reason "The beta-continue job failed before the scheduler reported a result." diff --git a/.github/workflows/beta-cut.yml b/.github/workflows/beta-cut.yml new file mode 100644 index 00000000..657c0ea8 --- /dev/null +++ b/.github/workflows/beta-cut.yml @@ -0,0 +1,69 @@ +name: Scheduled Beta Cut + +on: + schedule: + - cron: "0 20 * * 2" + workflow_dispatch: + +permissions: {} + +jobs: + gate: + runs-on: ubuntu-latest + timeout-minutes: 5 + outputs: + enabled: ${{ steps.gate.outputs.enabled }} + steps: + - name: Require BETA_AUTOMATION=enabled + id: gate + env: + BETA_AUTOMATION: ${{ vars.BETA_AUTOMATION }} + run: | + if [ "$BETA_AUTOMATION" = enabled ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "Scheduled betas are paused: BETA_AUTOMATION is '${BETA_AUTOMATION:-<unset>}', not 'enabled'. Nothing was done." >> "$GITHUB_STEP_SUMMARY" + fi + + cut: + needs: gate + if: needs.gate.outputs.enabled == 'true' + runs-on: ubuntu-latest + timeout-minutes: 30 + environment: beta-automation + # Shared with the continuation, so only one scheduler step acts at a time. + concurrency: + group: beta-scheduler + cancel-in-progress: false + permissions: + contents: read + issues: write + packages: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 + persist-credentials: false + - name: Mint the release-bot token + id: app-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + # The token's JWT issuer may be the App ID or the client ID. + client-id: ${{ vars.RELEASE_BOT_APP_ID }} + private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} + permission-actions: write + permission-contents: write + permission-workflows: write + - name: Advance the beta line + id: scheduler + env: + RELEASE_BOT_TOKEN: ${{ steps.app-token.outputs.token }} + RELEASE_BOT_SLUG: ${{ steps.app-token.outputs.app-slug }} + GITHUB_TOKEN: ${{ github.token }} + PUBLIC_READ_TOKEN: ${{ github.token }} + run: python3 .github/scripts/beta-scheduler.py cut + - name: Record an unreported failure + if: failure() && steps.scheduler.outputs.alerted != 'true' + env: + GITHUB_TOKEN: ${{ github.token }} + run: python3 .github/scripts/beta-scheduler.py alert --stage cut --reason "The beta-cut job failed before the scheduler reported a result." diff --git a/.github/workflows/build-linux-sanitizers.yml b/.github/workflows/build-linux-sanitizers.yml index 1db5293e..35d053cd 100644 --- a/.github/workflows/build-linux-sanitizers.yml +++ b/.github/workflows/build-linux-sanitizers.yml @@ -27,6 +27,11 @@ on: required: false type: boolean default: false + run_tests: + description: "Run sanitizer tests after compiling production and test targets" + required: false + type: boolean + default: true advisory: description: "Allow sanitizer failures without failing the caller" required: false @@ -70,10 +75,11 @@ jobs: needs: resolve-image name: ${{ inputs.sanitizer == 'tsan' && 'Linux x86_64 TSan' || 'Linux x86_64 ASan + UBSan' }} runs-on: ubuntu-24.04 - timeout-minutes: ${{ inputs.sanitizer == 'tsan' && 180 || 40 }} + timeout-minutes: ${{ inputs.sanitizer == 'tsan' && 180 || 60 }} continue-on-error: ${{ inputs.advisory }} container: image: ${{ inputs.sanitizer == 'tsan' && format('ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble:{0}', needs.resolve-image.outputs.image_tag) || format('ghcr.io/wsjtx/wsjtx-internal/linux-noble:{0}', needs.resolve-image.outputs.image_tag) }} + options: --shm-size=1g credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -90,4 +96,5 @@ jobs: sanitizer: ${{ inputs.sanitizer }} recache: ${{ inputs.recache }} save_ccache: ${{ inputs.save_ccache }} + run_tests: ${{ inputs.run_tests }} allow_stale_image: ${{ inputs.allow_stale_image }} diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 8535f8b3..43578a82 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -28,12 +28,12 @@ on: type: string default: "" image_source: - description: "Builder image source: internal or public-release" + description: "Builder image source: internal or prepared public-release" required: false type: string default: "internal" image_digest: - description: "Required sha256 digest for a public-release builder image" + description: "Required sha256 digest for a prepared public builder image" required: false type: string default: "" @@ -62,16 +62,11 @@ on: required: false type: boolean default: true - release_channel: - description: "Build release channel: DEVEL, RC, or GA" - required: false - type: string - default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" + armhf_build_only: + description: "Compile and audit ARMHF production and test targets without runtime tests or packaging" required: false - type: string - default: "" + type: boolean + default: false # Also runnable on its own ("Run workflow" / gh workflow run) to build a single # Linux arch without dispatching the full ci.yml matrix. GitHub only exposes # workflow_dispatch when the trigger is on the default branch (develop), so this @@ -79,7 +74,8 @@ on: # single-architecture diagnosis and candidate-image validation; ARMHF also joins # ci.yml's opt-in full-ci matrix. Inputs mirror workflow_call with standalone # defaults: hamlib_branch matches what ci.yml / release.yml pass (4.7.2), and - # version is overridable via `-f version=...`. + # version is overridable via `-f version=...`. release_channel and + # prerelease_number exist only here, to override release-state.txt. workflow_dispatch: inputs: version: @@ -149,17 +145,23 @@ on: required: false type: boolean default: true + armhf_build_only: + description: "Compile and audit ARMHF production and test targets without runtime tests or packaging" + required: false + type: boolean + default: false release_channel: description: "Build release channel" required: false type: choice options: - DEVEL + - BETA - RC - GA default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" + prerelease_number: + description: "Prerelease number when release_channel is BETA or RC" required: false type: string default: "" @@ -173,9 +175,10 @@ on: # aarch64 — validated GCC 13.4 Bookworm container on ubuntu-24.04-arm. This keeps the # Bookworm glibc 2.36 + pre-t64 library baseline while using GCC 13 # (issue #49). -# armhf — native x86_64-to-ARMHF GCC 13.4 cross-build followed by target -# tests and packaging in a Bookworm arm/v7 container under QEMU -# (issue #51). DigiPi / Pi Zero 2W class. +# armhf — native x86_64-to-ARMHF GCC 13.4 cross-build, then target tests +# and packaging in a Bookworm arm/v7 container on ubuntu-24.04-arm, +# which runs 32-bit ARM code natively (issue #51). DigiPi / Pi Zero +# 2W class. # # The native jobs use the build-linux-payload composite action. ARMHF needs # separate host-build and target-runtime phases, but shares their artifact @@ -201,12 +204,18 @@ jobs: REQUESTED_TAG: ${{ inputs.image_tag }} ARMHF_BUILD: ${{ inputs.arch == 'armhf' }} ARCH: ${{ inputs.arch }} + ARMHF_BUILD_ONLY: ${{ inputs.armhf_build_only }} IMAGE_SOURCE: ${{ inputs.image_source }} IMAGE_DIGEST: ${{ inputs.image_digest }} ARMHF_CROSS_IMAGE_DIGEST: ${{ inputs.armhf_cross_image_digest }} REQUEST_REPOSITORY: ${{ github.repository }} + ALLOW_STALE_IMAGE: ${{ inputs.allow_stale_image }} shell: bash run: | + if [ "$ARMHF_BUILD_ONLY" = true ] && [ "$ARCH" != armhf ]; then + echo "::error::armhf_build_only is valid only for ARMHF builds" + exit 2 + fi case "$ARCH" in x86_64) package=linux-noble; cross_package= ;; aarch64) package=linux-arm64-bookworm; cross_package= ;; @@ -226,8 +235,15 @@ jobs: package_root=ghcr.io/wsjtx/wsjtx-internal ;; public-release) - if [ "$REQUEST_REPOSITORY" != WSJTX/wsjtx ]; then - echo "::error::Public release images may only be used by WSJTX/wsjtx" + case "$REQUEST_REPOSITORY:$GITHUB_REF" in + WSJTX/wsjtx:refs/tags/v*|WSJTX/wsjtx-internal:refs/heads/release/*) ;; + *) + echo "::error::Prepared public images require a public release tag or private release branch" + exit 2 + ;; + esac + if [ "$ALLOW_STALE_IMAGE" = true ]; then + echo "::error::Prepared public images require strict recipe verification" exit 2 fi if [[ ! "$IMAGE_DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then @@ -244,7 +260,7 @@ jobs: exit 2 fi if [ -z "$REQUESTED_TAG" ]; then - echo "::error::public-release images require their release-specific image_tag" + echo "::error::public-release images require their validated generation tag" exit 2 fi package_root=ghcr.io/wsjtx/wsjtx @@ -284,6 +300,7 @@ jobs: timeout-minutes: 65 container: image: ${{ needs.resolve-image.outputs.image_reference }} + options: --shm-size=1g credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -294,7 +311,7 @@ jobs: WSJTX_VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} ARCH: ${{ inputs.arch }} IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} @@ -310,7 +327,7 @@ jobs: validate_fortran_fallback: ${{ inputs.validate_fortran_fallback }} build_packages: ${{ inputs.build_packages }} release_channel: ${{ inputs.release_channel }} - rc_number: ${{ inputs.rc_number }} + prerelease_number: ${{ inputs.prerelease_number }} allow_stale_image: ${{ inputs.allow_stale_image }} build-aarch64: @@ -322,6 +339,7 @@ jobs: # glibc 2.36 and pre-t64 runtime baseline (issue #49). container: image: ${{ needs.resolve-image.outputs.image_reference }} + options: --shm-size=1g credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -332,7 +350,7 @@ jobs: WSJTX_VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} ARCH: ${{ inputs.arch }} IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} @@ -348,31 +366,29 @@ jobs: validate_fortran_fallback: ${{ inputs.validate_fortran_fallback }} build_packages: ${{ inputs.build_packages }} release_channel: ${{ inputs.release_channel }} - rc_number: ${{ inputs.rc_number }} + prerelease_number: ${{ inputs.prerelease_number }} allow_stale_image: ${{ inputs.allow_stale_image }} build-armhf: needs: resolve-image if: inputs.arch == 'armhf' runs-on: ubuntu-24.04 - timeout-minutes: 160 - # Compile natively on x86_64 with a pinned GCC 13.4 cross-toolchain, then - # execute target tests and packaging in a clean Bookworm ARMv7 runtime. + timeout-minutes: 60 + # Compile natively on x86_64 with a pinned GCC 13.4 cross-toolchain; + # test-armhf then runs the target tests and packaging on an ARM runner. # # Keep JavaScript actions on the host: the runner's x86_64 Node runtime - # cannot execute in the ARMv7 container. Both explicit containers mount - # the checkout at /work so CTest paths remain stable across phases. + # cannot execute in the ARMv7 container. Every explicit container mounts + # the checkout at /work so CTest paths stay valid in test-armhf. env: VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} steps: # setup-qemu-action runs on the host (job has no `container:`), - # mutating the host kernel's binfmt_misc table. With arm/v7 - # registered, subsequent `docker run --platform linux/arm/v7` - # invocations execute the container's arm/v7 init + binaries via - # qemu-arm-static. + # mutating the host kernel's binfmt_misc table, so the image pair + # check below can run the ARMv7 runtime image's smoke programs. - uses: docker/setup-qemu-action@v4 with: image: tonistiigi/binfmt:qemu-v10.2.3-68@sha256:400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0 @@ -383,7 +399,7 @@ jobs: WSJTX_VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} ARCH: armhf IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} @@ -474,10 +490,12 @@ jobs: ccache-linux-armhf-${{ steps.image.outputs.ccache_compatibility_id }}- - name: Cross-build ARMHF binaries + id: cross-build env: ARCH: armhf CROSS_BUILDER_IMAGE: ${{ needs.resolve-image.outputs.cross_image_reference }} RECACHE: ${{ inputs.recache }} + ARMHF_BUILD_ONLY: ${{ inputs.armhf_build_only }} CCACHE_COMPILERCHECK: ${{ steps.image.outputs.ccache_compiler_check }} WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH: ${{ inputs.allow_stale_image }} run: | @@ -492,15 +510,154 @@ jobs: -e HAMLIB_BRANCH \ -e ARCH \ -e WSJT_RELEASE_CHANNEL \ - -e WSJT_RC_NUMBER \ + -e WSJT_PRERELEASE_NUMBER \ -e CCACHE_DIR=/work/.ccache-armhf \ -e CCACHE_COMPILERCHECK \ + -e ARMHF_BUILD_ONLY \ -e WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH \ "${ccache_args[@]}" \ "$CROSS_BUILDER_IMAGE" \ bash .github/scripts/build-linux-armhf-cross.sh - - name: Test and package under ARMv7 QEMU + - name: Report suppressed armhf ccache save + if: inputs.save_ccache && steps.image.outputs.recipe_match != 'true' + run: echo "::notice::Not saving armhf ccache because this build used a stale Linux CI image recipe" + + - name: Save armhf ccache + id: save-ccache + if: inputs.save_ccache && (!inputs.armhf_build_only || github.ref == 'refs/heads/develop') && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: .ccache-armhf + key: ${{ steps.ccache.outputs.cache-primary-key }} + + # test-armhf runs the tests and packaging on an ARM runner from this + # tree. tar keeps the modes, links and times upload-artifact drops; + # objects and static libraries are only needed to link. + - name: Pack ARMHF build tree + if: ${{ !inputs.armhf_build_only }} + run: | + sudo tar --create --file armhf-build-tree.tar --exclude='wsjtx-build/*.o' --exclude='wsjtx-build/*.a' wsjtx-build AppDir + ls -l armhf-build-tree.tar + + # Kept one day: re-running test-armhf alone works within that window. + - name: Upload ARMHF build tree + if: ${{ !inputs.armhf_build_only }} + uses: actions/upload-artifact@v7 + with: + name: armhf-build-tree + path: armhf-build-tree.tar + if-no-files-found: error + retention-days: 1 + + - name: Summarize ARMHF compiler cache + if: always() + env: + CACHE_STEPS: ${{ toJSON(steps) }} + SAVE_CCACHE: ${{ inputs.save_ccache }} + ARMHF_BUILD_ONLY: ${{ inputs.armhf_build_only }} + run: | + python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY" + import json + import os + from pathlib import Path + + steps = json.loads(os.environ["CACHE_STEPS"]) + cache = steps.get("ccache", {}) + outputs = cache.get("outputs", {}) + restore = "exact hit" if outputs.get("cache-hit") == "true" else "fallback restore" if outputs.get("cache-matched-key") else "miss" + if cache.get("outcome") != "success": + restore = cache.get("outcome", "not run") + image = steps.get("image", {}).get("outputs", {}) + build_only = os.environ["ARMHF_BUILD_ONLY"] == "true" + save = steps.get("save-ccache", {}).get("outcome", "skipped") + timing = Path("wsjtx-build/armhf-cross-build-timing.env") + duration = "unavailable" + if timing.exists(): + duration = dict(line.split("=", 1) for line in timing.read_text().splitlines()).get("duration_seconds", duration) + if os.environ["SAVE_CCACHE"] != "true": + publication = "disabled" + elif build_only and os.environ["GITHUB_REF"] != "refs/heads/develop": + publication = "skipped: build-only cache writes require develop" + elif image.get("recipe_match") == "false": + publication = "skipped: image recipe mismatch" + elif save != "skipped": + publication = f"attempted (step: {save}); see cache action log for upload confirmation" + elif any(step.get("outcome") in ("failure", "cancelled") for step in steps.values()): + publication = "skipped: preceding failure or cancellation" + elif outputs.get("cache-hit") == "true": + publication = "skipped: exact cache already exists" + else: + publication = "not attempted" + print("### ARMHF compiler cache\n") + print("| Field | Value |\n| --- | --- |") + rows = { + "Source SHA": os.environ["GITHUB_SHA"], + "Image generation": image.get("generation", "unavailable"), + "Requested/save key": outputs.get("cache-primary-key", "unavailable"), + "Matched key": outputs.get("cache-matched-key") or "none", + "Restore": restore, + "Compilation and binary audits": steps.get("cross-build", {}).get("outcome", "not run"), + "Compilation duration (seconds)": duration, + "Cache publication": publication, + } + for label, value in rows.items(): + print(f"| {label} | {value} |") + PY + + test-armhf: + needs: [resolve-image, build-armhf] + if: inputs.arch == 'armhf' && !inputs.armhf_build_only + # ubuntu-24.04-arm executes 32-bit ARM code natively, so the runtime + # image runs here without QEMU. + runs-on: ubuntu-24.04-arm + timeout-minutes: 90 + env: + VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} + steps: + - uses: actions/checkout@v7 + + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # A CPU without 32-bit ARM support cannot run the image, and a registered + # qemu-arm handler would run it emulated without saying so. + - name: Require native 32-bit ARM execution + env: + RUNTIME_IMAGE: ${{ needs.resolve-image.outputs.image_reference }} + run: | + lscpu | grep -E '^(Model name|CPU op-mode)' + if ! lscpu | grep -Eq '^CPU op-mode\(s\):.*32-bit'; then + echo "::error::This runner cannot execute 32-bit ARM code" + exit 1 + fi + if [ -e /proc/sys/fs/binfmt_misc/qemu-arm ]; then + echo "::error::A qemu-arm binfmt handler is registered, so ARMHF would run emulated" + exit 1 + fi + bits=$(docker run --rm --platform linux/arm/v7 "$RUNTIME_IMAGE" getconf LONG_BIT) + if [ "$bits" != 32 ]; then + echo "::error::The ARMHF runtime image reports LONG_BIT=${bits}" + exit 1 + fi + + - name: Download ARMHF build tree + uses: actions/download-artifact@v8 + with: + name: armhf-build-tree + + - name: Unpack ARMHF build tree + run: | + sudo tar --extract --file armhf-build-tree.tar + rm armhf-build-tree.tar + + - name: Test and package on native ARMv7 id: armhf-runtime env: ARCH: armhf @@ -509,19 +666,34 @@ jobs: ARMHF_RUNTIME_PHASE: ${{ inputs.build_packages && 'all' || 'test' }} run: | GITHUB_TOKEN="${{ github.token }}" docker run --rm --platform linux/arm/v7 \ + --shm-size=1g \ -v "${GITHUB_WORKSPACE}:/work" \ -w /work \ -e VERSION \ -e HAMLIB_BRANCH \ -e ARCH \ - -e WSJT_RELEASE_CHANNEL \ - -e WSJT_RC_NUMBER \ -e GITHUB_TOKEN \ -e ARMHF_RUNTIME_PHASE \ -e WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH \ "$RUNTIME_IMAGE" \ bash .github/scripts/validate-linux-armhf-runtime.sh + - name: Test shared-memory allocation failure on native ARMv7 + env: + RUNTIME_IMAGE: ${{ needs.resolve-image.outputs.image_reference }} + run: | + docker run --rm --platform linux/arm/v7 \ + --shm-size=16m \ + -v "${GITHUB_WORKSPACE}:/work" \ + -w /work \ + -e WSJTX_TEST_SMALL_SHM=1 \ + "$RUNTIME_IMAGE" \ + bash -euo pipefail -c ' + source .github/scripts/armhf-ci-image-config.sh + LD_LIBRARY_PATH="$ARMHF_RUNTIME_PREFIX" \ + wsjtx-build/tests/unit/decoder_ipc/test_decoder_ipc_handshake insufficientLinuxSharedMemory + ' + - name: Publish armhf test summary if: always() run: >- @@ -576,6 +748,13 @@ jobs: wsjtx-build/jt9 wsjtx-build/wsprd wsjtx-build/wsjtx + - name: Upload release tarballs + if: inputs.build_packages + uses: ./.github/actions/upload-release-tarballs + with: + version: ${{ inputs.version }} + target: linux-armhf + directory: release-tarballs - name: Upload test results if: always() uses: actions/upload-artifact@v7 @@ -583,14 +762,3 @@ jobs: name: ctest-results-linux-armhf path: wsjtx-build/ctest-results.xml if-no-files-found: ignore - - - name: Report suppressed armhf ccache save - if: inputs.save_ccache && steps.image.outputs.recipe_match != 'true' - run: echo "::notice::Not saving armhf ccache because this build used a stale Linux CI image recipe" - - - name: Save armhf ccache - if: inputs.save_ccache && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true' - uses: actions/cache/save@v6 - with: - path: .ccache-armhf - key: ${{ steps.ccache.outputs.cache-primary-key }} diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 274270d3..5c11c62b 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -27,6 +27,11 @@ on: description: "macOS deployment target version" required: true type: string + cold_build: + description: "Bypass workflow dependency and compiler caches without saving them" + required: false + type: boolean + default: false recache: description: "Force ccache to recompile and refresh cached objects" required: false @@ -37,16 +42,6 @@ on: required: false type: boolean default: false - release_channel: - description: "Build release channel: DEVEL, RC, or GA" - required: false - type: string - default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" - required: false - type: string - default: "" signing_mode: description: "Package signing policy: validation or distribution" required: false @@ -111,6 +106,11 @@ on: - arm64 - x86_64 default: "arm64" + cold_build: + description: "Bypass workflow dependency and compiler caches without saving them" + required: false + type: boolean + default: false recache: description: "Force ccache to recompile and refresh cached objects" required: false @@ -127,11 +127,12 @@ on: type: choice options: - DEVEL + - BETA - RC - GA default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" + prerelease_number: + description: "Prerelease number when release_channel is BETA or RC" required: false type: string default: "" @@ -164,14 +165,14 @@ jobs: # runs-on cannot reference job-level env, so keep this expression and RUNNER # aligned. RUNNER also keeps cache keys consistent across both triggers. runs-on: ${{ inputs.runner || (inputs.arch == 'x86_64' && 'macos-15-intel' || 'macos-15') }} - timeout-minutes: 45 + timeout-minutes: 180 env: RUNNER: ${{ inputs.runner || (inputs.arch == 'x86_64' && 'macos-15-intel' || 'macos-15') }} DEPLOYMENT_TARGET: ${{ inputs.deployment_target || (inputs.arch == 'x86_64' && '10.13' || '11.0') }} VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} SIGNING_MODE: ${{ inputs.signing_mode }} ARCH: ${{ inputs.arch }} BOOST_VERSION: 1.85.0 @@ -226,6 +227,7 @@ jobs: - name: Restore ccache id: ccache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: .ccache @@ -235,7 +237,11 @@ jobs: - name: Configure ccache run: | - echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_ENV" + if [ "${{ inputs.cold_build }}" = "true" ]; then + echo "CCACHE_DIR=$(mktemp -d "${RUNNER_TEMP}/wsjtx-ccache.XXXXXX")" >> "$GITHUB_ENV" + else + echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_ENV" + fi echo "ccache recache: ${{ inputs.recache }}" if [ "${{ inputs.recache }}" = "true" ]; then echo "CCACHE_RECACHE=1" >> "$GITHUB_ENV" @@ -256,12 +262,14 @@ jobs: - name: Restore Qt cache id: qt-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: qt-prefix key: ${{ steps.qt-key.outputs.key }} - name: Build Qt + id: qt-build if: steps.qt-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-qt-macos.sh \ @@ -270,7 +278,7 @@ jobs: --prefix "${GITHUB_WORKSPACE}/qt-prefix" - name: Save Qt cache - if: steps.qt-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.qt-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: qt-prefix @@ -350,12 +358,14 @@ jobs: - name: Restore libusb cache id: libusb-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: libusb-prefix key: libusb-macos-${{ inputs.arch }}-${{ env.RUNNER }}-1.0.27-min${{ env.DEPLOYMENT_TARGET }}-epoch1-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} - name: Build libusb + id: libusb-build if: steps.libusb-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-libusb-macos.sh \ @@ -364,7 +374,7 @@ jobs: "${GITHUB_WORKSPACE}/libusb-prefix" - name: Save libusb cache - if: steps.libusb-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.libusb-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: libusb-prefix @@ -372,12 +382,14 @@ jobs: - name: Restore PortAudio cache id: portaudio-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: portaudio-prefix key: portaudio-macos-${{ inputs.arch }}-${{ env.RUNNER }}-19.7.0-min${{ env.DEPLOYMENT_TARGET }}-epoch1-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} - name: Build PortAudio + id: portaudio-build if: steps.portaudio-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-portaudio-macos.sh \ @@ -386,7 +398,7 @@ jobs: "${GITHUB_WORKSPACE}/portaudio-prefix" - name: Save PortAudio cache - if: steps.portaudio-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.portaudio-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: portaudio-prefix @@ -394,12 +406,14 @@ jobs: - name: Restore FFTW cache id: fftw-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: fftw-prefix key: fftw-macos-${{ inputs.arch }}-${{ env.RUNNER }}-3.3.10-min${{ env.DEPLOYMENT_TARGET }}-epoch1-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} - name: Build FFTW + id: fftw-build if: steps.fftw-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-fftw-macos.sh \ @@ -408,7 +422,7 @@ jobs: "${GITHUB_WORKSPACE}/fftw-prefix" - name: Save FFTW cache - if: steps.fftw-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.fftw-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: fftw-prefix @@ -416,12 +430,14 @@ jobs: - name: Restore Boost cache id: boost-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: boost-prefix key: boost-macos-${{ inputs.arch }}-${{ env.RUNNER }}-${{ env.BOOST_VERSION }}-${{ env.BOOST_SOURCE_SHA256 }}-min${{ env.DEPLOYMENT_TARGET }}-epoch1-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} - name: Build Boost + id: boost-build if: steps.boost-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-boost-macos.sh \ @@ -432,7 +448,7 @@ jobs: "${GITHUB_WORKSPACE}/boost-prefix" - name: Save Boost cache - if: steps.boost-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.boost-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: boost-prefix @@ -454,12 +470,14 @@ jobs: - name: Restore Hamlib cache id: hamlib-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: hamlib-prefix key: hamlib-macos-${{ inputs.arch }}-${{ env.RUNNER }}-${{ inputs.hamlib_branch }}-libusb1.0.27-min${{ env.DEPLOYMENT_TARGET }}-epoch1-${{ hashFiles('.github/scripts/build-hamlib-macos.sh', '.github/scripts/build-libusb-macos.sh') }} - name: Build Hamlib + id: hamlib-build if: steps.hamlib-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-hamlib-macos.sh \ @@ -478,7 +496,7 @@ jobs: "${GITHUB_WORKSPACE}/hamlib-prefix/lib/libhamlib.a" - name: Save Hamlib cache - if: steps.hamlib-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.hamlib-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: hamlib-prefix @@ -486,12 +504,14 @@ jobs: - name: Restore pFUnit cache id: pfunit-cache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: pfunit-prefix key: pfunit-macos-${{ inputs.arch }}-${{ env.RUNNER }}-v4.14.0-${{ steps.fc.outputs.cache_key }}-min${{ env.DEPLOYMENT_TARGET }}-epoch3-${{ hashFiles('.github/scripts/build-pfunit-macos.sh') }} - name: Build pFUnit + id: pfunit-build if: steps.pfunit-cache.outputs.cache-hit != 'true' env: # pFUnit configure uses try_run probes; expose only the controlled @@ -518,7 +538,7 @@ jobs: echo "dir=${PFUNIT_DIR}" >> "$GITHUB_OUTPUT" - name: Save pFUnit cache - if: steps.pfunit-cache.outputs.cache-hit != 'true' + if: ${{ !inputs.cold_build && steps.pfunit-cache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: pfunit-prefix @@ -544,56 +564,24 @@ jobs: -DPFUNIT_DIR="${{ steps.pfunit.outputs.dir }}" \ -DWSJT_SOURCE_REVISION="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}" \ -DWSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL}" \ - -DWSJT_RC_NUMBER="${WSJT_RC_NUMBER}" \ + -DWSJT_PRERELEASE_NUMBER="${WSJT_PRERELEASE_NUMBER}" \ -Wno-dev - name: Build and test targets + id: compile run: cmake --build wsjtx-build -j"$(sysctl -n hw.ncpu)" - name: Report suppressed ccache save - if: ${{ (inputs.save_ccache || inputs.recache) && github.ref != 'refs/heads/develop' }} + if: ${{ !inputs.cold_build && (inputs.save_ccache || inputs.recache) && github.ref != 'refs/heads/develop' }} run: echo "::notice::Not saving ccache because shared compiler caches are published only from develop" - name: Save ccache - if: ${{ success() && (inputs.save_ccache || inputs.recache) && github.ref == 'refs/heads/develop' && steps.ccache.outputs.cache-hit != 'true' }} + if: ${{ !inputs.cold_build && success() && (inputs.save_ccache || inputs.recache) && github.ref == 'refs/heads/develop' && steps.ccache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: .ccache key: ${{ steps.ccache.outputs.cache-primary-key }} - - name: Apply WSJT-X shared memory limits - run: | - python3 - <<'PY' - import plistlib - import subprocess - - expected_arguments = [ - "/usr/sbin/sysctl", - "kern.sysv.shmmax=52428800", - "kern.sysv.shmall=25600", - ] - - with open("Darwin/com.wsjtx.sysctl.plist", "rb") as source: - configuration = plistlib.load(source) - - if ( - configuration.get("Program") != expected_arguments[0] - or configuration.get("ProgramArguments") != expected_arguments - ): - raise SystemExit("shared memory plist does not match CI expectations") - - subprocess.run(["/usr/bin/sudo", *expected_arguments], check=True) - subprocess.run( - [expected_arguments[0], "kern.sysv.shmmax", "kern.sysv.shmall"], check=True - ) - PY - - - name: Raise shared memory total for parallel GUI tests - run: | - # Three decoder segments require 35,359 pages; leave headroom for other IPC. - sudo /usr/sbin/sysctl kern.sysv.shmall=40960 - /usr/sbin/sysctl kern.sysv.shmmax kern.sysv.shmall - - name: Run tests id: ctest run: ctest --parallel 3 --output-on-failure --output-junit ctest-results.xml @@ -660,13 +648,19 @@ jobs: fi done - for bin in jt9 wsprd wsprcode jt65code jt4code ft8code q65code encode77 fcal hash22calc; do - [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${ASSETS}/" - done - - for bin in ft4sim jt4sim jt65sim cwsim sfoxsim echosim EchoCallSim; do - [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${ASSETS}/" - done + missing=() + while IFS= read -r bin; do + [ -n "${bin}" ] || continue + if [ -f "${BUILD}/${bin}" ]; then + cp "${BUILD}/${bin}" "${ASSETS}/" + else + missing+=("${bin}") + fi + done < "${BUILD}/cli-tools.txt" + if [ "${#missing[@]}" -gt 0 ]; then + echo "::error::CLI tools listed in ${BUILD}/cli-tools.txt were not built: ${missing[*]}" + exit 1 + fi echo "stage_dir=${STAGE}" >> "$GITHUB_OUTPUT" echo "assets_dir=${ASSETS}" >> "$GITHUB_OUTPUT" @@ -819,25 +813,50 @@ jobs: PAYLOAD="$RUNNER_TEMP/pkg-payload" SCRIPTS="$RUNNER_TEMP/pkg-scripts" - mkdir -p "${PAYLOAD}/Applications" "${PAYLOAD}/Library/LaunchDaemons" "${SCRIPTS}" + mkdir -p "${PAYLOAD}/Applications" "${SCRIPTS}" cp -R "${STAGE}/wsjtx.app" "${PAYLOAD}/Applications/" mkdir -p "${PAYLOAD}/usr/local/wsjtx/lib" - for bin in "${STAGE}"/*; do - [ -f "$bin" ] && [ -x "$bin" ] && cp "$bin" "${PAYLOAD}/usr/local/wsjtx/" - done + missing=() + while IFS= read -r bin; do + [ -n "${bin}" ] || continue + if [ -f "${STAGE}/${bin}" ]; then + cp "${STAGE}/${bin}" "${PAYLOAD}/usr/local/wsjtx/" + else + missing+=("${bin}") + fi + done < wsjtx-build/installed-cli-tools.txt + if [ "${#missing[@]}" -gt 0 ]; then + echo "::error::CLI tools listed in wsjtx-build/installed-cli-tools.txt are missing from ${STAGE}: ${missing[*]}" + exit 1 + fi [ -d "${STAGE}/lib" ] && cp -R "${STAGE}/lib/"* "${PAYLOAD}/usr/local/wsjtx/lib/" - cp "Darwin/com.wsjtx.sysctl.plist" "${PAYLOAD}/Library/LaunchDaemons/" - + cp wsjtx-build/installed-cli-tools.txt "${SCRIPTS}/" cat > "${SCRIPTS}/postinstall" << 'SCRIPT' #!/bin/bash - /bin/launchctl load /Library/LaunchDaemons/com.wsjtx.sysctl.plist 2>/dev/null || true - /usr/sbin/sysctl kern.sysv.shmmax=52428800 kern.sysv.shmall=25600 2>/dev/null || true - mkdir -p /usr/local/bin - for bin in /usr/local/wsjtx/*; do - [ -f "$bin" ] && [ -x "$bin" ] && ln -sf "$bin" "/usr/local/bin/$(basename "$bin")" + root="${3%/}" # $3 is the installation's target volume + shipped="$(dirname "$0")/installed-cli-tools.txt" + mkdir -p "$root/usr/local/bin" + if [ -s "$shipped" ] && [ ! -L "$root/usr/local/wsjtx" ]; then + for bin in "$root"/usr/local/wsjtx/*; do + [ -f "$bin" ] && [ -x "$bin" ] || continue + name=$(basename "$bin") + grep -qxF -- "$name" "$shipped" && continue + rm -f "$bin" + link="$root/usr/local/bin/$name" + if [ -L "$link" ] && [ ! -e "$link" ]; then + case "$(readlink "$link")" in + "$root"/usr/local/wsjtx/*) rm -f "$link" ;; + esac + fi + done + fi + for bin in "$root"/usr/local/wsjtx/*; do + if [ -f "$bin" ] && [ -x "$bin" ]; then + ln -sf "$bin" "$root/usr/local/bin/$(basename "$bin")" + fi done SCRIPT chmod +x "${SCRIPTS}/postinstall" @@ -975,6 +994,33 @@ jobs: name: individual-binaries-macos-${{ inputs.arch }} path: packages/*.tar.gz + - name: Package release tarballs + run: | + .github/scripts/package-cli-tools.sh \ + --platform macos \ + --version "${{ inputs.version }}" \ + --arch "${{ inputs.arch }}" \ + --groups CMake/release-tarballs.txt \ + --source "${{ steps.collect.outputs.assets_dir }}" \ + --out release-tarballs + + - name: Smoke-test release tarballs + timeout-minutes: 5 + run: | + .github/scripts/smoke-release-tarballs.sh \ + --platform macos \ + --version "${{ inputs.version }}" \ + --target "${{ inputs.arch }}-macOS" \ + --groups CMake/release-tarballs.txt \ + --dir release-tarballs + + - name: Upload release tarballs + uses: ./.github/actions/upload-release-tarballs + with: + version: ${{ inputs.version }} + target: ${{ inputs.arch }}-macOS + directory: release-tarballs + # Keep repository-built code after signing, notarization, cleanup, and # artifact publication so a detached child cannot reach later secrets. - name: Smoke-launch deployed WSJT-X app @@ -1015,6 +1061,15 @@ jobs: if-no-files-found: ignore retention-days: 7 + - name: Summarize native caches + if: always() + shell: bash + env: + CACHE_STEPS: ${{ toJSON(steps) }} + COLD_BUILD: ${{ inputs.cold_build }} + RECACHE: ${{ inputs.recache }} + run: python3 .github/scripts/summarize-native-caches.py --compiler qt libusb portaudio fftw boost hamlib pfunit >> "$GITHUB_STEP_SUMMARY" + sign_distribution: if: inputs.signing_mode == 'distribution' needs: build diff --git a/.github/workflows/build-selected-artifacts.yml b/.github/workflows/build-selected-artifacts.yml index 71e33737..bf8c2203 100644 --- a/.github/workflows/build-selected-artifacts.yml +++ b/.github/workflows/build-selected-artifacts.yml @@ -44,8 +44,6 @@ jobs: timeout-minutes: 10 outputs: version: ${{ steps.v.outputs.version }} - release_channel: ${{ steps.v.outputs.release_channel }} - rc_number: ${{ steps.v.outputs.rc_number }} linux_image_tag: ${{ steps.linux-image.outputs.image_tag }} steps: - uses: actions/checkout@v7 @@ -53,14 +51,8 @@ jobs: run: | STATE=$(python3 .github/scripts/release-policy.py read-state) VERSION=$(jq -r .version <<<"$STATE") - CHANNEL=$(jq -r .channel <<<"$STATE") - RC_NUMBER=$(jq -r .rc <<<"$STATE") echo "Derived version from release-state.txt: $VERSION" - { - echo "version=$VERSION" - echo "release_channel=$CHANNEL" - echo "rc_number=$RC_NUMBER" - } >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" - id: linux-image name: Resolve Linux CI image generation env: @@ -80,8 +72,6 @@ jobs: image_tag: ${{ needs.prepare.outputs.linux_image_tag }} save_ccache: true recache: ${{ inputs.recache }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-x64: needs: [prepare] @@ -96,8 +86,6 @@ jobs: image_tag: ${{ needs.prepare.outputs.linux_image_tag }} save_ccache: true recache: ${{ inputs.recache }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-arm64: needs: [prepare, linux-smoke-x64] @@ -115,8 +103,6 @@ jobs: image_tag: ${{ needs.prepare.outputs.linux_image_tag }} save_ccache: true recache: ${{ inputs.recache }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} macos-arm64: needs: [prepare, linux-smoke-x64] @@ -138,8 +124,6 @@ jobs: runner: "macos-15" deployment_target: "11.0" recache: ${{ inputs.recache }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} macos-x64: needs: [prepare, linux-smoke-x64] @@ -157,8 +141,6 @@ jobs: runner: "macos-15-intel" deployment_target: "10.13" recache: ${{ inputs.recache }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} windows-x64: needs: [prepare, linux-smoke-x64] @@ -177,5 +159,3 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.2" recache: ${{ inputs.recache }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index c2dca58d..8cb10042 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -12,6 +12,11 @@ on: required: false type: string default: "4.7.2" + cold_build: + description: "Bypass workflow dependency and compiler caches without saving them" + required: false + type: boolean + default: false recache: description: "Force ccache to recompile and refresh cached objects" required: false @@ -22,16 +27,6 @@ on: required: false type: boolean default: false - release_channel: - description: "Build release channel: DEVEL, RC, or GA" - required: false - type: string - default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" - required: false - type: string - default: "" outputs: installer-artifact-id: description: "Installer artifact id, for the SignPath submit step" @@ -44,6 +39,8 @@ on: # what ci.yml / release.yml actually pass (4.7.2, not the workflow_call legacy # default), and version defaults to a clearly-marked devel string -- overridable # via `-f version=...` -- so a manual build is never mistaken for a release. + # release_channel and prerelease_number exist only here, to override + # release-state.txt. workflow_dispatch: inputs: version: @@ -56,6 +53,11 @@ on: required: false type: string default: "4.7.2" + cold_build: + description: "Bypass workflow dependency and compiler caches without saving them" + required: false + type: boolean + default: false recache: description: "Force ccache to recompile and refresh cached objects" required: false @@ -72,11 +74,12 @@ on: type: choice options: - DEVEL + - BETA - RC - GA default: "DEVEL" - rc_number: - description: "Release candidate number when release_channel is RC" + prerelease_number: + description: "Prerelease number when release_channel is BETA or RC" required: false type: string default: "" @@ -94,7 +97,7 @@ jobs: VERSION: ${{ inputs.version }} HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} - WSJT_RC_NUMBER: ${{ inputs.rc_number }} + WSJT_PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} defaults: run: shell: msys2 {0} @@ -124,7 +127,7 @@ jobs: with: msystem: MINGW64 update: true - cache: true + cache: ${{ !inputs.cold_build }} install: >- git make tar mingw-w64-x86_64-gcc @@ -161,6 +164,7 @@ jobs: - name: Restore ccache id: ccache + if: ${{ !inputs.cold_build }} uses: actions/cache/restore@v6 with: path: .ccache @@ -171,7 +175,11 @@ jobs: - name: Configure ccache run: | WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - echo "CCACHE_DIR=${WORKSPACE}/.ccache" >> "$GITHUB_ENV" + if [ "${{ inputs.cold_build }}" = "true" ]; then + echo "CCACHE_DIR=$(mktemp -d)" >> "$GITHUB_ENV" + else + echo "CCACHE_DIR=${WORKSPACE}/.ccache" >> "$GITHUB_ENV" + fi echo "ccache recache: ${{ inputs.recache }}" if [ "${{ inputs.recache }}" = "true" ]; then echo "CCACHE_RECACHE=1" >> "$GITHUB_ENV" @@ -189,6 +197,7 @@ jobs: boost_source_sha256: ${{ env.BOOST_SOURCE_SHA256 }} windows_api_floor: ${{ env.WSJT_WINDOWS_API_FLOOR }} hamlib_branch: ${{ inputs.hamlib_branch }} + cold_build: ${{ inputs.cold_build }} save_caches: ${{ github.event_name != 'pull_request' }} - name: Install OmniRig @@ -231,9 +240,10 @@ jobs: -DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch -std=legacy" \ -DWSJT_SKIP_MANPAGES=ON \ -DWSJT_ENABLE_TESTS=ON \ + -DWSJT_ENABLE_GUI_SMOKE_TESTS=ON \ -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \ -DWSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL}" \ - -DWSJT_RC_NUMBER="${WSJT_RC_NUMBER}" \ + -DWSJT_PRERELEASE_NUMBER="${WSJT_PRERELEASE_NUMBER}" \ -DPFUNIT_DIR="${{ steps.windows-deps.outputs.pfunit_dir }}" \ -DGFTL_DIR="${{ steps.windows-deps.outputs.gftl_dir }}" \ -DGFTL_SHARED_DIR="${{ steps.windows-deps.outputs.gftl_shared_dir }}" \ @@ -241,6 +251,7 @@ jobs: -Wno-dev - name: Build and test targets + id: compile run: cmake --build wsjtx-build -j$(nproc) - name: Show ccache stats @@ -248,11 +259,11 @@ jobs: run: ccache --show-stats - name: Report suppressed ccache save - if: ${{ (inputs.save_ccache || inputs.recache) && github.ref != 'refs/heads/develop' }} + if: ${{ !inputs.cold_build && (inputs.save_ccache || inputs.recache) && github.ref != 'refs/heads/develop' }} run: echo "::notice::Not saving ccache because shared compiler caches are published only from develop" - name: Save ccache - if: ${{ success() && (inputs.save_ccache || inputs.recache) && github.ref == 'refs/heads/develop' && steps.ccache.outputs.cache-hit != 'true' }} + if: ${{ !inputs.cold_build && success() && (inputs.save_ccache || inputs.recache) && github.ref == 'refs/heads/develop' && steps.ccache.outputs.cache-hit != 'true' }} uses: actions/cache/save@v6 with: path: .ccache @@ -271,6 +282,18 @@ jobs: # libhamlib-4.dll in. export PATH="${{ steps.windows-deps.outputs.boost_prefix }}/lib:${{ steps.windows-deps.outputs.hamlib_prefix }}/bin:${PATH}" ctest --output-on-failure --output-junit ctest-results.xml + python3 - <<'PY' + import xml.etree.ElementTree as ET + + root = ET.parse('ctest-results.xml').getroot() + for name in ('test_wsjtx_live_audio_jtty', 'test_wsjtx_jtty_tx_loopback', + 'test_wsjtx_jt9_wav', 'test_wsjtx_jt65_wav', 'test_wsjtx_q65_wav', + 'test_wsjtx_fst4_wav', 'test_wsjtx_fst4w_wav'): + test = root.find(f".//testcase[@name='{name}']") + if test is None or test.find('failure') is not None or test.find('skipped') is not None: + raise SystemExit(f'{name} was not executed successfully') + print(f'{name} passed') + PY working-directory: wsjtx-build - name: Publish test summary @@ -339,12 +362,36 @@ jobs: WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") .github/scripts/smoke-launch-windows.sh "${WORKSPACE}/stage-main/bin/jt9.exe" --help + - name: Package release tarballs + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + .github/scripts/package-cli-tools.sh \ + --platform windows \ + --version "${VERSION}" \ + --arch x86_64 \ + --groups "${WORKSPACE}/CMake/release-tarballs.txt" \ + --source "${WORKSPACE}/wsjtx-build" \ + --dll-dir "${WORKSPACE}/stage-main/bin" \ + --system-dir "$(cygpath -S)" \ + --out "${WORKSPACE}/release-tarballs" + + - name: Smoke-launch release tarballs (clean PATH) + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + .github/scripts/smoke-release-tarballs.sh \ + --platform windows \ + --version "${VERSION}" \ + --target windows-x86_64 \ + --groups "${WORKSPACE}/CMake/release-tarballs.txt" \ + --dir "${WORKSPACE}/release-tarballs" + # Emit an NSIS installer containing the full executable set # (wsjtx.exe, map65.exe, jt9, wsprd, fmtave, fcal, fmeasure + WSJT_BUILD_UTILS # ft8code/jt65code/... + rigctl wrappers + Qt runtime via bundle_fixup). # CMakeLists.txt:1989-1990 sets CPACK_GENERATOR=NSIS on WIN32 and # CPACK_MONOLITHIC_INSTALL=1 packages every install() target. - name: Package NSIS installer + id: package_installer run: | cd wsjtx-build # Override CPACK_PACKAGE_VERSION and @@ -357,16 +404,38 @@ jobs: # wsjtx-<inputs.version>-win64.exe. release.yml's prepare job # enforces numeric-base parity; this override covers the # suffix gap. + # MSYS2 supplies amd64 plugins; NSIS 3.13 can select x86 by default. cpack_args=( -G NSIS -D CPACK_PACKAGE_VERSION="${VERSION}" -D CPACK_PACKAGE_FILE_NAME="wsjtx-${VERSION}-win64" + -D 'CPACK_NSIS_EXTRA_DEFINES=Target amd64-unicode' ) if [ "${CPACK_VERBOSE:-0}" = "1" ]; then cpack_args+=(-V) fi - cpack "${cpack_args[@]}" - ls -la *.exe + if cpack "${cpack_args[@]}"; then + ls -la *.exe + else + cpack_status=$? + for nsis_log in _CPack_Packages/*/NSIS/NSISOutput.log; do + [ -f "${nsis_log}" ] || continue + echo "::group::${nsis_log}" + cat "${nsis_log}" + echo "::endgroup::" + done + exit "${cpack_status}" + fi + + - name: Upload NSIS failure diagnostics + if: ${{ failure() && steps.package_installer.outcome == 'failure' }} + uses: actions/upload-artifact@v7 + with: + name: nsis-diagnostics-windows + path: | + wsjtx-build/_CPack_Packages/*/NSIS/NSISOutput.log + wsjtx-build/_CPack_Packages/*/NSIS/project.nsi + if-no-files-found: warn - name: Verify installer has no Authenticode signature shell: pwsh @@ -392,3 +461,19 @@ jobs: wsjtx-build/jt9.exe wsjtx-build/wsprd.exe wsjtx-build/wsjtx.exe + + - name: Upload release tarballs + uses: ./.github/actions/upload-release-tarballs + with: + version: ${{ inputs.version }} + target: windows-x86_64 + directory: release-tarballs + + - name: Summarize native caches + if: always() + shell: bash + env: + CACHE_STEPS: ${{ toJSON(steps) }} + COLD_BUILD: ${{ inputs.cold_build }} + RECACHE: ${{ inputs.recache }} + run: python .github/scripts/summarize-native-caches.py --compiler >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70ce9fe4..3b96564a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,12 +42,14 @@ jobs: # optional fourth tweak segment (3.0.0.0 → 3.0.0) to match the 3-part # shape release.yml derives from build/v<X.Y.Z> tags. prepare: + if: >- + github.repository != 'WSJTX/wsjtx' || + github.event_name != 'push' || + !startsWith(github.ref, 'refs/heads/release/') runs-on: ubuntu-latest timeout-minutes: 10 outputs: version: ${{ steps.v.outputs.version }} - release_channel: ${{ steps.v.outputs.release_channel }} - rc_number: ${{ steps.v.outputs.rc_number }} linux_image_tag: ${{ steps.linux-image.outputs.image_tag }} armhf_image_tag: ${{ steps.armhf-image.outputs.image_tag }} save_linux_ccache: ${{ steps.ccache-policy.outputs.save_ccache }} @@ -70,14 +72,8 @@ jobs: run: | STATE=$(python3 .github/scripts/release-policy.py read-state) VERSION=$(jq -r .version <<<"$STATE") - CHANNEL=$(jq -r .channel <<<"$STATE") - RC_NUMBER=$(jq -r .rc <<<"$STATE") echo "Derived version from release-state.txt: $VERSION" - { - echo "version=$VERSION" - echo "release_channel=$CHANNEL" - echo "rc_number=$RC_NUMBER" - } >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" # PRs can consume develop caches, so only trusted develop executions may # publish the Linux cache shared with later pull-request builds. - id: ccache-policy @@ -87,12 +83,12 @@ jobs: REQUEST_SAVE_CCACHE: ${{ inputs.save_ccache || false }} RECACHE: ${{ inputs.recache || false }} run: .github/scripts/select-linux-ccache-save.sh + # Routine PRs and develop pushes build and test without packaging. + # Full CI, manual runs, and release-branch pushes also validate packages. - id: packaging-policy name: Select Linux packaging policy env: EVENT_NAME: ${{ github.event_name }} - PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} - CURRENT_SHA: ${{ github.sha }} FULL_CI: ${{ contains(github.event.pull_request.labels.*.name, 'full-ci') }} run: .github/scripts/select-linux-packaging.sh - id: linux-image @@ -145,8 +141,6 @@ jobs: runner: "macos-15" deployment_target: "11.0" recache: ${{ inputs.recache || false }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} macos-intel: needs: [prepare, linux] @@ -162,8 +156,6 @@ jobs: runner: "macos-15-intel" deployment_target: "10.13" recache: ${{ inputs.recache || false }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux: needs: [prepare] @@ -178,8 +170,6 @@ jobs: save_ccache: ${{ needs.prepare.outputs.save_linux_ccache == 'true' }} validate_fortran_fallback: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'full-ci') }} build_packages: ${{ needs.prepare.outputs.build_linux_packages == 'true' }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit linux-sanitizers: @@ -224,13 +214,11 @@ jobs: recache: ${{ inputs.recache || false }} save_ccache: ${{ needs.prepare.outputs.save_linux_ccache == 'true' }} build_packages: ${{ needs.prepare.outputs.build_linux_packages == 'true' }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit linux-armhf: needs: [prepare, linux] - # Opt-in only -- target tests and runtime validation execute under QEMU. + # Opt-in only, like the other targets beyond Linux x86_64. if: >- github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'full-ci') @@ -244,8 +232,6 @@ jobs: recache: ${{ inputs.recache || false }} save_ccache: ${{ needs.prepare.outputs.save_linux_ccache == 'true' }} build_packages: ${{ needs.prepare.outputs.build_linux_packages == 'true' }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit windows: @@ -259,5 +245,3 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.2" recache: ${{ inputs.recache || false }} - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} diff --git a/.github/workflows/prepare-release-dependencies.yml b/.github/workflows/prepare-release-dependencies.yml new file mode 100644 index 00000000..daf34dfc --- /dev/null +++ b/.github/workflows/prepare-release-dependencies.yml @@ -0,0 +1,104 @@ +name: Prepare Release Dependencies +run-name: Prepare Release Dependencies ${{ inputs.source_branch }} ${{ inputs.generation }} + +on: + workflow_dispatch: + inputs: + source_branch: + description: Protected develop or release/X.Y branch whose recipes to validate + required: true + type: string + generation: + description: Explicit validated-build-YYYYMMDD-RUN-ATTEMPT image generation + required: true + type: string + +permissions: + contents: read + +concurrency: + group: prepare-release-dependencies + cancel-in-progress: false + +jobs: + prepare: + if: github.repository == 'WSJTX/wsjtx-internal' && github.ref == 'refs/heads/develop' + runs-on: ubuntu-24.04 + timeout-minutes: 60 + permissions: + contents: read + packages: write + steps: + - name: Require protected develop + env: + REF_PROTECTED: ${{ github.ref_protected }} + run: | + if [ "$REF_PROTECTED" != true ]; then + echo "::error::develop is not protected" + exit 1 + fi + - uses: actions/checkout@v7 + with: + persist-credentials: false + - name: Resolve protected source branch to an exact commit + id: source + env: + GH_TOKEN: ${{ github.token }} + SOURCE_BRANCH: ${{ inputs.source_branch }} + shell: bash + run: | + if [[ ! "$SOURCE_BRANCH" =~ ^(develop|release/[0-9]+\.[0-9]+)$ ]]; then + echo "::error::Select develop or a release/X.Y branch" + exit 1 + fi + branch="$(gh api "repos/${GITHUB_REPOSITORY}/branches/${SOURCE_BRANCH//\//%2F}")" + if [ "$(jq -r '.protected' <<< "$branch")" != true ]; then + echo "::error::$SOURCE_BRANCH is not protected" + exit 1 + fi + sha="$(jq -r '.commit.sha' <<< "$branch")" + [[ "$sha" =~ ^[0-9a-f]{40}$ ]] + echo "sha=$sha" >> "$GITHUB_OUTPUT" + - name: Check out source recipes + uses: actions/checkout@v7 + with: + ref: ${{ steps.source.outputs.sha }} + path: source + persist-credentials: false + - name: Install registry tools + run: | + sudo apt-get update + sudo apt-get install -y skopeo + - uses: docker/setup-qemu-action@v4 + with: + image: tonistiigi/binfmt:qemu-v10.2.3-68@sha256:400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0 + platforms: arm64,arm + - name: Authenticate registry clients + env: + GH_TOKEN: ${{ github.token }} + run: | + printf '%s' "$GH_TOKEN" | docker login ghcr.io --username "$GITHUB_ACTOR" --password-stdin + printf '%s' "$GH_TOKEN" | skopeo login ghcr.io --username "$GITHUB_ACTOR" --password-stdin + - name: Verify and copy the selected images + working-directory: source + env: + GENERATION: ${{ inputs.generation }} + PREPARATION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + python3 ../.github/scripts/release-linux-images.py prepare "$GENERATION" \ + --output-directory ../prepared-dependencies + { + echo '## Prepared Linux dependencies' + echo + echo 'Review and commit release-linux-images.json before creating the candidate.' + echo + echo '```json' + cat ../prepared-dependencies/release-linux-images.json + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + - uses: actions/upload-artifact@v7 + with: + name: prepared-release-dependencies + path: prepared-dependencies/ + if-no-files-found: error + retention-days: 90 diff --git a/.github/workflows/promote-release.yml b/.github/workflows/promote-release.yml index 9a3ccf6d..8c1f4c1c 100644 --- a/.github/workflows/promote-release.yml +++ b/.github/workflows/promote-release.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: inputs: version: - description: "Version without v (X.Y.Z or X.Y.Z-rcN)" + description: "Version without v (X.Y.Z, X.Y.Z-betaN, or X.Y.Z-rcN)" required: true type: string candidate_run_id: @@ -31,12 +31,16 @@ jobs: public_tag: ${{ steps.candidate.outputs.public_tag }} channel: ${{ steps.candidate.outputs.channel }} prior_master: ${{ steps.public.outputs.prior_master }} + prior_release_branch: ${{ steps.public.outputs.prior_release_branch }} tag_exists: ${{ steps.public.outputs.tag_exists }} + advance_master: ${{ steps.public.outputs.advance_master }} + newest_ga_line: ${{ steps.public.outputs.newest_ga_line }} + legacy_tag_only: ${{ steps.public.outputs.legacy_tag_only }} + public_refs_digest: ${{ steps.public.outputs.public_refs_digest }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: fetch-depth: 0 - persist-credentials: false - name: Validate candidate run and immutable tag id: candidate env: @@ -63,19 +67,15 @@ jobs: RUN_SHA=$(jq -r .head_sha <<<"$RUN") git fetch origin "+refs/tags/$TAG:refs/tags/$TAG" "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH" TAG_SHA=$(git rev-parse "$TAG^{commit}") - if [ "$GITHUB_SHA" != "$TAG_SHA" ]; then - echo "::error::Run this workflow from $BRANCH at $TAG_SHA" + BRANCH_SHA=$(git rev-parse "origin/$BRANCH^{commit}") + if [ "$GITHUB_REF" != "refs/heads/$BRANCH" ] || [ "$GITHUB_SHA" != "$BRANCH_SHA" ]; then + echo "::error::Run this workflow from the current $BRANCH tip at $BRANCH_SHA" exit 1 fi if [ "$TAG_SHA" != "$RUN_SHA" ]; then echo "::error::$TAG resolves to $TAG_SHA but run $RUN_ID built $RUN_SHA" exit 1 fi - BRANCH_SHA=$(git rev-parse "origin/$BRANCH^{commit}") - if [ "$TAG_SHA" != "$BRANCH_SHA" ]; then - echo "::error::$TAG is $TAG_SHA but the current $BRANCH tip is $BRANCH_SHA" - exit 1 - fi git checkout --detach "$TAG_SHA" python3 .github/scripts/release-policy.py validate-source "$VERSION" @@ -89,6 +89,10 @@ jobs: test "$(jq -r .tag "$PROVENANCE")" = "$TAG" test "$(jq -r .commit "$PROVENANCE")" = "$TAG_SHA" test "$(jq -r .version "$PROVENANCE")" = "$VERSION" + python3 .github/scripts/release-linux-images.py verify-provenance \ + release-linux-images.json "$PROVENANCE" + python3 .github/scripts/release-linux-images.py validate \ + release-linux-images.json --check-remote { echo "sha=$TAG_SHA" echo "tag=$TAG" @@ -100,22 +104,22 @@ jobs: - name: Validate public ref state id: public env: - PUBLIC_TAG: ${{ steps.candidate.outputs.public_tag }} + VERSION: ${{ inputs.version }} SHA: ${{ steps.candidate.outputs.sha }} run: | set -euo pipefail git remote add public https://github.com/WSJTX/wsjtx.git - PUBLIC_TAG_SHA=$(git ls-remote public "refs/tags/$PUBLIC_TAG^{}" | awk '{print $1}') - if [ -z "$PUBLIC_TAG_SHA" ]; then - PUBLIC_TAG_SHA=$(git ls-remote public "refs/tags/$PUBLIC_TAG" | awk '{print $1}') - fi - if [ -n "$PUBLIC_TAG_SHA" ] && [ "$PUBLIC_TAG_SHA" != "$SHA" ]; then - echo "::error::Public $PUBLIC_TAG already exists at $PUBLIC_TAG_SHA; tags are never moved" - exit 1 - fi - PRIOR_MASTER=$(git ls-remote public refs/heads/master | awk '{print $1}') - echo "tag_exists=$([ "$PUBLIC_TAG_SHA" = "$SHA" ] && echo true || echo false)" >> "$GITHUB_OUTPUT" - echo "prior_master=$PRIOR_MASTER" >> "$GITHUB_OUTPUT" + PLAN=$(python3 .github/scripts/release-policy.py plan-public-promotion \ + "$VERSION" --sha "$SHA" --remote public) + { + echo "prior_master=$(jq -r '.prior_master // ""' <<<"$PLAN")" + echo "prior_release_branch=$(jq -r '.prior_release_branch // ""' <<<"$PLAN")" + echo "tag_exists=$(jq -r .tag_exists <<<"$PLAN")" + echo "advance_master=$(jq -r .advance_master <<<"$PLAN")" + echo "newest_ga_line=$(jq -r .newest_ga_line <<<"$PLAN")" + echo "legacy_tag_only=$(jq -r .legacy_tag_only <<<"$PLAN")" + echo "public_refs_digest=$(jq -r .public_refs_digest <<<"$PLAN")" + } >> "$GITHUB_OUTPUT" - name: Summarize validation env: @@ -123,7 +127,13 @@ jobs: RUN_ID: ${{ inputs.candidate_run_id }} SHA: ${{ steps.candidate.outputs.sha }} CHANNEL: ${{ steps.candidate.outputs.channel }} + BRANCH: ${{ steps.candidate.outputs.branch }} PRIOR_MASTER: ${{ steps.public.outputs.prior_master }} + PRIOR_RELEASE_BRANCH: ${{ steps.public.outputs.prior_release_branch }} + TAG_EXISTS: ${{ steps.public.outputs.tag_exists }} + ADVANCE_MASTER: ${{ steps.public.outputs.advance_master }} + NEWEST_GA_LINE: ${{ steps.public.outputs.newest_ga_line }} + LEGACY_TAG_ONLY: ${{ steps.public.outputs.legacy_tag_only }} run: | { echo "## Public source validation" @@ -133,11 +143,28 @@ jobs: echo "- Exact commit: \`$SHA\`" echo "- Public tag: \`v$VERSION\`" echo "- Prior public master: \`${PRIOR_MASTER:-<none>}\`" + echo "- Public $BRANCH branch: \`${PRIOR_RELEASE_BRANCH:-<create on promotion>}\`" + echo "- Newest public GA line: $NEWEST_GA_LINE$([ "$LEGACY_TAG_ONLY" = true ] && echo ' (legacy tag-only state)')" + if [ "$TAG_EXISTS" = true ]; then + echo "- Existing public tag: already resolves to the exact candidate SHA" + else + echo "- Existing public tag: will be created" + fi + if [ "$CHANNEL" = GA ] && [ "$ADVANCE_MASTER" = true ]; then + echo "- Public master: advance by fast-forward with the newest-line GA" + elif [ "$CHANNEL" = GA ]; then + echo "- Public master: leave unchanged; this is an older-line GA" + else + echo "- Public master: leave unchanged for a beta or RC" + fi } >> "$GITHUB_STEP_SUMMARY" promote: if: inputs.operation == 'promote' needs: validate + concurrency: + group: public-release-source-promotion + cancel-in-progress: false runs-on: ubuntu-latest timeout-minutes: 10 environment: source-promotion @@ -150,11 +177,9 @@ jobs: - name: Promote exact source commit env: TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} - PUBLIC_TAG: ${{ needs.validate.outputs.public_tag }} SHA: ${{ needs.validate.outputs.sha }} - CHANNEL: ${{ needs.validate.outputs.channel }} - PRIOR_MASTER: ${{ needs.validate.outputs.prior_master }} - TAG_EXISTS: ${{ needs.validate.outputs.tag_exists }} + VERSION: ${{ inputs.version }} + PUBLIC_REFS_DIGEST: ${{ needs.validate.outputs.public_refs_digest }} run: | set -euo pipefail if [ -z "$TOKEN" ]; then @@ -162,29 +187,6 @@ jobs: exit 1 fi git remote add public "https://x-access-token:${TOKEN}@github.com/WSJTX/wsjtx.git" - CURRENT_TAG=$(git ls-remote public "refs/tags/$PUBLIC_TAG" | awk '{print $1}') - CURRENT_MASTER=$(git ls-remote public refs/heads/master | awk '{print $1}') - test "$CURRENT_MASTER" = "$PRIOR_MASTER" - if [ -n "$CURRENT_TAG" ] && [ "$CURRENT_TAG" != "$SHA" ]; then - echo "::error::$PUBLIC_TAG was created at a different commit after validation" - exit 1 - fi - if [ "$CHANNEL" = GA ] && [ -n "$PRIOR_MASTER" ]; then - git cat-file -e "$PRIOR_MASTER^{commit}" 2>/dev/null || git fetch public master - git merge-base --is-ancestor "$PRIOR_MASTER" "$SHA" || { - echo "::error::GA promotion must advance public master" - exit 1 - } - fi - if [ "$CHANNEL" = GA ] && [ -z "$CURRENT_TAG" ]; then - git push --atomic public \ - "$SHA:refs/heads/master" "$SHA:refs/tags/$PUBLIC_TAG" \ - --force-with-lease="refs/heads/master:$PRIOR_MASTER" - elif [ "$CHANNEL" = GA ]; then - git push public "$SHA:refs/heads/master" \ - --force-with-lease="refs/heads/master:$PRIOR_MASTER" - elif [ -z "$CURRENT_TAG" ]; then - git push public "$SHA:refs/tags/$PUBLIC_TAG" - else - echo "$PUBLIC_TAG already points to $SHA; promotion is idempotently satisfied." - fi + python3 .github/scripts/release-policy.py promote-public-source \ + "$VERSION" --sha "$SHA" --remote public \ + --expected-refs-digest "$PUBLIC_REFS_DIGEST" diff --git a/.github/workflows/public-release.yml b/.github/workflows/public-release.yml index 14d4e611..f515a6fd 100644 --- a/.github/workflows/public-release.yml +++ b/.github/workflows/public-release.yml @@ -16,16 +16,54 @@ jobs: if: github.repository == 'WSJTX/wsjtx' runs-on: ubuntu-latest timeout-minutes: 10 + permissions: + actions: read + contents: read outputs: version: ${{ steps.identity.outputs.version }} release_channel: ${{ steps.identity.outputs.channel }} - rc_number: ${{ steps.identity.outputs.rc_number }} + prerelease_number: ${{ steps.identity.outputs.prerelease_number }} macos_sign_mode: ${{ steps.identity.outputs.macos_sign_mode }} windows_signing: ${{ steps.identity.outputs.windows_signing }} + image_tag: ${{ steps.linux-images.outputs.image_tag }} + x86_64_digest: ${{ steps.linux-images.outputs.x86_64_digest }} + aarch64_digest: ${{ steps.linux-images.outputs.aarch64_digest }} + armhf_digest: ${{ steps.linux-images.outputs.armhf_digest }} + armhf_cross_digest: ${{ steps.linux-images.outputs.armhf_cross_digest }} steps: - uses: actions/checkout@v7 with: fetch-depth: 0 + - name: Validate final publication environment protection + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + CHANNEL=$(python3 .github/scripts/release-policy.py classify "${GITHUB_REF_NAME#v}" | jq -r .channel) + ENVIRONMENT=public-release + POLICIES=() + if [ "$CHANNEL" = BETA ]; then + ENVIRONMENT=beta-release + if ! gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT/deployment-branch-policies" \ + > "$RUNNER_TEMP/publication-deployment-policies.json"; then + echo "::error::Unable to read $ENVIRONMENT deployment policies." + exit 1 + fi + POLICIES=(--deployment-policies "$RUNNER_TEMP/publication-deployment-policies.json") + fi + if ! gh api \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "repos/$GITHUB_REPOSITORY/environments/$ENVIRONMENT" \ + > "$RUNNER_TEMP/publication-environment.json"; then + echo "::error::Unable to read $ENVIRONMENT environment protection rules." + exit 1 + fi + python3 .github/scripts/release-policy.py validate-publication-environment \ + "$RUNNER_TEMP/publication-environment.json" --channel "$CHANNEL" "${POLICIES[@]}" - name: Validate public release tag and source identity id: identity env: @@ -33,36 +71,37 @@ jobs: run: | set -euo pipefail if [[ ! "$GITHUB_REF_NAME" =~ ^v(.+)$ ]]; then - echo "::error::Expected vX.Y.Z or vX.Y.Z-rcN" + echo "::error::Expected vX.Y.Z, vX.Y.Z-betaN, or vX.Y.Z-rcN" exit 1 fi VERSION="${GITHUB_REF_NAME#v}" IDENTITY=$(python3 .github/scripts/release-policy.py validate-source "$VERSION") + CHANNEL=$(jq -r .channel <<<"$IDENTITY") { echo "version=$(jq -r .version <<<"$IDENTITY")" - echo "channel=$(jq -r .channel <<<"$IDENTITY")" - echo "rc_number=$(jq -r .rc_number <<<"$IDENTITY")" + echo "channel=$CHANNEL" + echo "prerelease_number=$(jq -r .prerelease_number <<<"$IDENTITY")" echo "windows_signing=$(jq -r .windows_signing <<<"$IDENTITY")" } >> "$GITHUB_OUTPUT" - if [ "$MACOS_DISTRIBUTION_SIGNING_ENABLED" = true ]; then + if [ "$CHANNEL" = BETA ]; then + echo "macos_sign_mode=validation" >> "$GITHUB_OUTPUT" + echo "::notice::Betas publish the validated unsigned macOS packages as immutable assets." + elif [ "$MACOS_DISTRIBUTION_SIGNING_ENABLED" = true ]; then echo "macos_sign_mode=distribution" >> "$GITHUB_OUTPUT" else echo "macos_sign_mode=validation" >> "$GITHUB_OUTPUT" echo "::notice::macOS distribution signing is disabled. Validated packages will be published for manual replacement." fi - - linux-images: - needs: prepare - uses: ./.github/workflows/publish-linux-ci-images.yml - permissions: - contents: read - packages: write - with: - publication_target: public-release - mode: refresh - promote: false - image_set: normal - include_armhf: true + - name: Validate public release-line state + run: | + set -euo pipefail + python3 .github/scripts/release-policy.py \ + public-release-line "${GITHUB_REF_NAME#v}" --remote origin + - name: Validate prepared Linux images + id: linux-images + run: | + python3 .github/scripts/release-linux-images.py validate release-linux-images.json \ + --check-remote --github-output "$GITHUB_OUTPUT" macos: needs: prepare @@ -76,8 +115,6 @@ jobs: arch: arm64 runner: macos-15 deployment_target: "11.0" - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} signing_mode: ${{ needs.prepare.outputs.macos_sign_mode }} macos-intel: @@ -92,12 +129,10 @@ jobs: arch: x86_64 runner: macos-15-intel deployment_target: "10.13" - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} signing_mode: ${{ needs.prepare.outputs.macos_sign_mode }} linux: - needs: [prepare, linux-images] + needs: prepare uses: ./.github/workflows/build-linux.yml permissions: actions: read @@ -108,14 +143,12 @@ jobs: hamlib_branch: "4.7.2" arch: x86_64 image_source: public-release - image_tag: ${{ needs.linux-images.outputs.image_tag }} - image_digest: ${{ needs.linux-images.outputs.x86_64_digest }} + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.x86_64_digest }} build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-arm: - needs: [prepare, linux-images] + needs: prepare uses: ./.github/workflows/build-linux.yml permissions: actions: read @@ -126,14 +159,12 @@ jobs: hamlib_branch: "4.7.2" arch: aarch64 image_source: public-release - image_tag: ${{ needs.linux-images.outputs.image_tag }} - image_digest: ${{ needs.linux-images.outputs.aarch64_digest }} + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.aarch64_digest }} build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-armhf: - needs: [prepare, linux-images] + needs: prepare uses: ./.github/workflows/build-linux.yml permissions: actions: read @@ -144,12 +175,10 @@ jobs: hamlib_branch: "4.7.2" arch: armhf image_source: public-release - image_tag: ${{ needs.linux-images.outputs.image_tag }} - image_digest: ${{ needs.linux-images.outputs.armhf_digest }} - armhf_cross_image_digest: ${{ needs.linux-images.outputs.armhf_cross_digest }} + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.armhf_digest }} + armhf_cross_image_digest: ${{ needs.prepare.outputs.armhf_cross_digest }} build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} windows: needs: prepare @@ -160,11 +189,11 @@ jobs: with: version: ${{ needs.prepare.outputs.version }} release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} + prerelease_number: ${{ needs.prepare.outputs.prerelease_number }} windows_signing: ${{ needs.prepare.outputs.windows_signing }} assemble: - needs: [prepare, linux-images, macos, macos-intel, linux, linux-arm, linux-armhf, windows] + needs: [prepare, macos, macos-intel, linux, linux-arm, linux-armhf, windows] runs-on: ubuntu-latest timeout-minutes: 30 permissions: @@ -178,6 +207,9 @@ jobs: - uses: actions/download-artifact@v8 with: path: artifacts + # build-linux.yml hands this tree between its ARMHF jobs; it is no asset. + - name: Drop the ARMHF build tree + run: rm -rf artifacts/armhf-build-tree - name: Build corresponding source archive env: VERSION: ${{ needs.prepare.outputs.version }} @@ -225,10 +257,10 @@ jobs: --repository "$GITHUB_REPOSITORY" \ --commit "$GITHUB_SHA" \ --run-id "$GITHUB_RUN_ID" \ - --linux-x86-64-digest "${{ needs.linux-images.outputs.x86_64_digest }}" \ - --linux-aarch64-digest "${{ needs.linux-images.outputs.aarch64_digest }}" \ - --linux-armhf-cross-digest "${{ needs.linux-images.outputs.armhf_cross_digest }}" \ - --linux-armhf-digest "${{ needs.linux-images.outputs.armhf_digest }}" \ + --linux-x86-64-digest "${{ needs.prepare.outputs.x86_64_digest }}" \ + --linux-aarch64-digest "${{ needs.prepare.outputs.aarch64_digest }}" \ + --linux-armhf-cross-digest "${{ needs.prepare.outputs.armhf_cross_digest }}" \ + --linux-armhf-digest "${{ needs.prepare.outputs.armhf_digest }}" \ --macos-mode "$MACOS_MODE" --windows-mode "$WINDOWS_MODE" - name: Assemble publication bundle env: @@ -249,7 +281,38 @@ jobs: artifacts/wsjtx-*-windows-signing-verification \ release-bundle/verification/ fi - - name: Upload publication bundle for approval + - name: Summarize verified publication bundle + env: + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + set -euo pipefail + (cd release-bundle && sha256sum --check SHA256SUMS) + diff -u \ + <(jq -r '.assets[] | "\(.sha256) \(.name)"' release-bundle/release-manifest.json | sort) \ + <(sort release-bundle/SHA256SUMS) + test "$(jq -r .repository release-bundle/release-manifest.json)" = "$GITHUB_REPOSITORY" + test "$(jq -r .tag release-bundle/release-manifest.json)" = "$GITHUB_REF_NAME" + test "$(jq -r .commit release-bundle/release-manifest.json)" = "$GITHUB_SHA" + test "$(jq -r .workflow_run release-bundle/release-manifest.json)" = "$GITHUB_RUN_ID" + { + echo "## Verified public release bundle" + echo + printf -- '- **Public tag:** %s\n' "$(jq -r .tag release-bundle/release-manifest.json)" + printf -- '- **Full source SHA:** %s\n' "$(jq -r .commit release-bundle/release-manifest.json)" + printf -- '- **Workflow run:** [#%s](%s)\n' "$GITHUB_RUN_ID" "$RUN_URL" + printf -- '- **Windows signing:** %s\n' "$(jq -r .windows_signing.mode release-bundle/release-manifest.json | sed 's/^unsigned$/source-pinned unsigned/')" + printf -- '- **macOS signing:** %s\n' "$(jq -r .macos_signing.mode release-bundle/release-manifest.json)" + echo + echo "| Release asset | SHA-256 |" + echo "| --- | --- |" + while IFS=$'\t' read -r name digest; do + printf '| %s | %s |\n' "$name" "$digest" + done < <(jq -r '.assets[] | [.name, .sha256] | @tsv' release-bundle/release-manifest.json) + while IFS= read -r name; do + printf '| %s | Intentionally absent from SHA256SUMS (manually replaceable) |\n' "$name" + done < <(jq -r '.macos_signing.replaceable_assets[]?' release-bundle/release-manifest.json) + } >> "$GITHUB_STEP_SUMMARY" + - name: Upload publication bundle uses: actions/upload-artifact@v7 with: name: release-bundle-${{ needs.prepare.outputs.version }} @@ -261,7 +324,7 @@ jobs: needs: [prepare, assemble] runs-on: ubuntu-latest timeout-minutes: 20 - environment: public-release + environment: ${{ needs.prepare.outputs.release_channel == 'BETA' && 'beta-release' || 'public-release' }} permissions: actions: read contents: write @@ -276,6 +339,7 @@ jobs: - name: Recheck bundle and immutable public tag env: VERSION: ${{ needs.prepare.outputs.version }} + CHANNEL: ${{ needs.prepare.outputs.release_channel }} MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} WINDOWS_MODE: ${{ needs.prepare.outputs.windows_signing }} run: | @@ -286,7 +350,9 @@ jobs: test "$(jq -r .commit release-bundle/release-manifest.json)" = "$GITHUB_SHA" test "$(jq -r '.assets | length' release-bundle/release-manifest.json)" -gt 0 EXPECTED_MACOS_MODE=distribution - if [ "$MACOS_MODE" = validation ]; then + if [ "$CHANNEL" = BETA ]; then + EXPECTED_MACOS_MODE=unsigned + elif [ "$MACOS_MODE" = validation ]; then EXPECTED_MACOS_MODE=manual fi test "$(jq -r .macos_signing.mode release-bundle/release-manifest.json)" = "$EXPECTED_MACOS_MODE" @@ -302,11 +368,20 @@ jobs: GH_TOKEN: ${{ github.token }} VERSION: ${{ needs.prepare.outputs.version }} CHANNEL: ${{ needs.prepare.outputs.release_channel }} - MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} run: | set -euo pipefail mapfile -t FILES < <(find release-bundle -maxdepth 1 -type f -print | sort) mapfile -t EXPECTED_NAMES < <(printf '%s\n' "${FILES[@]}" | xargs -n1 basename | sort) + mapfile -t REPLACEABLE_NAMES < <(jq -r '.macos_signing.replaceable_assets[]' release-bundle/release-manifest.json) + LINE_POLICY=$(python3 .github/scripts/release-policy.py \ + public-release-line "$VERSION" --remote origin) + GA_RELEASE_IS_LATEST=$(jq -r .ga_release_is_latest <<<"$LINE_POLICY") + LATEST=false + if [ "$CHANNEL" = GA ] && [ "$GA_RELEASE_IS_LATEST" = true ]; then + LATEST=true + fi + echo "Public GA line $(jq -r .candidate_line <<<"$LINE_POLICY"); newest GA line is $(jq -r .newest_ga_line <<<"$LINE_POLICY")." + echo "GitHub Latest designation for a newly created release: $LATEST" CREATED=false if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then RELEASE=$(gh release view "$GITHUB_REF_NAME" --json isDraft,isPrerelease,assets) @@ -315,7 +390,7 @@ jobs: exit 1 fi EXPECTED_PRERELEASE=false - if [ "$CHANNEL" = RC ]; then + if [ "$CHANNEL" != GA ]; then EXPECTED_PRERELEASE=true fi if [ "$(jq -r .isPrerelease <<<"$RELEASE")" != "$EXPECTED_PRERELEASE" ]; then @@ -335,7 +410,7 @@ jobs: MISSING=() for file in "${FILES[@]}"; do name=$(basename "$file") - if [ "$MACOS_MODE" = validation ] && [[ "$name" == wsjtx-*-macOS.pkg ]]; then + if printf '%s\n' "${REPLACEABLE_NAMES[@]}" | grep -Fxq "$name"; then if printf '%s\n' "${ACTUAL_NAMES[@]}" | grep -Fxq "$name"; then echo "Preserving manually replaceable macOS asset: $name" else @@ -365,9 +440,10 @@ jobs: echo "Existing assets satisfy the publication bundle policy." else FLAGS=() - if [ "$CHANNEL" = RC ]; then + if [ "$CHANNEL" != GA ]; then FLAGS+=(--prerelease) fi + FLAGS+=("--latest=$LATEST") gh release create "$GITHUB_REF_NAME" \ --verify-tag \ --title "WSJT-X $VERSION" \ diff --git a/.github/workflows/publish-linux-ci-images.yml b/.github/workflows/publish-linux-ci-images.yml index e1bc4c30..8a38c5c4 100644 --- a/.github/workflows/publish-linux-ci-images.yml +++ b/.github/workflows/publish-linux-ci-images.yml @@ -151,8 +151,8 @@ jobs: echo "::error::Public release images may only be published by WSJTX/wsjtx" exit 2 fi - if [[ ! "$REQUEST_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-rc[1-9][0-9]*)?$ ]]; then - echo "::error::Public release images require an exact vX.Y.Z or vX.Y.Z-rcN tag" + if [[ ! "$REQUEST_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-(beta|rc)[1-9][0-9]*)?$ ]]; then + echo "::error::Public release images require an exact vX.Y.Z, vX.Y.Z-betaN, or vX.Y.Z-rcN tag" exit 2 fi if [ "$MODE" != refresh ] || [ "$PROMOTE" != false ] || \ @@ -224,7 +224,7 @@ jobs: echo "package_root=ghcr.io/wsjtx/wsjtx" echo "normal_cache_from=type=gha,scope=public-release-linux-noble" echo "arm64_cache_from=type=gha,scope=public-release-linux-arm64-bookworm" - echo "armhf_cross_cache_from=type=gha,scope=public-release-linux-armhf-cross-bookworm" + echo "armhf_cross_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx/linux-armhf-cross-bookworm:buildcache" echo "armhf_cache_from=type=gha,scope=public-release-linux-armv7-bookworm" else echo "build_tag=build-${date_tag}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" @@ -232,7 +232,7 @@ jobs: echo "package_root=ghcr.io/wsjtx/wsjtx-internal" echo "normal_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-noble:stable" echo "arm64_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-arm64-bookworm:stable" - echo "armhf_cross_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-armhf-cross-bookworm:stable" + echo "armhf_cross_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-armhf-cross-bookworm:buildcache" echo "armhf_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-armv7-bookworm:stable" fi echo "created=$created" @@ -411,7 +411,7 @@ jobs: IMAGE_RECIPE_SHA256=${{ needs.metadata.outputs.armhf_cross_recipe }} IMAGE_REFRESH_EPOCH=${{ needs.metadata.outputs.refresh_epoch }} cache-from: ${{ needs.metadata.outputs.armhf_cross_cache_from }} - cache-to: type=inline + cache-to: type=registry,ref=${{ needs.metadata.outputs.package_root }}/linux-armhf-cross-bookworm:buildcache,mode=max,oci-mediatypes=true,image-manifest=true build-armhf-runtime: if: >- @@ -580,6 +580,59 @@ jobs: ghcr.io/wsjtx/wsjtx-internal/linux-noble@${{ needs.build-normal.outputs.digest }} fi + warm-asan-ubsan-ccache: + if: >- + !cancelled() && needs.promote.result == 'success' && + github.ref == 'refs/heads/develop' && + inputs.publication_target == 'internal' && + inputs.mode == 'refresh' && inputs.promote && + (inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan') + needs: + - metadata + - promote + uses: ./.github/workflows/build-linux-sanitizers.yml + permissions: + contents: read + packages: read + concurrency: + group: asan-ubsan-ccache-develop + cancel-in-progress: false + with: + hamlib_branch: ${{ needs.metadata.outputs.normal_hamlib_ref }} + sanitizer: asan-ubsan + image_tag: ${{ needs.metadata.outputs.build_tag }} + run_tests: false + allow_stale_image: false + recache: false + save_ccache: true + + warm-armhf-ccache: + if: >- + !cancelled() && needs.promote.result == 'success' && + github.ref == 'refs/heads/develop' && + inputs.publication_target == 'internal' && + inputs.mode == 'refresh' && inputs.promote && inputs.include_armhf && + (inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan') + needs: + - metadata + - promote + uses: ./.github/workflows/build-linux.yml + permissions: + contents: read + packages: read + concurrency: + group: armhf-ccache-develop + cancel-in-progress: false + with: + version: ${{ needs.metadata.outputs.version }} + hamlib_branch: ${{ needs.metadata.outputs.normal_hamlib_ref }} + arch: armhf + image_tag: ${{ needs.metadata.outputs.build_tag }} + armhf_build_only: true + allow_stale_image: false + recache: false + save_ccache: true + rollback: if: inputs.mode == 'rollback' needs: validate-inputs diff --git a/.github/workflows/release-tag-helper.yml b/.github/workflows/release-tag-helper.yml index c8cc375e..4ccfdb72 100644 --- a/.github/workflows/release-tag-helper.yml +++ b/.github/workflows/release-tag-helper.yml @@ -1,10 +1,11 @@ name: Prepare Release Candidate +run-name: Prepare Release Candidate build/v${{ inputs.version }} (${{ inputs.operation }}) on: workflow_dispatch: inputs: version: - description: "Version without v (X.Y.Z or X.Y.Z-rcN)" + description: "Version without v (X.Y.Z, X.Y.Z-betaN, or X.Y.Z-rcN)" required: true type: string expected_sha: @@ -60,6 +61,8 @@ jobs: fi git checkout --detach "$EXPECTED_SHA" python3 .github/scripts/release-policy.py validate-source "$VERSION" + python3 .github/scripts/release-linux-images.py validate \ + release-linux-images.json --check-remote CI_RUN=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs?head_sha=$EXPECTED_SHA&status=completed&per_page=20" \ --jq '.workflow_runs | sort_by(.created_at) | reverse | .[0]') diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bde30629..b98a5ac7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: candidate_tag: - description: "Immutable internal tag (build/vX.Y.Z or build/vX.Y.Z-rcN)" + description: "Immutable internal tag (build/vX.Y.Z, build/vX.Y.Z-betaN, or build/vX.Y.Z-rcN)" required: true type: string expected_sha: @@ -26,11 +26,12 @@ jobs: timeout-minutes: 10 outputs: version: ${{ steps.identity.outputs.version }} - release_channel: ${{ steps.identity.outputs.channel }} - rc_number: ${{ steps.identity.outputs.rc_number }} windows_signing: ${{ steps.identity.outputs.windows_signing }} - linux_image_tag: ${{ steps.linux-image.outputs.image_tag }} - armhf_image_tag: ${{ steps.armhf-image.outputs.image_tag }} + image_tag: ${{ steps.linux-images.outputs.image_tag }} + x86_64_digest: ${{ steps.linux-images.outputs.x86_64_digest }} + aarch64_digest: ${{ steps.linux-images.outputs.aarch64_digest }} + armhf_digest: ${{ steps.linux-images.outputs.armhf_digest }} + armhf_cross_digest: ${{ steps.linux-images.outputs.armhf_cross_digest }} env: CANDIDATE_TAG: ${{ inputs.candidate_tag }} EXPECTED_SHA: ${{ inputs.expected_sha }} @@ -44,7 +45,7 @@ jobs: run: | set -euo pipefail if [[ ! "$CANDIDATE_TAG" =~ ^build/v(.+)$ ]]; then - echo "::error::Expected build/vX.Y.Z or build/vX.Y.Z-rcN, got $CANDIDATE_TAG" + echo "::error::Expected build/vX.Y.Z, build/vX.Y.Z-betaN, or build/vX.Y.Z-rcN, got $CANDIDATE_TAG" exit 1 fi ACTUAL_SHA=$(git rev-parse HEAD) @@ -56,21 +57,13 @@ jobs: IDENTITY=$(python3 .github/scripts/release-policy.py validate-source "$VERSION") { echo "version=$(jq -r .version <<<"$IDENTITY")" - echo "channel=$(jq -r .channel <<<"$IDENTITY")" - echo "rc_number=$(jq -r .rc_number <<<"$IDENTITY")" echo "windows_signing=$(jq -r .windows_signing <<<"$IDENTITY")" } >> "$GITHUB_OUTPUT" - - id: linux-image - name: Resolve Linux CI image generation - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: .github/scripts/resolve-linux-ci-image-tag.py - - id: armhf-image - name: Resolve armhf CI image generation - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - RESOLVE_ARMHF: true - run: .github/scripts/resolve-linux-ci-image-tag.py + - name: Validate prepared Linux images + id: linux-images + run: | + python3 .github/scripts/release-linux-images.py validate release-linux-images.json \ + --check-remote --github-output "$GITHUB_OUTPUT" macos: needs: prepare @@ -81,8 +74,6 @@ jobs: arch: arm64 runner: macos-15 deployment_target: "11.0" - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} signing_mode: validation macos-intel: @@ -94,8 +85,6 @@ jobs: arch: x86_64 runner: macos-15-intel deployment_target: "10.13" - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} signing_mode: validation linux: @@ -105,11 +94,11 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.2" arch: x86_64 - image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + image_digest: ${{ needs.prepare.outputs.x86_64_digest }} + image_source: public-release + image_tag: ${{ needs.prepare.outputs.image_tag }} save_ccache: true build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} linux-arm: needs: prepare @@ -118,14 +107,14 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.2" arch: aarch64 - image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + image_digest: ${{ needs.prepare.outputs.aarch64_digest }} + image_source: public-release + image_tag: ${{ needs.prepare.outputs.image_tag }} save_ccache: true build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} # Cross-compile on x86_64, then run target tests, packaging, and AppImage - # validation in the paired ARMv7 runtime image under QEMU. + # validation in the paired ARMv7 runtime image on an ARM runner. linux-armhf: needs: prepare uses: ./.github/workflows/build-linux.yml @@ -133,12 +122,12 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.2" arch: armhf - image_tag: ${{ needs.prepare.outputs.armhf_image_tag }} - allow_stale_image: true + image_source: public-release + image_tag: ${{ needs.prepare.outputs.image_tag }} + image_digest: ${{ needs.prepare.outputs.armhf_digest }} + armhf_cross_image_digest: ${{ needs.prepare.outputs.armhf_cross_digest }} save_ccache: true build_packages: true - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} windows: needs: prepare @@ -146,8 +135,6 @@ jobs: with: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.2" - release_channel: ${{ needs.prepare.outputs.release_channel }} - rc_number: ${{ needs.prepare.outputs.rc_number }} candidate-ready: needs: [prepare, macos, macos-intel, linux, linux-arm, linux-armhf, windows] @@ -158,6 +145,9 @@ jobs: - uses: actions/download-artifact@v8 with: path: artifacts + # build-linux.yml hands this tree between its ARMHF jobs; it is no asset. + - name: Drop the ARMHF build tree + run: rm -rf artifacts/armhf-build-tree - name: Verify all candidate artifacts run: python3 .github/scripts/release-policy.py verify-assets "${{ needs.prepare.outputs.version }}" artifacts - name: Verify candidate packaging reports @@ -180,7 +170,8 @@ jobs: --arg repository "$GITHUB_REPOSITORY" \ --arg run_id "$GITHUB_RUN_ID" \ --arg windows_release_mode "$WINDOWS_RELEASE_MODE" \ - '{schema: 1, version: $version, tag: $tag, commit: $commit, repository: $repository, workflow_run: $run_id, windows_release_signing: $windows_release_mode, candidate_signing: {windows: "unsigned", macos: "validation"}}' \ + --argjson linux_images "$(python3 .github/scripts/release-linux-images.py provenance release-linux-images.json)" \ + '{schema: 1, version: $version, tag: $tag, commit: $commit, repository: $repository, workflow_run: $run_id, linux_images: $linux_images, windows_release_signing: $windows_release_mode, candidate_signing: {windows: "unsigned", macos: "validation"}}' \ > artifacts/candidate-provenance.json - name: Upload complete candidate uses: actions/upload-artifact@v7 diff --git a/.github/workflows/sign-windows-release.yml b/.github/workflows/sign-windows-release.yml index a040ab43..5d1b26a4 100644 --- a/.github/workflows/sign-windows-release.yml +++ b/.github/workflows/sign-windows-release.yml @@ -9,7 +9,7 @@ on: release_channel: required: true type: string - rc_number: + prerelease_number: required: false type: string default: "" @@ -27,8 +27,6 @@ jobs: with: version: ${{ inputs.version }} hamlib_branch: "4.7.2" - release_channel: ${{ inputs.release_channel }} - rc_number: ${{ inputs.rc_number }} sign: if: inputs.windows_signing != 'unsigned' @@ -45,12 +43,13 @@ jobs: env: VERSION: ${{ inputs.version }} CHANNEL: ${{ inputs.release_channel }} - RC_NUMBER: ${{ inputs.rc_number }} + PRERELEASE_NUMBER: ${{ inputs.prerelease_number }} run: | set -euo pipefail IDENTITY=$(python3 .github/scripts/release-policy.py classify "$VERSION") test "$(jq -r .channel <<<"$IDENTITY")" = "$CHANNEL" - test "$(jq -r .rc_number <<<"$IDENTITY")" = "$RC_NUMBER" + test "$(jq -r .prerelease_number <<<"$IDENTITY")" = "$PRERELEASE_NUMBER" + test "$CHANNEL" = RC || test "$CHANNEL" = GA test "$GITHUB_REPOSITORY" = WSJTX/wsjtx - name: Submit release signing request to SignPath id: signpath diff --git a/.github/workflows/warm-dependency-caches.yml b/.github/workflows/warm-dependency-caches.yml index db9f6593..9c38a1a7 100644 --- a/.github/workflows/warm-dependency-caches.yml +++ b/.github/workflows/warm-dependency-caches.yml @@ -7,8 +7,15 @@ on: - ".github/workflows/ci.yml" - ".github/workflows/release.yml" - ".github/workflows/build-linux.yml" + - ".github/workflows/build-linux-sanitizers.yml" - ".github/workflows/warm-dependency-caches.yml" - ".github/actions/build-linux-payload/**" + - ".github/actions/build-linux-sanitizers/**" + - ".github/scripts/verify-sanitizer-instrumentation.py" + - "CMakeLists.txt" + - "CMake/**" + - "tests/CMakeLists.txt" + - "tests/**/CMakeLists.txt" - ".github/images/linux-ci/**" - ".github/scripts/linux-ci-image-config.sh" - ".github/scripts/linux-ci-image-fingerprint.sh" @@ -32,6 +39,8 @@ on: - ".github/scripts/build-*-macos.sh" - ".github/scripts/build-*-windows.sh" - ".github/scripts/*armhf*" + - ".github/cmake/armhf-toolchain.cmake" + - ".github/scripts/linux-artifact-validation.sh" - ".github/scripts/install-*-macos*.sh" - ".github/scripts/macos-qt-cache-key.sh" - ".github/scripts/verify-macos-*.sh" @@ -51,6 +60,8 @@ on: - windows - linux - linux-arm64 + - linux-armhf + - linux-asan-ubsan - linux-tsan - linux-images - linux-retention @@ -79,6 +90,8 @@ jobs: outputs: linux_images: ${{ steps.detect.outputs.linux_images }} linux_arm64: ${{ steps.detect.outputs.linux_arm64 }} + linux_armhf: ${{ steps.detect.outputs.linux_armhf }} + linux_asan_ubsan: ${{ steps.detect.outputs.linux_asan_ubsan }} retention: ${{ steps.detect.outputs.retention }} windows: ${{ steps.detect.outputs.windows }} macos_arm64: ${{ steps.detect.outputs.macos_arm64 }} @@ -109,12 +122,16 @@ jobs: tsan_images=false retention=false linux_arm64=false + linux_armhf=false + linux_asan_ubsan=false windows=false macos_arm64=false macos_x86_64=false enable_cache_all() { linux_arm64=true + linux_armhf=true + linux_asan_ubsan=true windows=true macos_arm64=true macos_x86_64=true @@ -150,6 +167,12 @@ jobs: linux-arm64) linux_arm64=true ;; + linux-armhf) + linux_armhf=true + ;; + linux-asan-ubsan) + linux_asan_ubsan=true + ;; linux-tsan) tsan_images=true ;; @@ -203,6 +226,17 @@ jobs: ;; .github/workflows/build-linux.yml|.github/actions/build-linux-payload/*|.github/scripts/select-linux-ccache-save.sh) linux_arm64=true + linux_armhf=true + ;; + .github/scripts/build-linux-armhf-cross.sh|.github/scripts/audit-armhf-cross-build.sh|.github/cmake/armhf-toolchain.cmake|.github/scripts/linux-artifact-validation.sh) + linux_armhf=true + ;; + CMakeLists.txt|CMake/*|tests/CMakeLists.txt|tests/*/CMakeLists.txt) + linux_armhf=true + linux_asan_ubsan=true + ;; + .github/workflows/build-linux-sanitizers.yml|.github/actions/build-linux-sanitizers/*|.github/scripts/verify-sanitizer-instrumentation.py) + linux_asan_ubsan=true ;; .github/workflows/build-windows.yml|.github/actions/build-windows-deps/*|.github/scripts/build-boost-windows.sh|.github/scripts/build-pfunit-windows.sh|.github/scripts/build-hamlib-windows.sh) windows=true @@ -257,6 +291,8 @@ jobs: { echo "linux_images=$linux_images" echo "linux_arm64=$linux_arm64" + echo "linux_armhf=$linux_armhf" + echo "linux_asan_ubsan=$linux_asan_ubsan" echo "retention=$retention" echo "windows=$windows" echo "macos_arm64=$macos_arm64" @@ -273,12 +309,16 @@ jobs: echo "| --- | --- |" echo "| Linux GHCR image set | $image_set |" echo "| Linux arm64 ccache | $linux_arm64 |" + echo "| Linux ARMHF ccache (standalone) | $linux_armhf |" + echo "| Linux ASan/UBSan ccache (standalone) | $linux_asan_ubsan |" echo "| Linux GHCR retention | $retention |" echo "| Windows x86_64 | $windows |" echo "| macOS arm64 | $macos_arm64 |" echo "| macOS x86_64 | $macos_x86_64 |" } >> "$GITHUB_STEP_SUMMARY" + echo "Normal image refreshes warm ARMHF and ASan/UBSan after promotion instead of running the standalone warmers." >> "$GITHUB_STEP_SUMMARY" + refresh-linux-images: needs: detect if: needs.detect.outputs.linux_images == 'true' @@ -348,6 +388,51 @@ jobs: arch: aarch64 save_ccache: true + warm-linux-armhf-ccache: + needs: detect + if: >- + github.ref == 'refs/heads/develop' && + needs.detect.outputs.linux_armhf == 'true' && + needs.detect.outputs.image_set != 'normal' && + needs.detect.outputs.image_set != 'normal-and-tsan' + uses: ./.github/workflows/build-linux.yml + permissions: + contents: read + packages: read + concurrency: + group: armhf-ccache-develop + cancel-in-progress: false + with: + version: ${{ needs.detect.outputs.version }} + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + arch: armhf + armhf_build_only: true + allow_stale_image: false + recache: false + save_ccache: true + + warm-linux-asan-ubsan-ccache: + needs: detect + if: >- + github.ref == 'refs/heads/develop' && + needs.detect.outputs.linux_asan_ubsan == 'true' && + needs.detect.outputs.image_set != 'normal' && + needs.detect.outputs.image_set != 'normal-and-tsan' + uses: ./.github/workflows/build-linux-sanitizers.yml + permissions: + contents: read + packages: read + concurrency: + group: asan-ubsan-ccache-develop + cancel-in-progress: false + with: + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + sanitizer: asan-ubsan + run_tests: false + allow_stale_image: false + recache: false + save_ccache: true + warm-windows-x86_64-deps: needs: detect if: needs.detect.outputs.windows == 'true' @@ -441,3 +526,37 @@ jobs: runner: macos-15-intel deployment_target: "10.13" save_ccache: true + + summary: + if: always() + needs: + - detect + - refresh-linux-images + - retain-linux-images + - warm-linux-arm64-ccache + - warm-linux-armhf-ccache + - warm-linux-asan-ubsan-ccache + - warm-windows-x86_64-deps + - warm-windows-ccache + - warm-macos-arm64-deps + - warm-macos-x86_64-deps + - warm-macos-arm64-ccache + - warm-macos-x86_64-ccache + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Summarize cache warmer outcomes + env: + JOBS: ${{ toJSON(needs) }} + run: | + python3 - <<'PY' >> "$GITHUB_STEP_SUMMARY" + import json + import os + + print("## Cache warmer outcomes\n") + print("| Job | Result |") + print("| --- | --- |") + for name, job in json.loads(os.environ["JOBS"]).items(): + print(f"| {name} | {job['result']} |") + print("\nSkipped jobs did not validate their caches. See each job's cache summary for restore and build details.") + PY |
