diff options
| author | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-09-26 23:24:03 +0200 |
| commit | 059831534c7e884f0a607ed86b582fd00d821731 (patch) | |
| tree | 76bcb67a78f8aa2654fd34c2ad801a62136b0170 /.github/workflows | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/build-linux-sanitizers.yml | 93 | ||||
| -rw-r--r-- | .github/workflows/build-linux.yml | 769 | ||||
| -rw-r--r-- | .github/workflows/build-macos.yml | 1540 | ||||
| -rw-r--r-- | .github/workflows/build-selected-artifacts.yml | 181 | ||||
| -rw-r--r-- | .github/workflows/build-windows.yml | 348 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 248 | ||||
| -rw-r--r-- | .github/workflows/hamlib-upstream-check.yml | 15 | ||||
| -rw-r--r-- | .github/workflows/prepare-macos-qt.yml | 73 | ||||
| -rw-r--r-- | .github/workflows/promote-release.yml | 190 | ||||
| -rw-r--r-- | .github/workflows/public-release.yml | 389 | ||||
| -rw-r--r-- | .github/workflows/publish-linux-ci-images.yml | 632 | ||||
| -rw-r--r-- | .github/workflows/release-tag-helper.yml | 126 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 428 | ||||
| -rw-r--r-- | .github/workflows/sign-windows-release.yml | 142 | ||||
| -rw-r--r-- | .github/workflows/signpath-smoke.yml | 74 | ||||
| -rw-r--r-- | .github/workflows/warm-dependency-caches.yml | 443 |
16 files changed, 4156 insertions, 1535 deletions
diff --git a/.github/workflows/build-linux-sanitizers.yml b/.github/workflows/build-linux-sanitizers.yml new file mode 100644 index 00000000..1db5293e --- /dev/null +++ b/.github/workflows/build-linux-sanitizers.yml @@ -0,0 +1,93 @@ +name: Build Linux Sanitizers + +on: + workflow_call: + inputs: + hamlib_branch: + description: "Hamlib version baked into the CI image" + required: false + type: string + default: "4.7.2" + sanitizer: + description: "Sanitizer mode: asan-ubsan or tsan" + required: true + type: string + image_tag: + description: "Immutable GHCR image tag; empty resolves the current validated generation" + required: false + type: string + default: "" + recache: + description: "Force ccache to recompile" + required: false + type: boolean + default: false + save_ccache: + description: "Save compiled objects for trusted builds" + required: false + type: boolean + default: false + advisory: + description: "Allow sanitizer failures without failing the caller" + required: false + type: boolean + default: false + allow_stale_image: + description: "Allow a previously promoted image when a dependency refresh changed the recipe" + required: false + type: boolean + default: false + +permissions: + contents: read + packages: read + +jobs: + resolve-image: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + outputs: + image_tag: ${{ steps.resolve.outputs.image_tag }} + steps: + - uses: actions/checkout@v7 + - id: resolve + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REQUESTED_TAG: ${{ inputs.image_tag }} + RESOLVE_TSAN: ${{ inputs.sanitizer == 'tsan' }} + shell: bash + run: | + if [ -n "$REQUESTED_TAG" ]; then + IMAGE_TAG="$REQUESTED_TAG" .github/scripts/validate-ci-inputs.sh + echo "image_tag=$REQUESTED_TAG" >> "$GITHUB_OUTPUT" + elif [ "$RESOLVE_TSAN" = true ]; then + RESOLVE_TSAN=true .github/scripts/resolve-linux-ci-image-tag.py + else + .github/scripts/resolve-linux-ci-image-tag.py + fi + + build: + 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 }} + 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) }} + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v7 + - name: Validate workflow inputs + env: + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} + run: .github/scripts/validate-ci-inputs.sh + - uses: ./.github/actions/build-linux-sanitizers + with: + hamlib_branch: ${{ inputs.hamlib_branch }} + sanitizer: ${{ inputs.sanitizer }} + recache: ${{ inputs.recache }} + save_ccache: ${{ inputs.save_ccache }} + allow_stale_image: ${{ inputs.allow_stale_image }} diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 10c44630..8535f8b3 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -11,12 +11,57 @@ on: description: "Hamlib branch to build" required: false type: string - default: "4.7.0" + default: "4.7.2" arch: - description: "Linux target architecture: x86_64 or aarch64" + description: "Linux target architecture: x86_64, aarch64, or armhf" required: false type: string default: "x86_64" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + image_tag: + description: "Immutable GHCR image tag; empty resolves the current validated generation" + required: false + type: string + default: "" + image_source: + description: "Builder image source: internal or public-release" + required: false + type: string + default: "internal" + image_digest: + description: "Required sha256 digest for a public-release builder image" + required: false + type: string + default: "" + armhf_cross_image_digest: + description: "Required sha256 digest for the public-release ARMHF cross-builder" + required: false + type: string + default: "" + allow_stale_image: + description: "Allow a previously promoted image when a dependency refresh changed the recipe" + required: false + type: boolean + default: false + save_ccache: + description: "Save compiled objects for trusted builds" + required: false + type: boolean + default: false + validate_fortran_fallback: + description: "Build the x86_64 non-OpenMP common-library sentinel graph" + required: false + type: boolean + default: false + build_packages: + description: "Build, validate, and upload Linux packages and executable artifacts" + required: false + type: boolean + default: true release_channel: description: "Build release channel: DEVEL, RC, or GA" required: false @@ -27,289 +72,525 @@ on: required: false type: string default: "" + # 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 + # must be merged before it can be dispatched. This entry point supports focused + # 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=...`. + workflow_dispatch: + inputs: + version: + description: "WSJT-X version string (artifact + package names)" + required: false + type: string + default: "3.2.0-devel" + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.2" + arch: + description: "Linux target architecture" + required: false + type: choice + options: + - x86_64 + - aarch64 + - armhf + default: "x86_64" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + image_tag: + description: "Immutable GHCR image tag; empty resolves the current validated generation" + required: false + type: string + default: "" + image_source: + description: "Builder image source" + required: false + type: choice + options: + - internal + - public-release + default: internal + image_digest: + description: "sha256 digest required with public-release image source" + required: false + type: string + default: "" + armhf_cross_image_digest: + description: "sha256 digest required for the public-release ARMHF cross-builder" + required: false + type: string + default: "" + allow_stale_image: + description: "Allow a previously promoted image when a dependency refresh changed the recipe" + required: false + type: boolean + default: false + save_ccache: + description: "Save compiled objects" + required: false + type: boolean + default: false + validate_fortran_fallback: + description: "Build the x86_64 non-OpenMP common-library sentinel graph" + required: false + type: boolean + default: false + build_packages: + description: "Build, validate, and upload Linux packages and executable artifacts" + required: false + type: boolean + default: true + release_channel: + description: "Build release channel" + required: false + type: choice + options: + - DEVEL + - RC + - GA + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" + +# Architecture jobs are gated on `inputs.arch`. Each call from ci.yml / +# release.yml passes a single target, so exactly one build job runs per call. +# Splitting on arch +# keeps the per-arch runtime profile explicit at the job level: +# +# x86_64 — validated Noble container on ubuntu-24.04. +# 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. +# +# The native jobs use the build-linux-payload composite action. ARMHF needs +# separate host-build and target-runtime phases, but shares their artifact +# validators and external artifact contracts. + +permissions: + contents: read + packages: read jobs: - build: - runs-on: ${{ inputs.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} + resolve-image: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + outputs: + image_tag: ${{ steps.resolve.outputs.image_tag }} + image_reference: ${{ steps.resolve.outputs.image_reference }} + cross_image_reference: ${{ steps.resolve.outputs.cross_image_reference }} steps: - - uses: actions/checkout@v6 - - - name: Install dependencies + - uses: actions/checkout@v7 + - id: resolve + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REQUESTED_TAG: ${{ inputs.image_tag }} + ARMHF_BUILD: ${{ inputs.arch == 'armhf' }} + ARCH: ${{ inputs.arch }} + IMAGE_SOURCE: ${{ inputs.image_source }} + IMAGE_DIGEST: ${{ inputs.image_digest }} + ARMHF_CROSS_IMAGE_DIGEST: ${{ inputs.armhf_cross_image_digest }} + REQUEST_REPOSITORY: ${{ github.repository }} + shell: bash run: | - sudo apt-get update - sudo apt-get install -y \ - build-essential cmake gfortran \ - libfftw3-dev libboost-all-dev \ - qtbase5-dev qttools5-dev qtmultimedia5-dev libqt5serialport5-dev \ - libqt5sql5-sqlite libqt5websockets5-dev \ - libqt5multimedia5-plugins \ - libusb-1.0-0-dev libudev-dev libreadline-dev portaudio19-dev \ - autoconf automake libtool pkg-config \ - texinfo \ - dpkg-dev fakeroot \ - asciidoctor \ - rpm + case "$ARCH" in + x86_64) package=linux-noble; cross_package= ;; + aarch64) package=linux-arm64-bookworm; cross_package= ;; + armhf) package=linux-armv7-bookworm; cross_package=linux-armhf-cross-bookworm ;; + *) + echo "::error::Unsupported Linux architecture: $ARCH" + exit 2 + ;; + esac - - name: Cache pFUnit - id: pfunit-cache - uses: actions/cache@v5 - with: - path: pfunit-prefix - key: pfunit-linux-${{ inputs.arch }}-v4.9.0-${{ hashFiles('.github/workflows/build-linux.yml') }} + case "$IMAGE_SOURCE" in + internal) + if [ -n "$IMAGE_DIGEST" ] || [ -n "$ARMHF_CROSS_IMAGE_DIGEST" ]; then + echo "::error::image digests are valid only for public-release images" + exit 2 + fi + 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" + exit 2 + fi + if [[ ! "$IMAGE_DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::public-release images require an immutable sha256 digest" + exit 2 + fi + if [ "$ARCH" = armhf ]; then + if [[ ! "$ARMHF_CROSS_IMAGE_DIGEST" =~ ^sha256:[0-9a-f]{64}$ ]]; then + echo "::error::public-release ARMHF builds require an immutable cross-builder sha256 digest" + exit 2 + fi + elif [ -n "$ARMHF_CROSS_IMAGE_DIGEST" ]; then + echo "::error::armhf_cross_image_digest is valid only for ARMHF builds" + exit 2 + fi + if [ -z "$REQUESTED_TAG" ]; then + echo "::error::public-release images require their release-specific image_tag" + exit 2 + fi + package_root=ghcr.io/wsjtx/wsjtx + ;; + *) + echo "::error::Unsupported image_source: $IMAGE_SOURCE" + exit 2 + ;; + esac - - name: Build pFUnit - if: steps.pfunit-cache.outputs.cache-hit != 'true' - run: | - git clone --depth 1 --branch v4.9.0 --recursive \ - https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src - cmake -S pfunit-src -B pfunit-build \ - -DSKIP_MPI=YES \ - -DSKIP_OPENMP=YES \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/pfunit-prefix" - cmake --build pfunit-build -j$(nproc) - cmake --install pfunit-build + if [ -n "$REQUESTED_TAG" ]; then + IMAGE_TAG="$REQUESTED_TAG" .github/scripts/validate-ci-inputs.sh + echo "image_tag=$REQUESTED_TAG" >> "$GITHUB_OUTPUT" + elif [ "$ARMHF_BUILD" = true ]; then + RESOLVE_ARMHF=true .github/scripts/resolve-linux-ci-image-tag.py + else + .github/scripts/resolve-linux-ci-image-tag.py + fi - - name: Locate pFUnit config - id: pfunit - run: | - CONFIG=$(find "${GITHUB_WORKSPACE}/pfunit-prefix" -name PFUNITConfig.cmake | head -1) - if [ -z "$CONFIG" ]; then - echo "ERROR: PFUNITConfig.cmake not found under pfunit-prefix" - find "${GITHUB_WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d - exit 1 + if [ "$IMAGE_SOURCE" = public-release ]; then + echo "image_reference=${package_root}/${package}@${IMAGE_DIGEST}" >> "$GITHUB_OUTPUT" + if [ "$ARCH" = armhf ]; then + echo "cross_image_reference=${package_root}/${cross_package}@${ARMHF_CROSS_IMAGE_DIGEST}" >> "$GITHUB_OUTPUT" + fi + else + image_tag="$(awk -F= '$1 == "image_tag" { print $2 }' "$GITHUB_OUTPUT" | tail -n 1)" + echo "image_reference=${package_root}/${package}:${image_tag}" >> "$GITHUB_OUTPUT" + if [ "$ARCH" = armhf ]; then + echo "cross_image_reference=${package_root}/${cross_package}:${image_tag}" >> "$GITHUB_OUTPUT" + fi fi - PFUNIT_DIR="$(dirname "$CONFIG")" - echo "Found PFUNITConfig.cmake at: $CONFIG" - echo "dir=${PFUNIT_DIR}" >> "$GITHUB_OUTPUT" - - name: Cache Hamlib - id: hamlib-cache - uses: actions/cache@v5 + build-x86_64: + needs: resolve-image + if: inputs.arch == 'x86_64' + runs-on: ubuntu-24.04 + timeout-minutes: 65 + container: + image: ${{ needs.resolve-image.outputs.image_reference }} + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v7 + - name: Validate workflow inputs + env: + WSJTX_VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_RC_NUMBER: ${{ inputs.rc_number }} + ARCH: ${{ inputs.arch }} + IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} + VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} + run: .github/scripts/validate-ci-inputs.sh + - uses: ./.github/actions/build-linux-payload with: - path: hamlib-prefix - key: hamlib-linux-${{ inputs.arch }}-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-linux.yml') }} + arch: x86_64 + version: ${{ inputs.version }} + hamlib_branch: ${{ inputs.hamlib_branch }} + runtime_base: host + recache: ${{ inputs.recache }} + save_ccache: ${{ inputs.save_ccache }} + validate_fortran_fallback: ${{ inputs.validate_fortran_fallback }} + build_packages: ${{ inputs.build_packages }} + release_channel: ${{ inputs.release_channel }} + rc_number: ${{ inputs.rc_number }} + allow_stale_image: ${{ inputs.allow_stale_image }} - - name: Build Hamlib - if: steps.hamlib-cache.outputs.cache-hit != 'true' - run: | - git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ - https://github.com/Hamlib/Hamlib.git hamlib-src - cd hamlib-src - ./bootstrap - ./configure \ - --prefix="${GITHUB_WORKSPACE}/hamlib-prefix" \ - --disable-shared --enable-static \ - --without-cxx-binding \ - CFLAGS="-g -O2 -fPIC -fdata-sections -ffunction-sections" \ - LDFLAGS="-Wl,--gc-sections" - make -j$(nproc) - make install + build-aarch64: + needs: resolve-image + if: inputs.arch == 'aarch64' + runs-on: ubuntu-24.04-arm + timeout-minutes: 45 + # The official GCC image adds GCC 13.4 without moving off the Bookworm + # glibc 2.36 and pre-t64 runtime baseline (issue #49). + container: + image: ${{ needs.resolve-image.outputs.image_reference }} + credentials: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v7 + - name: Validate workflow inputs + env: + WSJTX_VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_RC_NUMBER: ${{ inputs.rc_number }} + ARCH: ${{ inputs.arch }} + IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} + VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} + run: .github/scripts/validate-ci-inputs.sh + - uses: ./.github/actions/build-linux-payload + with: + arch: aarch64 + version: ${{ inputs.version }} + hamlib_branch: ${{ inputs.hamlib_branch }} + runtime_base: bookworm-gcc13.4 + recache: ${{ inputs.recache }} + save_ccache: ${{ inputs.save_ccache }} + validate_fortran_fallback: ${{ inputs.validate_fortran_fallback }} + build_packages: ${{ inputs.build_packages }} + release_channel: ${{ inputs.release_channel }} + rc_number: ${{ inputs.rc_number }} + allow_stale_image: ${{ inputs.allow_stale_image }} - - name: Configure - run: | - cmake -S . -B wsjtx-build \ - -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/hamlib-prefix;${GITHUB_WORKSPACE}/pfunit-prefix" \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DWSJT_SKIP_MANPAGES=ON \ - -DWSJT_BUILD_TESTS=ON \ - -DWSJT_RELEASE_CHANNEL="${{ inputs.release_channel }}" \ - -DWSJT_RC_NUMBER="${{ inputs.rc_number }}" \ - -DPFUNIT_DIR="${{ steps.pfunit.outputs.dir }}" \ - -Wno-dev + 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. + # + # 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. + env: + VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_RC_NUMBER: ${{ inputs.rc_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. + - uses: docker/setup-qemu-action@v4 + with: + image: tonistiigi/binfmt:qemu-v10.2.3-68@sha256:400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0 + platforms: linux/arm/v7 + - uses: actions/checkout@v7 + - name: Validate workflow inputs + env: + WSJTX_VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_RC_NUMBER: ${{ inputs.rc_number }} + ARCH: armhf + IMAGE_TAG: ${{ needs.resolve-image.outputs.image_tag }} + VALIDATE_FORTRAN_FALLBACK: ${{ inputs.validate_fortran_fallback }} + run: .github/scripts/validate-ci-inputs.sh - - name: Build - run: cmake --build wsjtx-build -j$(nproc) + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Run tests - id: ctest - run: ctest --output-on-failure --output-junit ctest-results.xml - working-directory: wsjtx-build + - name: Inspect ARMHF image pair + id: image env: - QT_QPA_PLATFORM: offscreen + CROSS_BUILDER_IMAGE: ${{ needs.resolve-image.outputs.cross_image_reference }} + RUNTIME_IMAGE: ${{ needs.resolve-image.outputs.image_reference }} + ALLOW_STALE_IMAGE: ${{ inputs.allow_stale_image }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + run: | + docker pull --platform linux/amd64 "$CROSS_BUILDER_IMAGE" + docker pull --platform linux/arm/v7 "$RUNTIME_IMAGE" + output_file=.armhf-image-verification-output + trap 'rm -f "$output_file"' EXIT + docker run --rm --platform linux/amd64 \ + -v "${GITHUB_WORKSPACE}:/work" \ + -w /work \ + -e GITHUB_OUTPUT=/work/$output_file \ + -e WSJTX_CI_OUTPUT_PREFIX=cross_ \ + -e WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH="$ALLOW_STALE_IMAGE" \ + "$CROSS_BUILDER_IMAGE" \ + bash .github/scripts/verify-armhf-ci-image.sh cross-builder armhf "$HAMLIB_BRANCH" + docker run --rm --platform linux/arm/v7 \ + -v "${GITHUB_WORKSPACE}:/work" \ + -w /work \ + -e GITHUB_OUTPUT=/work/$output_file \ + -e WSJTX_CI_OUTPUT_PREFIX=runtime_ \ + -e WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH="$ALLOW_STALE_IMAGE" \ + "$RUNTIME_IMAGE" \ + bash .github/scripts/verify-armhf-ci-image.sh runtime armhf "$HAMLIB_BRANCH" - - name: Publish test summary - if: always() && steps.ctest.conclusion != 'skipped' - working-directory: wsjtx-build - run: python3 ../.github/scripts/publish-ctest-summary.py "Linux ${{ inputs.arch }}" >> "$GITHUB_STEP_SUMMARY" + cross_generation=$(awk -F= '$1 == "cross_generation" { print $2 }' "$output_file") + runtime_generation=$(awk -F= '$1 == "runtime_generation" { print $2 }' "$output_file") + cross_toolchain_id=$(awk -F= '$1 == "cross_toolchain_id" { print $2 }' "$output_file") + runtime_toolchain_id=$(awk -F= '$1 == "runtime_toolchain_id" { print $2 }' "$output_file") + if [ "$cross_generation" != "$runtime_generation" ]; then + echo "ARMHF image generation mismatch: $cross_generation != $runtime_generation" >&2 + exit 1 + fi + if [ "$cross_toolchain_id" != "$runtime_toolchain_id" ]; then + echo "ARMHF toolchain identity mismatch: $cross_toolchain_id != $runtime_toolchain_id" >&2 + exit 1 + fi + cross_recipe_match=$(awk -F= '$1 == "cross_recipe_match" { print $2 }' "$output_file") + runtime_recipe_match=$(awk -F= '$1 == "runtime_recipe_match" { print $2 }' "$output_file") + recipe_match=false + if [ "$cross_recipe_match" = true ] && [ "$runtime_recipe_match" = true ]; then + recipe_match=true + fi + ccache_compatibility_id=$(awk -F= '$1 == "cross_ccache_compatibility_id" { print $2 }' "$output_file") + ccache_compiler_check=$(awk -F= '$1 == "cross_ccache_compiler_check" { print $2 }' "$output_file") + # Empty manifest values could coalesce caches from incompatible + # toolchains, so reject them before constructing any cache key. + if [ -z "$ccache_compatibility_id" ] || [ -z "$ccache_compiler_check" ]; then + echo "ARMHF image verification returned incomplete ccache identity" >&2 + exit 1 + fi + { + echo "generation=$cross_generation" + echo "recipe_match=$recipe_match" + echo "ccache_compatibility_id=$ccache_compatibility_id" + echo "ccache_compiler_check=$ccache_compiler_check" + } >> "$GITHUB_OUTPUT" - - name: Upload test results - if: always() && steps.ctest.conclusion != 'skipped' - uses: actions/upload-artifact@v7 + - name: Select armhf ccache key + id: ccache-key + env: + RECACHE: ${{ inputs.recache }} + run: .github/scripts/select-ccache-key-suffix.sh + + - name: Restore armhf ccache + id: ccache + uses: actions/cache/restore@v6 with: - name: ctest-results-linux-${{ inputs.arch }} - path: wsjtx-build/ctest-results.xml - if-no-files-found: ignore + path: .ccache-armhf + key: ccache-linux-armhf-${{ steps.image.outputs.ccache_compatibility_id }}-${{ steps.image.outputs.generation }}-${{ github.sha }}${{ steps.ccache-key.outputs.suffix }} + restore-keys: | + ccache-linux-armhf-${{ steps.image.outputs.ccache_compatibility_id }}-${{ steps.image.outputs.generation }}- + ccache-linux-armhf-${{ steps.image.outputs.ccache_compatibility_id }}- - - name: Verify binary + - name: Cross-build ARMHF binaries + env: + ARCH: armhf + CROSS_BUILDER_IMAGE: ${{ needs.resolve-image.outputs.cross_image_reference }} + RECACHE: ${{ inputs.recache }} + CCACHE_COMPILERCHECK: ${{ steps.image.outputs.ccache_compiler_check }} + WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH: ${{ inputs.allow_stale_image }} run: | - file wsjtx-build/jt9 - file wsjtx-build/jt9 | grep -q "ELF 64-bit" + ccache_args=() + if [ "$RECACHE" = true ]; then + ccache_args=(-e CCACHE_RECACHE=1) + fi + docker run --rm --platform linux/amd64 \ + -v "${GITHUB_WORKSPACE}:/work" \ + -w /work \ + -e VERSION \ + -e HAMLIB_BRANCH \ + -e ARCH \ + -e WSJT_RELEASE_CHANNEL \ + -e WSJT_RC_NUMBER \ + -e CCACHE_DIR=/work/.ccache-armhf \ + -e CCACHE_COMPILERCHECK \ + -e WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH \ + "${ccache_args[@]}" \ + "$CROSS_BUILDER_IMAGE" \ + bash .github/scripts/build-linux-armhf-cross.sh - # CMakeLists.txt:1989-2012 enables CPack's DEB generator when - # dpkg-buildpackage is on the path (provided by dpkg-dev, installed - # above). The DEB generator ignores CPACK_PACKAGE_FILE_NAME and - # uses its own CPACK_DEBIAN_FILE_NAME (default <pkg>_<ver>_<arch>.deb - # → wsjtx_3.0.1_amd64.deb regardless). Override that variable to - # align the filename with the AppImage/installer naming used by - # the rest of the pipeline. - - name: Package .deb + - name: Test and package under ARMv7 QEMU + id: armhf-runtime env: - VERSION: ${{ inputs.version }} - ARCH: ${{ inputs.arch }} + ARCH: armhf + RUNTIME_IMAGE: ${{ needs.resolve-image.outputs.image_reference }} + WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH: ${{ inputs.allow_stale_image }} + ARMHF_RUNTIME_PHASE: ${{ inputs.build_packages && 'all' || 'test' }} run: | - cd wsjtx-build - cpack -G DEB \ - -D "CPACK_DEBIAN_FILE_NAME=wsjtx-${VERSION}-linux-${ARCH}.deb" - DEB="wsjtx-${VERSION}-linux-${ARCH}.deb" - if [ ! -f "$DEB" ]; then - echo "::error::cpack -G DEB produced no .deb at expected path: $DEB" - ls -la *.deb 2>/dev/null || true - exit 1 - fi - ls -lh "$DEB" - file "$DEB" - dpkg-deb --info "$DEB" | head -20 - dpkg-deb -c "$DEB" | grep -qE '/usr/bin/map65$' - dpkg-deb -f "$DEB" Depends | grep -Eq 'libportaudio|portaudio' + GITHUB_TOKEN="${{ github.token }}" docker run --rm --platform linux/arm/v7 \ + -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: Publish armhf test summary + if: always() + run: >- + python3 .github/scripts/publish-ctest-summary.py + "Linux armhf" wsjtx-build/ctest-results.xml + >> "$GITHUB_STEP_SUMMARY" + + - name: Upload armhf AppImage startup diagnostics + if: inputs.build_packages && failure() && steps.armhf-runtime.outcome == 'failure' + uses: actions/upload-artifact@v7 + with: + name: wsjtx-startup-smoke-linux-armhf + path: wsjtx-build/appimage-startup-smoke.log + if-no-files-found: ignore + retention-days: 7 + + # Artifacts produced inside the container land in $GITHUB_WORKSPACE + # via the bind-mount. Upload from the host where actions/upload- + # artifact runs natively. Same artifact names as the composite + # action's uploads so release.yml's all-platforms-ready gate + # pattern works unchanged. - name: Upload .deb + if: inputs.build_packages uses: actions/upload-artifact@v7 with: - name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}-deb - path: wsjtx-build/wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}.deb + name: wsjtx-${{ inputs.version }}-linux-armhf-deb + path: wsjtx-build/wsjtx-${{ inputs.version }}-linux-armhf.deb if-no-files-found: error - - # RPM builds via the same CPack scaffolding the .deb step above - # uses. CMakeLists.txt:2014-2026 already auto-detects rpmbuild and - # sets the Fedora-style dependency list (qt5-qtbase >= 5.9, fftw- - # libs-single, boost-log, etc.); only the workflow side was - # missing. `-G RPM` is explicit so this step doesn't accidentally - # rebuild the .deb already produced above. - - name: Package RPM - working-directory: wsjtx-build - run: | - cpack -G RPM - ls -lh *.rpm - - - name: Smoke-test RPM - working-directory: wsjtx-build - run: | - RPM=$(ls *.rpm | head -1) - echo "Querying $RPM" - rpm -qpi "$RPM" - rpm -qpR "$RPM" - rpm -qpl "$RPM" | head -40 - # Confirm the core binaries are in the package. - rpm -qpl "$RPM" | grep -qE '/bin/wsjtx$' - rpm -qpl "$RPM" | grep -qE '/bin/jt9$' - rpm -qpl "$RPM" | grep -qE '/bin/map65$' - rpm -qpR "$RPM" | grep -Eq 'libportaudio|portaudio' - + compression-level: 0 - name: Upload RPM + if: inputs.build_packages uses: actions/upload-artifact@v7 with: - name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}-rpm + name: wsjtx-${{ inputs.version }}-linux-armhf-rpm path: wsjtx-build/*.rpm if-no-files-found: error - - - name: Install to AppDir - run: | - cmake --install wsjtx-build --prefix "${GITHUB_WORKSPACE}/AppDir/usr" - # linuxdeploy's desktop/icon integration needs these exact paths. - test -x AppDir/usr/bin/wsjtx - test -x AppDir/usr/bin/jt9 - test -x AppDir/usr/bin/map65 - test -x AppDir/usr/bin/ft8code - test -f AppDir/usr/share/applications/wsjtx.desktop - test -f AppDir/usr/share/pixmaps/wsjtx_icon.png - - - name: Package AppImage - env: - VERSION: ${{ inputs.version }} - ARCH: ${{ inputs.arch }} - # Core linuxdeploy is pinned to a dated release + SHA256 verify - # so an undetected upstream change fails the build instead of - # shipping. The Qt5 plugin stays on the rolling "continuous" - # channel because upstream has not cut a dated release since - # 1-alpha-20250213-1, which carries a filesystem_error bug on - # ubuntu-24.04 / Qt5.15 (missing qt5/plugins/mediaservice dir). - # When upstream publishes a newer dated plugin release, pin + - # verify it here too. - LINUXDEPLOY_TAG: "1-alpha-20251107-1" - run: | - case "$ARCH" in - x86_64) LINUXDEPLOY_SHA256="c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d" ;; - aarch64) LINUXDEPLOY_SHA256="620095110d693282b8ebeb244a95b5e911cf8f65f76c88b4b47d16ae6346fcff" ;; - *) echo "::error::Unknown linuxdeploy arch: $ARCH"; exit 1 ;; - esac - curl -fsSL -o linuxdeploy.AppImage \ - "https://github.com/linuxdeploy/linuxdeploy/releases/download/${LINUXDEPLOY_TAG}/linuxdeploy-${ARCH}.AppImage" - curl -fsSL -o linuxdeploy-plugin-qt.AppImage \ - "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${ARCH}.AppImage" - echo "${LINUXDEPLOY_SHA256} linuxdeploy.AppImage" | sha256sum -c - - chmod +x linuxdeploy.AppImage linuxdeploy-plugin-qt.AppImage - - # --appimage-extract-and-run avoids FUSE on the hosted runner. - export OUTPUT="wsjtx-${VERSION}-linux-${ARCH}.AppImage" - ./linuxdeploy.AppImage --appimage-extract-and-run \ - --appdir AppDir \ - --plugin qt \ - --output appimage \ - --desktop-file AppDir/usr/share/applications/wsjtx.desktop \ - --icon-file AppDir/usr/share/pixmaps/wsjtx_icon.png - - ls -lh "$OUTPUT" - file "$OUTPUT" - - - name: Smoke-test AppImage payload - env: - VERSION: ${{ inputs.version }} - ARCH: ${{ inputs.arch }} - run: | - APPIMAGE="wsjtx-${VERSION}-linux-${ARCH}.AppImage" - ./"$APPIMAGE" --appimage-extract >/dev/null - test -x squashfs-root/usr/bin/wsjtx - test -x squashfs-root/usr/bin/jt9 - test -x squashfs-root/usr/bin/map65 - test -x squashfs-root/usr/bin/ft8code - test -x squashfs-root/usr/bin/wsprd - file squashfs-root/usr/bin/wsjtx | grep -q "ELF 64-bit" - # Qt5 libs should have been bundled by linuxdeploy-plugin-qt. - ls squashfs-root/usr/lib/ | grep -q "^libQt5Core\.so" - ls squashfs-root/usr/lib/ | grep -q "^libQt5Widgets\.so" - ls squashfs-root/usr/lib/ | grep -q "^libQt5Multimedia\.so" - # Verify Qt audio backend plugins were bundled. Without them, - # QAudioDeviceInfo::availableDevices() returns empty at runtime - # and the user sees "no audio devices" — observed in v3.0.1 on - # Linux Lite. linuxdeploy-plugin-qt only WARNS when these are - # absent on the build host, it doesn't fail. - # Linux shared objects are conventionally `lib*.so` so the - # bundled plugins are libqtaudio_alsa.so and libqtmedia_pulse.so. - audio_plugins=$(find squashfs-root -path '*/plugins/audio/*.so' 2>/dev/null) - if [ -z "$audio_plugins" ]; then - echo "::error::No Qt audio backend plugins (qtaudio_alsa/qtaudio_pulse) bundled in AppImage." - echo "::error::Install libqt5multimedia5-plugins on the build host so linuxdeploy-plugin-qt can find them." - echo "AppImage plugin tree:" - find squashfs-root -path '*/plugins/*' -name '*.so' 2>/dev/null | head -20 - exit 1 - fi - echo "Qt audio plugins bundled:" - echo "$audio_plugins" - rm -rf squashfs-root - + compression-level: 0 - name: Upload AppImage + if: inputs.build_packages uses: actions/upload-artifact@v7 with: - name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}-AppImage - path: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}.AppImage + name: wsjtx-${{ inputs.version }}-linux-armhf-AppImage + path: wsjtx-${{ inputs.version }}-linux-armhf.AppImage if-no-files-found: error - + compression-level: 0 - name: Upload build artifacts + if: inputs.build_packages uses: actions/upload-artifact@v7 with: - name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }} + name: wsjtx-${{ inputs.version }}-linux-armhf path: | wsjtx-build/jt9 wsjtx-build/wsprd wsjtx-build/wsjtx + - name: Upload test results + if: always() + uses: actions/upload-artifact@v7 + with: + 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 295ab743..274270d3 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -1,5 +1,8 @@ name: Build macOS +permissions: + contents: read + on: workflow_call: inputs: @@ -11,7 +14,7 @@ on: description: "Hamlib branch to build" required: false type: string - default: "4.7.1" + default: "4.7.2" arch: description: "Target architecture (arm64 or x86_64)" required: true @@ -24,6 +27,16 @@ on: description: "macOS deployment target version" required: true type: string + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + save_ccache: + description: "Persist compiler objects from a trusted develop build" + required: false + type: boolean + default: false release_channel: description: "Build release channel: DEVEL, RC, or GA" required: false @@ -34,74 +47,239 @@ on: required: false type: string default: "" + signing_mode: + description: "Package signing policy: validation or distribution" + required: false + type: string + default: "validation" + apple_team_id: + description: "Expected Apple Developer Team ID for distribution signing" + required: false + type: string + default: "" + application_certificate_sha1: + description: "Expected Developer ID Application certificate SHA-1" + required: false + type: string + default: "" + installer_certificate_sha1: + description: "Expected Developer ID Installer certificate SHA-1" + required: false + type: string + default: "" + secrets: + DEVELOPER_ID_CERTIFICATE_P12: + description: "Base64-encoded Developer ID Application PKCS#12" + required: false + DEVELOPER_ID_CERTIFICATE_PASSWORD: + description: "Password for the Application PKCS#12" + required: false + DEVELOPER_ID_INSTALLER_P12: + description: "Base64-encoded Developer ID Installer PKCS#12" + required: false + DEVELOPER_ID_INSTALLER_PASSWORD: + description: "Password for the Installer PKCS#12" + required: false + APP_STORE_CONNECT_KEY_ID: + description: "App Store Connect API key ID" + required: false + APP_STORE_CONNECT_ISSUER_ID: + description: "App Store Connect API issuer ID" + required: false + APP_STORE_CONNECT_PRIVATE_KEY_P8_BASE64: + description: "Base64-encoded App Store Connect API private key" + required: false + # Standalone dispatch builds one architecture. Derive its runner and deployment + # target from that architecture so unsupported tuples cannot be selected. + workflow_dispatch: + inputs: + version: + description: "WSJT-X version string (artifact + package names)" + required: false + type: string + default: "3.2.0-devel" + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.2" + arch: + description: "Target architecture" + required: false + type: choice + options: + - arm64 + - x86_64 + default: "arm64" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + save_ccache: + description: "Persist compiler objects when dispatching on develop" + required: false + type: boolean + default: true + release_channel: + description: "Build release channel" + required: false + type: choice + options: + - DEVEL + - RC + - GA + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" + signing_mode: + description: "Package signing policy" + required: false + type: choice + options: + - validation + - distribution + default: validation + apple_team_id: + description: "Expected Apple Developer Team ID (distribution only)" + required: false + type: string + default: "" + application_certificate_sha1: + description: "Expected Developer ID Application certificate SHA-1" + required: false + type: string + default: "" + installer_certificate_sha1: + description: "Expected Developer ID Installer certificate SHA-1" + required: false + type: string + default: "" jobs: build: - runs-on: ${{ inputs.runner }} + # 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 + 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 }} + SIGNING_MODE: ${{ inputs.signing_mode }} + ARCH: ${{ inputs.arch }} + BOOST_VERSION: 1.85.0 + BOOST_SOURCE_SHA256: 7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - - name: Resolve source revision - id: source_revision - run: | - source_revision="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}" - if [ -z "$source_revision" ]; then - source_revision="$(git rev-parse HEAD)" - fi - echo "sha=${source_revision}" >> "$GITHUB_OUTPUT" + - name: Validate workflow inputs + env: + WSJTX_VERSION: ${{ inputs.version }} + run: .github/scripts/validate-ci-inputs.sh - name: Verify macOS build tuple run: | - case "${{ inputs.arch }}:${{ inputs.runner }}:${{ inputs.deployment_target }}" in + case "${ARCH}:${RUNNER}:${DEPLOYMENT_TARGET}" in arm64:macos-15:11.0|x86_64:macos-15-intel:10.13) - echo "Using supported macOS build tuple: ${{ inputs.arch }} on ${{ inputs.runner }} targeting ${{ inputs.deployment_target }}" + echo "Using supported macOS build tuple: ${ARCH} on ${RUNNER} targeting ${DEPLOYMENT_TARGET}" ;; *) - echo "::error::Unsupported macOS build tuple: arch=${{ inputs.arch }}, runner=${{ inputs.runner }}, deployment_target=${{ inputs.deployment_target }}" - echo "::error::Use arm64:macos-15:11.0 or x86_64:macos-15-intel:10.13. Do not use macos-latest for release artifacts." + echo "::error::Unsupported macOS build tuple: arch=${ARCH}, runner=${RUNNER}, deployment_target=${DEPLOYMENT_TARGET}" + echo "::error::Use arm64:macos-15:11.0 or x86_64:macos-15-intel:10.13 for deployable macOS artifacts." exit 1 ;; esac - - name: Check signing secrets - id: check_secrets - env: - APP_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} + - name: Validate signing policy run: | - if [ -n "$APP_P12" ]; then - echo "signing_enabled=true" >> "$GITHUB_OUTPUT" - else - echo "signing_enabled=false" >> "$GITHUB_OUTPUT" - echo "::notice::macOS signing skipped — secrets unavailable (Dependabot or fork PR context). Compile + tests + dylib bundling still validated." - fi + case "$SIGNING_MODE" in + validation) + echo "macOS signing mode: validation (ad-hoc app signature and explicitly unsigned package)" + ;; + distribution) + echo "macOS signing mode: distribution (build job remains secretless; a fresh job performs signing)" + ;; + *) + echo "::error::signing_mode must be validation or distribution, got: ${SIGNING_MODE}" + exit 1 + ;; + esac - name: Set Homebrew prefix run: echo "HOMEBREW_PREFIX=$(brew --prefix)" >> "$GITHUB_ENV" - name: Install dependencies - run: brew install cmake autoconf automake libtool asciidoctor + run: brew install cmake autoconf automake libtool asciidoctor ccache pkg-config + + - name: Select ccache key + id: ccache-key + env: + RECACHE: ${{ inputs.recache }} + run: .github/scripts/select-ccache-key-suffix.sh + + - name: Restore ccache + id: ccache + uses: actions/cache/restore@v6 + with: + path: .ccache + key: ccache-macos-${{ inputs.arch }}-appleclang-${{ github.sha }}${{ steps.ccache-key.outputs.suffix }} + restore-keys: | + ccache-macos-${{ inputs.arch }}-appleclang- + + - name: Configure ccache + run: | + echo "CCACHE_DIR=${GITHUB_WORKSPACE}/.ccache" >> "$GITHUB_ENV" + echo "ccache recache: ${{ inputs.recache }}" + if [ "${{ inputs.recache }}" = "true" ]; then + echo "CCACHE_RECACHE=1" >> "$GITHUB_ENV" + echo "Forcing ccache recache for this run" + fi + mkdir -p "${GITHUB_WORKSPACE}/.ccache" + ccache --version + ccache --zero-stats - name: Compute Qt cache key id: qt-key run: | .github/scripts/macos-qt-cache-key.sh \ --arch "${{ inputs.arch }}" \ - --runner "${{ inputs.runner }}" \ - --deployment-target "${{ inputs.deployment_target }}" \ + --runner "${{ env.RUNNER }}" \ + --deployment-target "${{ env.DEPLOYMENT_TARGET }}" \ --github-output - name: Restore Qt cache id: qt-cache - uses: actions/cache/restore@v5 + uses: actions/cache/restore@v6 with: path: qt-prefix key: ${{ steps.qt-key.outputs.key }} - fail-on-cache-miss: true - - name: Verify cached Qt deployment target + - name: Build Qt + if: steps.qt-cache.outputs.cache-hit != 'true' + run: | + .github/scripts/build-qt-macos.sh \ + --arch "${{ inputs.arch }}" \ + --deployment-target "${{ env.DEPLOYMENT_TARGET }}" \ + --prefix "${GITHUB_WORKSPACE}/qt-prefix" + + - name: Save Qt cache + if: steps.qt-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: qt-prefix + key: ${{ steps.qt-cache.outputs.cache-primary-key }} + + - name: Verify Qt prefix run: | .github/scripts/verify-macos-artifacts.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ --allow-prefix "${GITHUB_WORKSPACE}/qt-prefix" \ "${GITHUB_WORKSPACE}/qt-prefix" @@ -111,7 +289,7 @@ jobs: if: inputs.arch == 'arm64' run: | .github/scripts/install-r-macos-gfortran.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ --work-dir "${RUNNER_TEMP}/r-macos-gfortran" \ --prefix "${GITHUB_WORKSPACE}/gfortran-prefix" \ @@ -122,7 +300,7 @@ jobs: if: inputs.arch == 'x86_64' run: | .github/scripts/install-xpack-gfortran-macos.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ --work-dir "${RUNNER_TEMP}/xpack-gfortran" \ --prefix "${GITHUB_WORKSPACE}/gfortran-prefix" \ @@ -162,206 +340,263 @@ jobs: echo "cache_key=${{ steps.controlled-arm-fc.outputs.cache_key }}" } >> "$GITHUB_OUTPUT" - - name: Verify static Fortran runtime deployment targets + - name: Verify static Fortran runtime run: | .github/scripts/verify-macos-static-archives.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ --mode error \ ${{ steps.fc.outputs.runtime_archives }} - - name: Cache libusb + - name: Restore libusb cache id: libusb-cache - uses: actions/cache/restore@v5 + uses: actions/cache/restore@v6 with: path: libusb-prefix - key: libusb-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.0.27-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} + 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 if: steps.libusb-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-libusb-macos.sh \ 1.0.27 \ - "${{ inputs.deployment_target }}" \ + "${{ env.DEPLOYMENT_TARGET }}" \ "${GITHUB_WORKSPACE}/libusb-prefix" - name: Save libusb cache if: steps.libusb-cache.outputs.cache-hit != 'true' - continue-on-error: true - uses: actions/cache/save@v5 + uses: actions/cache/save@v6 with: path: libusb-prefix - key: libusb-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.0.27-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} - - - name: Cache Hamlib - id: hamlib-cache - uses: actions/cache/restore@v5 - with: - path: hamlib-prefix - key: hamlib-macos-${{ inputs.arch }}-${{ inputs.runner }}-${{ inputs.hamlib_branch }}-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-hamlib-macos.sh') }} + key: ${{ steps.libusb-cache.outputs.cache-primary-key }} - - name: Build Hamlib - if: steps.hamlib-cache.outputs.cache-hit != 'true' - env: - PKG_CONFIG_PATH: ${{ github.workspace }}/libusb-prefix/lib/pkgconfig - run: | - .github/scripts/build-hamlib-macos.sh \ - "${{ inputs.hamlib_branch }}" \ - "${{ inputs.deployment_target }}" \ - "${GITHUB_WORKSPACE}/hamlib-prefix" - - - name: Save Hamlib cache - if: steps.hamlib-cache.outputs.cache-hit != 'true' - continue-on-error: true - uses: actions/cache/save@v5 - with: - path: hamlib-prefix - key: hamlib-macos-${{ inputs.arch }}-${{ inputs.runner }}-${{ inputs.hamlib_branch }}-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-hamlib-macos.sh') }} - - - name: Cache PortAudio + - name: Restore PortAudio cache id: portaudio-cache - uses: actions/cache/restore@v5 + uses: actions/cache/restore@v6 with: path: portaudio-prefix - key: portaudio-macos-${{ inputs.arch }}-${{ inputs.runner }}-19.7.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} + 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 if: steps.portaudio-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-portaudio-macos.sh \ 19.7.0 \ - "${{ inputs.deployment_target }}" \ + "${{ env.DEPLOYMENT_TARGET }}" \ "${GITHUB_WORKSPACE}/portaudio-prefix" - name: Save PortAudio cache if: steps.portaudio-cache.outputs.cache-hit != 'true' - continue-on-error: true - uses: actions/cache/save@v5 + uses: actions/cache/save@v6 with: path: portaudio-prefix - key: portaudio-macos-${{ inputs.arch }}-${{ inputs.runner }}-19.7.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} + key: ${{ steps.portaudio-cache.outputs.cache-primary-key }} - - name: Cache FFTW + - name: Restore FFTW cache id: fftw-cache - uses: actions/cache/restore@v5 + uses: actions/cache/restore@v6 with: path: fftw-prefix - key: fftw-macos-${{ inputs.arch }}-${{ inputs.runner }}-3.3.10-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} + 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 if: steps.fftw-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-fftw-macos.sh \ 3.3.10 \ - "${{ inputs.deployment_target }}" \ + "${{ env.DEPLOYMENT_TARGET }}" \ "${GITHUB_WORKSPACE}/fftw-prefix" - name: Save FFTW cache if: steps.fftw-cache.outputs.cache-hit != 'true' - continue-on-error: true - uses: actions/cache/save@v5 + uses: actions/cache/save@v6 with: path: fftw-prefix - key: fftw-macos-${{ inputs.arch }}-${{ inputs.runner }}-3.3.10-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} + key: ${{ steps.fftw-cache.outputs.cache-primary-key }} - - name: Cache Boost + - name: Restore Boost cache id: boost-cache - uses: actions/cache/restore@v5 + uses: actions/cache/restore@v6 with: path: boost-prefix - key: boost-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.85.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} + 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 if: steps.boost-cache.outputs.cache-hit != 'true' run: | .github/scripts/build-boost-macos.sh \ - 1.85.0 \ + "${BOOST_VERSION}" \ + "${BOOST_SOURCE_SHA256}" \ "${{ inputs.arch }}" \ - "${{ inputs.deployment_target }}" \ + "${{ env.DEPLOYMENT_TARGET }}" \ "${GITHUB_WORKSPACE}/boost-prefix" - name: Save Boost cache if: steps.boost-cache.outputs.cache-hit != 'true' - continue-on-error: true - uses: actions/cache/save@v5 + uses: actions/cache/save@v6 with: path: boost-prefix - key: boost-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.85.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} - - - name: Configure - env: - PKG_CONFIG_PATH: ${{ github.workspace }}/qt-prefix/lib/pkgconfig:${{ github.workspace }}/boost-prefix/lib/pkgconfig:${{ github.workspace }}/fftw-prefix/lib/pkgconfig:${{ github.workspace }}/libusb-prefix/lib/pkgconfig:${{ github.workspace }}/portaudio-prefix/lib/pkgconfig:${{ github.workspace }}/hamlib-prefix/lib/pkgconfig - run: | - cmake -S . -B wsjtx-build \ - -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/qt-prefix;${GITHUB_WORKSPACE}/boost-prefix;${GITHUB_WORKSPACE}/fftw-prefix;${GITHUB_WORKSPACE}/libusb-prefix;${GITHUB_WORKSPACE}/portaudio-prefix;${GITHUB_WORKSPACE}/hamlib-prefix" \ - -DCMAKE_Fortran_COMPILER="${{ steps.fc.outputs.path }}" \ - -DCMAKE_Fortran_FLAGS="${{ steps.fc.outputs.fortran_runtime_flags }}" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ inputs.deployment_target }} \ - -DCMAKE_EXE_LINKER_FLAGS="-Wl,-headerpad_max_install_names ${{ steps.fc.outputs.runtime_link_flags }}" \ - -DWSJT_MACOS_LIBGOMP_LIBRARY="${{ steps.fc.outputs.libgomp }}" \ - -DWSJT_SOURCE_REVISION="${{ steps.source_revision.outputs.sha }}" \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DWSJT_SKIP_MANPAGES=ON \ - -DWSJT_SKIP_BUNDLE_FIXUP=ON \ - -DWSJT_BUILD_TESTS=ON \ - -DWSJT_RELEASE_CHANNEL="${{ inputs.release_channel }}" \ - -DWSJT_RC_NUMBER="${{ inputs.rc_number }}" \ - -Wno-dev + key: ${{ steps.boost-cache.outputs.cache-primary-key }} - - name: Verify resolved dependency prefixes - run: | - CACHE=wsjtx-build/CMakeCache.txt - BAD=$(awk -F= ' - /^(Boost_DIR|Boost_INCLUDE_DIR|Boost_LOG_LIBRARY_RELEASE|Boost_LOG_SETUP_LIBRARY_RELEASE|FFTW3F_LIBRARY|FFTW3F_THREADS_LIBRARY|FFTW3_INCLUDE_DIR|Hamlib_INCLUDE_DIR|Hamlib_LIBRARY|Portaudio_INCLUDE_DIR|Portaudio_LIBRARY|Usb_INCLUDE_DIR|Usb_LIBRARY|Qt5[^:]*_DIR|Qt5[^:]*_EXECUTABLE):/ && $2 ~ /^(\/opt\/homebrew|\/usr\/local\/Cellar|\/usr\/local\/opt|\/opt\/local)/ { - print - } - ' "$CACHE") - if [ -n "$BAD" ]; then - echo "::error::Deployable macOS build resolved bundled dependencies from a package-manager prefix:" - echo "$BAD" - exit 1 - fi - - QT_BAD=$(awk -F= -v prefix="${GITHUB_WORKSPACE}/qt-prefix" ' - /^Qt5[^:]*_(DIR|EXECUTABLE):/ && index($2, prefix) != 1 { - print - } - ' "$CACHE") - if [ -n "$QT_BAD" ]; then - echo "::error::Deployable macOS build did not resolve Qt from the cached qt-prefix:" - echo "$QT_BAD" - exit 1 - fi - - - name: Verify built dependency deployment targets + - name: Verify pinned runtime prefixes run: | .github/scripts/verify-macos-artifacts.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ - --allow-prefix "${GITHUB_WORKSPACE}/boost-prefix" \ - --allow-prefix "${GITHUB_WORKSPACE}/fftw-prefix" \ --allow-prefix "${GITHUB_WORKSPACE}/libusb-prefix" \ --allow-prefix "${GITHUB_WORKSPACE}/portaudio-prefix" \ - "${GITHUB_WORKSPACE}/boost-prefix" \ - "${GITHUB_WORKSPACE}/fftw-prefix" \ + --allow-prefix "${GITHUB_WORKSPACE}/fftw-prefix" \ + --allow-prefix "${GITHUB_WORKSPACE}/boost-prefix" \ "${GITHUB_WORKSPACE}/libusb-prefix" \ - "${GITHUB_WORKSPACE}/portaudio-prefix" + "${GITHUB_WORKSPACE}/portaudio-prefix" \ + "${GITHUB_WORKSPACE}/fftw-prefix" \ + "${GITHUB_WORKSPACE}/boost-prefix" - - name: Verify Hamlib static archive deployment targets + - name: Restore Hamlib cache + id: hamlib-cache + 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 + if: steps.hamlib-cache.outputs.cache-hit != 'true' + run: | + .github/scripts/build-hamlib-macos.sh \ + "${HAMLIB_BRANCH}" \ + "${DEPLOYMENT_TARGET}" \ + "${GITHUB_WORKSPACE}/hamlib-prefix" \ + "${GITHUB_WORKSPACE}/libusb-prefix" + + - name: Verify Hamlib prefix run: | - hamlib_archives=( "${GITHUB_WORKSPACE}/hamlib-prefix/lib/"*.a ) + test -f "${GITHUB_WORKSPACE}/hamlib-prefix/lib/libhamlib.a" .github/scripts/verify-macos-static-archives.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ --mode error \ - "${hamlib_archives[@]}" + "${GITHUB_WORKSPACE}/hamlib-prefix/lib/libhamlib.a" + + - name: Save Hamlib cache + if: steps.hamlib-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: hamlib-prefix + key: ${{ steps.hamlib-cache.outputs.cache-primary-key }} + + - name: Restore pFUnit cache + id: pfunit-cache + 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 + if: steps.pfunit-cache.outputs.cache-hit != 'true' + env: + # pFUnit configure uses try_run probes; expose only the controlled + # compiler runtime for those probes, not for the final test binaries. + DYLD_LIBRARY_PATH: ${{ steps.fc.outputs.runtime_lib_dir }} + run: | + .github/scripts/build-pfunit-macos.sh \ + v4.14.0 \ + "${{ steps.fc.outputs.path }}" \ + "${{ env.DEPLOYMENT_TARGET }}" \ + "${GITHUB_WORKSPACE}/pfunit-prefix" + + - name: Locate pFUnit config + id: pfunit + run: | + CONFIG=$(find "${GITHUB_WORKSPACE}/pfunit-prefix" -name PFUNITConfig.cmake -print -quit) + if [ -z "$CONFIG" ]; then + echo "ERROR: PFUNITConfig.cmake not found under pfunit-prefix" + find "${GITHUB_WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d + exit 1 + fi + PFUNIT_DIR="$(dirname "$CONFIG")" + echo "Found PFUNITConfig.cmake at: $CONFIG" + echo "dir=${PFUNIT_DIR}" >> "$GITHUB_OUTPUT" + + - name: Save pFUnit cache + if: steps.pfunit-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v6 + with: + path: pfunit-prefix + key: ${{ steps.pfunit-cache.outputs.cache-primary-key }} - - name: Build + - name: Configure build and tests + env: + PKG_CONFIG_PATH: ${{ github.workspace }}/qt-prefix/lib/pkgconfig:${{ github.workspace }}/boost-prefix/lib/pkgconfig:${{ github.workspace }}/fftw-prefix/lib/pkgconfig:${{ github.workspace }}/libusb-prefix/lib/pkgconfig:${{ github.workspace }}/portaudio-prefix/lib/pkgconfig:${{ github.workspace }}/hamlib-prefix/lib/pkgconfig:${{ github.workspace }}/pfunit-prefix/lib/pkgconfig + run: | + cmake -S . -B wsjtx-build \ + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/qt-prefix;${GITHUB_WORKSPACE}/boost-prefix;${GITHUB_WORKSPACE}/fftw-prefix;${GITHUB_WORKSPACE}/libusb-prefix;${GITHUB_WORKSPACE}/portaudio-prefix;${GITHUB_WORKSPACE}/hamlib-prefix;${GITHUB_WORKSPACE}/pfunit-prefix" \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DCMAKE_Fortran_COMPILER="${{ steps.fc.outputs.path }}" \ + -DCMAKE_Fortran_FLAGS="${{ steps.fc.outputs.fortran_runtime_flags }}" \ + -DCMAKE_EXE_LINKER_FLAGS="${{ steps.fc.outputs.runtime_link_flags }}" \ + -DCMAKE_INSTALL_RPATH="${GITHUB_WORKSPACE}/qt-prefix/lib;${GITHUB_WORKSPACE}/boost-prefix/lib;${GITHUB_WORKSPACE}/fftw-prefix/lib;${GITHUB_WORKSPACE}/libusb-prefix/lib;${GITHUB_WORKSPACE}/portaudio-prefix/lib;${GITHUB_WORKSPACE}/hamlib-prefix/lib" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ env.DEPLOYMENT_TARGET }} \ + -DWSJT_SKIP_MANPAGES=ON \ + -DWSJT_ENABLE_TESTS=ON \ + -DWSJT_ENABLE_GUI_SMOKE_TESTS=ON \ + -DWSJT_MACOS_LIBGOMP_LIBRARY="${{ steps.fc.outputs.libgomp }}" \ + -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}" \ + -Wno-dev + + - name: Build and test targets 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' }} + 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' }} + 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 --output-on-failure --output-junit ctest-results.xml + run: ctest --parallel 3 --output-on-failure --output-junit ctest-results.xml working-directory: wsjtx-build - name: Publish test summary @@ -371,23 +606,42 @@ jobs: - name: Upload test results if: always() && steps.ctest.conclusion != 'skipped' - continue-on-error: true uses: actions/upload-artifact@v7 with: name: ctest-results-macos-${{ inputs.arch }} path: wsjtx-build/ctest-results.xml if-no-files-found: ignore + - name: Upload WSJT-X startup diagnostics + if: failure() && steps.ctest.outcome == 'failure' + uses: actions/upload-artifact@v7 + with: + name: wsjtx-startup-smoke-macos-${{ inputs.arch }} + path: wsjtx-build/startup-smoke-diagnostics + if-no-files-found: ignore + retention-days: 7 + + - name: Show ccache stats + if: always() + run: ccache --show-stats + - name: Verify architecture run: | file wsjtx-build/jt9 - lipo -archs wsjtx-build/jt9 | grep -q ${{ inputs.arch }} + ARCHS=$(lipo -archs wsjtx-build/jt9) + case " ${ARCHS} " in + *" ${{ inputs.arch }} "*) ;; + *) + echo "::error::Expected ${{ inputs.arch }} in jt9 architectures, found: ${ARCHS}" + exit 1 + ;; + esac - name: Install app bundle and collect CLI assets id: collect run: | BUILD=wsjtx-build - STAGE=stage/wsjtx-${{ inputs.version }}-${{ inputs.arch }} + STAGE="stage/wsjtx-${VERSION}-${ARCH}" ASSETS=assets mkdir -p "${ASSETS}" @@ -398,10 +652,13 @@ jobs: echo "::error::CMake install did not create ${APP}" exit 1 fi - if [ ! -x "${APP}/Contents/MacOS/map65" ]; then - echo "::error::CMake install did not create executable MAP65 companion app binary at ${APP}/Contents/MacOS/map65" - exit 1 - fi + + for bin in qmap map65; do + if [ ! -x "${APP}/Contents/MacOS/${bin}" ]; then + echo "::error::Expected app companion binary is missing after install: ${APP}/Contents/MacOS/${bin}" + exit 1 + fi + done for bin in jt9 wsprd wsprcode jt65code jt4code ft8code q65code encode77 fcal hash22calc; do [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${ASSETS}/" @@ -440,10 +697,6 @@ jobs: echo "::error::Expected CMake-installed alert sound is missing: ${SOUNDDIR}/Wanted.wav" exit 1 fi - if [ ! -x "${APP}/Contents/MacOS/map65" ]; then - echo "::error::Expected CMake-installed MAP65 binary is missing: ${APP}/Contents/MacOS/map65" - exit 1 - fi if [ -e "${APP}/Contents/MacOS/sounds" ]; then echo "::error::Alert sounds must not be installed under Contents/MacOS; codesign treats them as unsigned code." @@ -455,547 +708,114 @@ jobs: printf ' %s\n' "$@" echo "Verified CMake-installed alert sounds in ${SOUNDDIR}" - - name: Bundle dylibs into app - run: | - set -Eeuo pipefail - STAGE="${{ steps.collect.outputs.stage_dir }}" - APP="${STAGE}/wsjtx.app" - FRAMEWORKS="${APP}/Contents/Frameworks" - FORTRAN_PREFIX="${{ steps.fc.outputs.prefix }}" - FORTRAN_ORIGINAL_PREFIX="${{ steps.fc.outputs.original_prefix }}" - GCC_LIB="${{ steps.fc.outputs.runtime_lib_dir }}" - mkdir -p "${FRAMEWORKS}" - - dump_bundle_context() { - local status="$1" - local line="$2" - local command="$3" - echo "::error::Bundle dylibs into app failed at line ${line} with status ${status}: ${command}" - echo "APP=${APP}" - echo "FRAMEWORKS=${FRAMEWORKS}" - echo "FORTRAN_PREFIX=${FORTRAN_PREFIX}" - echo "FORTRAN_ORIGINAL_PREFIX=${FORTRAN_ORIGINAL_PREFIX}" - echo "GCC_LIB=${GCC_LIB}" - echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" - echo "App executable contents:" - ls -la "${APP}/Contents/MacOS" || true - echo "Framework contents:" - ls -la "${FRAMEWORKS}" || true - echo "External references in app executables:" - find "${APP}/Contents/MacOS" -type f -perm +111 -print -exec otool -L {} \; 2>/dev/null || true - if [ -f macdeployqt.log ]; then - echo "macdeployqt.log:" - cat macdeployqt.log - fi - } - trap 'status=$?; dump_bundle_context "$status" "$LINENO" "$BASH_COMMAND"; exit "$status"' ERR - - run_logged() { - echo "+ $*" - "$@" - } - - echo "Running macdeployqt..." - set +e - "${GITHUB_WORKSPACE}/qt-prefix/bin/macdeployqt" "${APP}" -verbose=2 > macdeployqt.log 2>&1 - status=$? - set -e - if [ "$status" -ne 0 ]; then - echo "::error::macdeployqt failed with status ${status}" - dump_bundle_context "$status" "$LINENO" "macdeployqt" - exit "$status" - fi - cat macdeployqt.log - - resolve_lib() { - local lib="$1" - if [ -n "$FORTRAN_ORIGINAL_PREFIX" ] && [[ "$lib" == "$FORTRAN_ORIGINAL_PREFIX"/* ]]; then - local original_prefix="${FORTRAN_ORIGINAL_PREFIX}/" - local relocated="${FORTRAN_PREFIX}/${lib:${#original_prefix}}" - [ -f "$relocated" ] && echo "$relocated" && return 0 - fi - if [[ "$lib" == $HOMEBREW_PREFIX/* ]]; then - echo "$lib" - return 0 - elif [[ "$lib" == $GITHUB_WORKSPACE/* ]]; then - echo "$lib" - return 0 - elif [[ "$lib" == @rpath/* ]]; then - local name="${lib#@rpath/}" - for dir in \ - "$FRAMEWORKS" \ - "$GITHUB_WORKSPACE/boost-prefix/lib" \ - "$GITHUB_WORKSPACE/fftw-prefix/lib" \ - "$GITHUB_WORKSPACE/libusb-prefix/lib" \ - "$GITHUB_WORKSPACE/portaudio-prefix/lib" \ - "$FORTRAN_PREFIX/lib" \ - "$GCC_LIB" \ - "$HOMEBREW_PREFIX/lib" - do - [ -f "$dir/$name" ] && echo "$dir/$name" && return - done - fi - return 0 - } - - should_bundle_ref() { - local ref="$1" - case "$ref" in - *Qt*.framework/*) - return 1 - ;; - "$FORTRAN_ORIGINAL_PREFIX"/*|"$HOMEBREW_PREFIX"/*|"$GITHUB_WORKSPACE"/*|@rpath/*) - return 0 - ;; - *) - return 1 - ;; - esac - } - - bundle_dylib() { - local binary="$1" - local lib - while IFS= read -r lib; do - should_bundle_ref "$lib" || continue - local resolved - resolved=$(resolve_lib "$lib") - if [ -z "$resolved" ]; then - echo "::error::Could not resolve ${lib} required by ${binary}" - exit 1 - fi - local libname - libname=$(basename "$resolved") - case "$libname" in - libgomp*.dylib) - echo "::error::Refusing to bundle ${resolved}; libgomp must be linked statically for deployable macOS artifacts." - exit 1 - ;; - esac - if [ ! -f "${FRAMEWORKS}/${libname}" ]; then - echo " Bundling: $resolved -> ${FRAMEWORKS}/${libname}" - run_logged cp "$resolved" "${FRAMEWORKS}/${libname}" - run_logged chmod 644 "${FRAMEWORKS}/${libname}" - run_logged install_name_tool -id "@rpath/${libname}" "${FRAMEWORKS}/${libname}" - bundle_dylib "${FRAMEWORKS}/${libname}" - fi - if [ "$lib" != "@rpath/${libname}" ]; then - run_logged install_name_tool -change "$lib" "@rpath/${libname}" "$binary" - fi - done < <(otool -L "$binary" | awk 'NR > 1 {print $1}' || true) - } - - ensure_app_rpath() { - local binary="$1" - local rpath - - while IFS= read -r rpath; do - [ -n "$rpath" ] || continue - case "$rpath" in - "$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) - run_logged install_name_tool -delete_rpath "$rpath" "$binary" - ;; - esac - done < <(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true) - - if ! otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' | grep -Fxq "@executable_path/../Frameworks"; then - run_logged install_name_tool -add_rpath "@executable_path/../Frameworks" "$binary" - fi - } - - for exe in "${APP}/Contents/MacOS/"*; do - [ -f "$exe" ] && [ -x "$exe" ] && { - ensure_app_rpath "$exe" - bundle_dylib "$exe" - for fw in $(otool -L "$exe" | awk '{print $1}' | grep '\.framework/' || true); do - fwname=$(basename "$fw") - bundled=$(find "${FRAMEWORKS}" -name "${fwname}" -path "*.framework/*" 2>/dev/null | head -1) - if [ -n "$bundled" ]; then - app_contents="${APP}/Contents/" - fwrel="${bundled:${#app_contents}}" - if [ "$fw" != "@executable_path/../${fwrel}" ]; then - run_logged install_name_tool -change "$fw" "@executable_path/../${fwrel}" "$exe" - fi - fi - done - } - done - - for fw in "${FRAMEWORKS}"/*.dylib; do - [ -f "$fw" ] && bundle_dylib "$fw" - done - - for exe in "${APP}/Contents/MacOS/"*; do - [ -f "$exe" ] && [ -x "$exe" ] && bundle_dylib "$exe" - done - - echo "Checking for remaining external references..." - remaining_refs="${RUNNER_TEMP:-/tmp}/wsjtx-app-remaining-refs.txt" - : > "$remaining_refs" - while IFS= read -r binary; do - while IFS= read -r ref; do - case "$ref" in - "$FORTRAN_ORIGINAL_PREFIX"/*|"$HOMEBREW_PREFIX"/*|"$GITHUB_WORKSPACE"/*) - echo "${binary}: ${ref}" >> "$remaining_refs" - ;; - esac - done < <(otool -L "$binary" | awk 'NR > 1 {print $1}' || true) - done < <(find "${APP}/Contents/MacOS" -type f -perm +111 -print 2>/dev/null) - if [ -s "$remaining_refs" ]; then - echo "::error::External build-time paths still present:" - cat "$remaining_refs" - exit 1 - else - echo "All dylibs bundled successfully" - fi - - - name: Bundle dylibs into CLI tools + - name: Deploy macOS app dependencies run: | - set -Eeuo pipefail - ASSETS="${{ steps.collect.outputs.assets_dir }}" - STAGE="${{ steps.collect.outputs.stage_dir }}" - LIBDIR="${ASSETS}/lib" - FORTRAN_PREFIX="${{ steps.fc.outputs.prefix }}" - FORTRAN_ORIGINAL_PREFIX="${{ steps.fc.outputs.original_prefix }}" - GCC_LIB="${{ steps.fc.outputs.runtime_lib_dir }}" - mkdir -p "${LIBDIR}" - - dump_cli_context() { - local status="$1" - local line="$2" - local command="$3" - echo "::error::Bundle dylibs into CLI tools failed at line ${line} with status ${status}: ${command}" - echo "ASSETS=${ASSETS}" - echo "LIBDIR=${LIBDIR}" - echo "FORTRAN_PREFIX=${FORTRAN_PREFIX}" - echo "FORTRAN_ORIGINAL_PREFIX=${FORTRAN_ORIGINAL_PREFIX}" - echo "GCC_LIB=${GCC_LIB}" - echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" - echo "Asset contents:" - ls -la "${ASSETS}" || true - echo "Library contents:" - ls -la "${LIBDIR}" || true - echo "External references in CLI assets:" - for bin in "${ASSETS}"/*; do - [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] || continue - echo "== $bin ==" - otool -L "$bin" || true - done - } - trap 'status=$?; dump_cli_context "$status" "$LINENO" "$BASH_COMMAND"; exit "$status"' ERR - - run_logged() { - echo "+ $*" - "$@" - } - - resolve_cli_ref() { - local ref="$1" - local name="" suffix="" - - if [ -n "$FORTRAN_ORIGINAL_PREFIX" ] && [[ "$ref" == "$FORTRAN_ORIGINAL_PREFIX"/* ]]; then - local original_prefix="${FORTRAN_ORIGINAL_PREFIX}/" - local relocated="${FORTRAN_PREFIX}/${ref:${#original_prefix}}" - [ -f "$relocated" ] && echo "$relocated" - return 0 - fi - - case "$ref" in - /usr/lib/*|/System/Library/*) - return 0 - ;; - @loader_path/lib/*) - name="${ref#@loader_path/lib/}" - [ -f "${LIBDIR}/${name}" ] && echo "${LIBDIR}/${name}" - return 0 - ;; - @loader_path/*) - name="${ref#@loader_path/}" - [ -f "${LIBDIR}/${name}" ] && echo "${LIBDIR}/${name}" - return 0 - ;; - "$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) - echo "$ref" - return 0 - ;; - esac - - if [[ "$ref" == @rpath/* ]]; then - suffix="${ref#@rpath/}" - if [[ "$suffix" == *.framework/* ]]; then - for dir in \ - "${STAGE}/wsjtx.app/Contents/Frameworks" \ - "${GITHUB_WORKSPACE}/qt-prefix/lib" - do - [ -f "${dir}/${suffix}" ] && echo "${dir}/${suffix}" && return 0 - done - else - name="${suffix}" - for dir in \ - "${LIBDIR}" \ - "${STAGE}/wsjtx.app/Contents/Frameworks" \ - "${GITHUB_WORKSPACE}/boost-prefix/lib" \ - "${GITHUB_WORKSPACE}/fftw-prefix/lib" \ - "${GITHUB_WORKSPACE}/libusb-prefix/lib" \ - "${GITHUB_WORKSPACE}/portaudio-prefix/lib" \ - "${FORTRAN_PREFIX}/lib" \ - "${GCC_LIB}" \ - "${HOMEBREW_PREFIX}/lib" - do - [ -f "${dir}/${name}" ] && echo "${dir}/${name}" && return 0 - done - fi - fi + .github/scripts/deploy-macos-app.sh \ + --app "${{ steps.collect.outputs.stage_dir }}/wsjtx.app" \ + --workspace-prefix "${GITHUB_WORKSPACE}" \ + --qt-prefix "${GITHUB_WORKSPACE}/qt-prefix" \ + --boost-prefix "${GITHUB_WORKSPACE}/boost-prefix" \ + --fftw-prefix "${GITHUB_WORKSPACE}/fftw-prefix" \ + --libusb-prefix "${GITHUB_WORKSPACE}/libusb-prefix" \ + --portaudio-prefix "${GITHUB_WORKSPACE}/portaudio-prefix" \ + --fortran-prefix "${{ steps.fc.outputs.prefix }}" \ + --fortran-original-prefix "${{ steps.fc.outputs.original_prefix }}" \ + --gcc-lib "${{ steps.fc.outputs.runtime_lib_dir }}" \ + --homebrew-prefix "${HOMEBREW_PREFIX}" - return 0 - } - - bundle_cli_deps() { - local binary="$1" - local change_prefix="$2" - local ref resolved out name target - - while IFS= read -r ref; do - resolved=$(resolve_cli_ref "$ref") - if [ -z "$resolved" ]; then - case "$ref" in - @rpath/*|@loader_path/*|"$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) - echo "::error::Could not resolve ${ref} required by ${binary}" - exit 1 - ;; - *) - continue - ;; - esac - fi - - name="$(basename "$resolved")" - case "$name" in - libgomp*.dylib) - echo "::error::Refusing to bundle ${resolved}; libgomp must be linked statically for deployable macOS artifacts." - exit 1 - ;; - esac - - out="${LIBDIR}/${name}" - if [ ! -f "$out" ]; then - echo " Bundling: ${resolved} -> ${out}" - run_logged cp "$resolved" "$out" - run_logged chmod 644 "$out" - run_logged install_name_tool -id "@rpath/${name}" "$out" - bundle_cli_deps "$out" "@rpath" - fi - - target="${change_prefix}/${name}" - if [ "$ref" != "$target" ]; then - run_logged install_name_tool -change "$ref" "$target" "$binary" - fi - done < <(otool -L "$binary" | awk 'NR > 1 {print $1}' | grep -E "($HOMEBREW_PREFIX|$GITHUB_WORKSPACE|@rpath|@loader_path)" || true) - } - - ensure_cli_rpath() { - local binary="$1" - local rpath - local bad_rpaths=() - local unique_bad_rpaths=() - - while IFS= read -r rpath; do - [ -n "$rpath" ] || continue - case "$rpath" in - "$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) - bad_rpaths+=("$rpath") - ;; - esac - done < <(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true) - - # Deduplicate bad rpaths (compatible with macOS Bash 3.2) - if [ "${#bad_rpaths[@]}" -gt 0 ]; then - for rpath in "${bad_rpaths[@]}"; do - local found=0 - local u - if [ "${#unique_bad_rpaths[@]}" -gt 0 ]; then - for u in "${unique_bad_rpaths[@]}"; do - [ "$u" = "$rpath" ] && found=1 && break - done - fi - [ "$found" -eq 0 ] && unique_bad_rpaths+=("$rpath") - done - fi - - if [ "${#unique_bad_rpaths[@]}" -gt 0 ]; then - for rpath in "${unique_bad_rpaths[@]}"; do - run_logged install_name_tool -delete_rpath "$rpath" "$binary" - done - fi - - if ! otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' | grep -Fxq "@loader_path/lib"; then - run_logged install_name_tool -add_rpath "@loader_path/lib" "$binary" + APP="${{ steps.collect.outputs.stage_dir }}/wsjtx.app" + for file in \ + "${APP}/Contents/PlugIns/platforms/libqcocoa.dylib" \ + "${APP}/Contents/Resources/qt.conf" + do + if [ ! -f "$file" ]; then + echo "::error::Expected macOS app deployment file is missing: ${file}" + exit 1 fi - } - - for bin in "${ASSETS}"/*; do - [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] || continue - ensure_cli_rpath "$bin" - bundle_cli_deps "$bin" "@rpath" - run_logged codesign --force --sign - "$bin" - done - - for lib in "${LIBDIR}"/*; do - [ -f "$lib" ] || continue - bundle_cli_deps "$lib" "@rpath" - run_logged codesign --force --sign - "$lib" done - echo "Verifying CLI tools..." - for bin in "${ASSETS}"/*; do - [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] && { - BAD=$(otool -L "$bin" | grep "$HOMEBREW_PREFIX" || true) - if [ -n "$BAD" ]; then - echo "ERROR: $(basename "$bin") still has Homebrew refs:" - echo "$BAD" - exit 1 - fi - } - done - echo "All CLI tools are self-contained" - - cp -R "${LIBDIR}" "${STAGE}/lib" - for bin in "${ASSETS}"/*; do - [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] && { - cp "$bin" "${STAGE}/$(basename "$bin")" - } - done + - name: Deploy macOS CLI tool dependencies + run: | + .github/scripts/deploy-macos-cli-tools.sh \ + --assets "${{ steps.collect.outputs.assets_dir }}" \ + --stage "${{ steps.collect.outputs.stage_dir }}" \ + --workspace-prefix "${GITHUB_WORKSPACE}" \ + --boost-prefix "${GITHUB_WORKSPACE}/boost-prefix" \ + --fftw-prefix "${GITHUB_WORKSPACE}/fftw-prefix" \ + --libusb-prefix "${GITHUB_WORKSPACE}/libusb-prefix" \ + --portaudio-prefix "${GITHUB_WORKSPACE}/portaudio-prefix" \ + --fortran-prefix "${{ steps.fc.outputs.prefix }}" \ + --fortran-original-prefix "${{ steps.fc.outputs.original_prefix }}" \ + --gcc-lib "${{ steps.fc.outputs.runtime_lib_dir }}" \ + --homebrew-prefix "${HOMEBREW_PREFIX}" - name: Verify bundled macOS deployment targets run: | STAGE="${{ steps.collect.outputs.stage_dir }}" .github/scripts/verify-macos-artifacts.sh \ - --target "${{ inputs.deployment_target }}" \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ --arch "${{ inputs.arch }}" \ "$STAGE" - - name: Import signing certificates - if: steps.check_secrets.outputs.signing_enabled == 'true' - env: - APP_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} - APP_P12_PW: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }} - INST_P12: ${{ secrets.DEVELOPER_ID_INSTALLER_P12 }} - INST_P12_PW: ${{ secrets.DEVELOPER_ID_INSTALLER_PASSWORD }} - run: | - KEYCHAIN_PATH="$RUNNER_TEMP/signing.keychain-db" - KEYCHAIN_PASSWORD="$(openssl rand -hex 16)" - - security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" - security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" - security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" - - echo "$APP_P12" | base64 --decode > "$RUNNER_TEMP/app.p12" - security import "$RUNNER_TEMP/app.p12" -P "$APP_P12_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" - - echo "$INST_P12" | base64 --decode > "$RUNNER_TEMP/installer.p12" - security import "$RUNNER_TEMP/installer.p12" -P "$INST_P12_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" - - security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" - security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain-db - - APP_IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep "Developer ID Application" | head -1 | awk -F'"' '{print $2}') - INST_IDENTITY=$(security find-identity -v "$KEYCHAIN_PATH" | grep "Developer ID Installer" | head -1 | awk -F'"' '{print $2}') - echo "App identity: $APP_IDENTITY" - echo "Installer identity: $INST_IDENTITY" - echo "identity=$APP_IDENTITY" >> "$GITHUB_OUTPUT" - echo "installer_identity=$INST_IDENTITY" >> "$GITHUB_OUTPUT" - id: keychain - - # ALWAYS runs. Real Developer ID when secrets are present, ad-hoc - # signing (-) otherwise. Mirrors the Windows self-signed-sandbox - # pattern in build-windows.yml: prove the signing step is wired, - # rely on a real cert in production. Ad-hoc signing produces a - # structurally-valid signature with no Apple trust chain — pkg - # will not pass Gatekeeper without right-click→Open, but is - # well-formed and the all-platforms-ready gate in release.yml - # finds the artifact at the expected path. - - name: Code sign binaries + - name: Ad-hoc sign binaries for build validation run: | STAGE="${{ steps.collect.outputs.stage_dir }}" ASSETS="${{ steps.collect.outputs.assets_dir }}" APP="${STAGE}/wsjtx.app" ENTITLEMENTS="${GITHUB_WORKSPACE}/entitlements.plist" - if [ "${{ steps.check_secrets.outputs.signing_enabled }}" = "true" ]; then - IDENTITY="${{ steps.keychain.outputs.identity }}" - TS="--timestamp" - echo "Code signing mode: Developer ID (real)" - else - IDENTITY="-" - TS="" - echo "Code signing mode: ad-hoc (no Apple trust chain; pkg will be unsigned)" - fi + IDENTITY="-" + echo "Code signing mode: ad-hoc (no Apple trust chain; pkg will be unsigned)" - # entitlements.plist declares com.apple.security.cs.disable- - # library-validation, which is required for any app bundling - # its own non-system frameworks (Qt, etc.) under hardened - # runtime — otherwise dyld refuses to load them. Applied on - # both signing paths: the real-cert path needs it for - # notarization-friendly distribution; the ad-hoc path needs - # it because each ad-hoc signature has its own pseudo-Team-ID - # so the main binary and bundled frameworks never match. - # (The plist is non-empty, so macos-15-intel's codesign now - # parses it cleanly — no need for the conditional that PR #23 - # introduced as a workaround for the empty-plist parser bug.) + # Sign nested code before the containing bundle. Executable + # entitlements are defined in the repository-root plist. find "${APP}/Contents/Frameworks" -type f \( -name "*.dylib" -o -perm +111 \) \ - -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; + -exec codesign --force --options runtime --sign "$IDENTITY" {} \; find "${APP}/Contents/Frameworks" -name "*.framework" -type d | while read -r fw; do - codesign --force --options runtime $TS --sign "$IDENTITY" "$fw" + codesign --force --options runtime --sign "$IDENTITY" "$fw" done - if [ -d "${APP}/Contents/PlugIns" ]; then - find "${APP}/Contents/PlugIns" -type f -name "*.dylib" \ - -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; - fi + find "${APP}/Contents/PlugIns" -type f -name "*.dylib" \ + -exec codesign --force --options runtime --sign "$IDENTITY" {} \; 2>/dev/null || true find "${APP}/Contents/MacOS" -type f -perm +111 \ - -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" {} \; - # Bundle-level codesign re-signs the main executable. --force - # without --entitlements would WIPE the entitlements applied - # in the previous step (PR #27 missed this — rc1 shipped with - # an unentitled wsjtx binary, so disable-library-validation - # never took effect and the dyld load of QtSerialPort still - # failed with mismatched Team IDs). - codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" "${APP}" + -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$IDENTITY" {} \; + # Bundle signing re-signs the main executable, so it must receive the + # entitlement file again. + codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$IDENTITY" "${APP}" codesign --verify --deep --strict --verbose=2 "${APP}" - # Defensive: confirm the entitlement actually made it onto - # the main binary. `codesign --verify` doesn't check - # entitlement presence — it only validates the signature - # itself — so a re-sign that wipes entitlements would still - # pass verify (that's how rc1 shipped broken). + # codesign --verify validates the signature, not required entitlement + # presence. MAIN_BIN="${APP}/Contents/MacOS/wsjtx" - if ! codesign -d --entitlements - "$MAIN_BIN" 2>/dev/null | grep -q "disable-library-validation"; then + ENTITLEMENTS_OUT=$(codesign -d --entitlements - "$MAIN_BIN" 2>/dev/null) + if [[ "$ENTITLEMENTS_OUT" != *"disable-library-validation"* ]]; then echo "::error::wsjtx binary is missing com.apple.security.cs.disable-library-validation entitlement." echo "::error::Bundled Qt frameworks will fail to load under hardened runtime." codesign -d --entitlements - "$MAIN_BIN" || true exit 1 fi echo "Confirmed disable-library-validation entitlement on $MAIN_BIN" + if [[ "$ENTITLEMENTS_OUT" == *"allow-unsigned-executable-memory"* ]]; then + echo "::error::${MAIN_BIN} must not grant unsigned executable memory." + exit 1 + fi + echo "Confirmed no unsigned executable memory entitlement on $MAIN_BIN" for dir in "${STAGE}" "${ASSETS}"; do find "${dir}" -maxdepth 1 -type f -perm +111 \ - -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" {} \; + -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$IDENTITY" {} \; done for dir in "${STAGE}/lib" "${ASSETS}/lib"; do [ -d "$dir" ] && find "$dir" -type f \ - -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; + -exec codesign --force --options runtime --sign "$IDENTITY" {} \; done - # ALWAYS runs. productbuild signs with the Developer ID Installer - # cert when secrets are present; produces an unsigned .pkg - # otherwise. Either way the artifact is named identically and - # satisfies the all-platforms-ready gate in release.yml. - - name: Build and verify installer pkg + - name: Prepare installer package run: | STAGE="${{ steps.collect.outputs.stage_dir }}" - PKG_ID="org.k1jt.wsjtx.${{ inputs.arch }}" - PKG_VERSION="${{ inputs.version }}" + PKG_ID="org.k1jt.wsjtx.${ARCH}" + PKG_VERSION="${VERSION}" PAYLOAD="$RUNNER_TEMP/pkg-payload" SCRIPTS="$RUNNER_TEMP/pkg-scripts" @@ -1036,134 +856,103 @@ jobs: --install-location / \ "$RUNNER_TEMP/wsjtx-component.pkg" - PKG_OUT="wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg" - if [ "${{ steps.check_secrets.outputs.signing_enabled }}" = "true" ]; then - INST_IDENTITY="${{ steps.keychain.outputs.installer_identity }}" - productbuild \ - --package "$RUNNER_TEMP/wsjtx-component.pkg" \ - --sign "$INST_IDENTITY" \ - "$PKG_OUT" - else - productbuild \ - --package "$RUNNER_TEMP/wsjtx-component.pkg" \ - "$PKG_OUT" - fi - + - name: Build unsigned validation package + if: inputs.signing_mode == 'validation' + id: package + run: | + PKG_OUT="wsjtx-${VERSION}-${ARCH}-macOS.pkg" + productbuild \ + --package "$RUNNER_TEMP/wsjtx-component.pkg" \ + "$PKG_OUT" + echo "path=$PKG_OUT" >> "$GITHUB_OUTPUT" + echo "artifact_name=wsjtx-${VERSION}-${ARCH}-macOS-unsigned.pkg" >> "$GITHUB_OUTPUT" + + - name: Verify unsigned validation package + if: inputs.signing_mode == 'validation' + run: | + PKG_OUT="${{ steps.package.outputs.path }}" CHECK_PAYLOAD="$RUNNER_TEMP/pkg-check" - rm -rf "$CHECK_PAYLOAD" pkgutil --expand-full "$PKG_OUT" "$CHECK_PAYLOAD" [ "$(/usr/libexec/PlistBuddy -c "Print :0:BundleIsRelocatable" "$RUNNER_TEMP/components.plist")" = "false" ] [ "$(/usr/libexec/PlistBuddy -c "Print :0:BundleIsVersionChecked" "$RUNNER_TEMP/components.plist")" = "false" ] [ "$(/usr/libexec/PlistBuddy -c "Print :0:BundleOverwriteAction" "$RUNNER_TEMP/components.plist")" = "upgrade" ] - + test -x "$CHECK_PAYLOAD/wsjtx-component.pkg/Payload/Applications/wsjtx.app/Contents/MacOS/qmap" + test -x "$CHECK_PAYLOAD/wsjtx-component.pkg/Payload/Applications/wsjtx.app/Contents/MacOS/map65" APP_PAYLOAD="$CHECK_PAYLOAD/wsjtx-component.pkg/Payload/Applications/wsjtx.app" - DATADIR="${APP_PAYLOAD}/Contents/Resources/wsjtx" - DOCDIR="${APP_PAYLOAD}/Contents/Resources/doc/wsjtx" SOUNDDIR="${APP_PAYLOAD}/Contents/Resources/sounds" - - for file in cty.dat cty.dat_copyright.txt grid.dat sat.dat eclipse.txt ALLCALL7.TXT JPLEPH; do - if [ ! -f "${DATADIR}/${file}" ]; then - echo "::error::Expected packaged data file is missing: ${DATADIR}/${file}" - exit 1 - fi - done - - set -- "${DOCDIR}/wsjtx-main"*.html + set -- "${APP_PAYLOAD}/Contents/Resources/doc/wsjtx/wsjtx-main"*.html if [ "$#" -lt 1 ] || [ ! -f "$1" ]; then echo "::error::Expected at least one local user guide in the packaged app bundle." printf 'Matched paths:\n' printf ' %s\n' "$@" exit 1 fi - if [ ! -f "${SOUNDDIR}/Wanted.wav" ]; then echo "::error::Expected packaged alert sound is missing: ${SOUNDDIR}/Wanted.wav" exit 1 fi - if [ ! -x "${APP_PAYLOAD}/Contents/MacOS/map65" ]; then - echo "::error::Expected packaged MAP65 binary is missing: ${APP_PAYLOAD}/Contents/MacOS/map65" - exit 1 - fi - if [ -e "${APP_PAYLOAD}/Contents/MacOS/sounds" ]; then echo "::error::Packaged alert sounds must not be under Contents/MacOS." exit 1 fi - - echo "Verified packaged local user guides:" - printf ' %s\n' "$@" echo "Verified packaged alert sounds in ${SOUNDDIR}" + .github/scripts/verify-macos-artifacts.sh \ + --target "${{ env.DEPLOYMENT_TARGET }}" \ + --arch "${{ inputs.arch }}" \ + "$CHECK_PAYLOAD/wsjtx-component.pkg/Payload" - - name: Notarize pkg - if: steps.check_secrets.outputs.signing_enabled == 'true' - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + - name: Stage distribution signing input + if: inputs.signing_mode == 'distribution' run: | - notarize_and_staple() { - local file="$1" - echo "Notarizing: $file" - xcrun notarytool submit "$file" \ - --apple-id "$APPLE_ID" \ - --password "$APPLE_ID_PASSWORD" \ - --team-id "$APPLE_TEAM_ID" \ - --wait 2>&1 | tee notarize.log - - if grep -q "status: Invalid" notarize.log; then - SUBMISSION_ID=$(grep "id:" notarize.log | head -1 | awk '{print $2}') - xcrun notarytool log "$SUBMISSION_ID" \ - --apple-id "$APPLE_ID" \ - --password "$APPLE_ID_PASSWORD" \ - --team-id "$APPLE_TEAM_ID" || true - exit 1 - fi - - xcrun stapler staple "$file" - } + mkdir -p distribution-signing-input + cp "${{ runner.temp }}/wsjtx-component.pkg" distribution-signing-input/ + cp "${{ runner.temp }}/components.plist" distribution-signing-input/ + cp entitlements.plist distribution-signing-input/ - notarize_and_staple "wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg" + - name: Upload distribution signing input + if: inputs.signing_mode == 'distribution' + uses: actions/upload-artifact@v7 + with: + name: macos-signing-input-${{ inputs.version }}-${{ inputs.arch }} + path: distribution-signing-input + retention-days: 1 - - name: Notarize CLI tools - if: steps.check_secrets.outputs.signing_enabled == 'true' - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + - name: Write validation signing report + if: inputs.signing_mode == 'validation' run: | - ASSETS="${{ steps.collect.outputs.assets_dir }}" - zip -r cli-tools.zip "${ASSETS}"/ - xcrun notarytool submit cli-tools.zip \ - --apple-id "$APPLE_ID" \ - --password "$APPLE_ID_PASSWORD" \ - --team-id "$APPLE_TEAM_ID" \ - --wait 2>&1 | tee notarize-cli.log - - if grep -q "status: Invalid" notarize-cli.log; then - SUBMISSION_ID=$(grep "id:" notarize-cli.log | head -1 | awk '{print $2}') - xcrun notarytool log "$SUBMISSION_ID" \ - --apple-id "$APPLE_ID" \ - --password "$APPLE_ID_PASSWORD" \ - --team-id "$APPLE_TEAM_ID" || true + PKG_OUT="${{ steps.package.outputs.path }}" + PKG_SIGNATURE=$(pkgutil --check-signature "$PKG_OUT" 2>&1 || true) + printf '%s\n' "$PKG_SIGNATURE" + if [[ "$PKG_SIGNATURE" != *"Status: no signature"* ]]; then + echo "::error::Validation package did not report the expected unsigned status." exit 1 fi - rm cli-tools.zip - - - name: Clean up keychain - if: always() && steps.check_secrets.outputs.signing_enabled == 'true' - run: security delete-keychain "$RUNNER_TEMP/signing.keychain-db" 2>/dev/null || true + SHA256=$(shasum -a 256 "$PKG_OUT" | awk '{print $1}') + jq -n \ + --arg mode validation \ + --arg artifact "$PKG_OUT" \ + --arg sha256 "$SHA256" \ + --arg git_sha "$GITHUB_SHA" \ + '{schema_version: 1, mode: $mode, artifact: $artifact, sha256: $sha256, git_sha: $git_sha, signed: false, notarized: false, publishable: false}' \ + > macos-signing-report.json - name: Upload pkg + if: inputs.signing_mode == 'validation' + uses: actions/upload-artifact@v7 + with: + name: ${{ steps.package.outputs.artifact_name }} + path: ${{ steps.package.outputs.path }} + + - name: Upload signing report + if: inputs.signing_mode == 'validation' uses: actions/upload-artifact@v7 with: - name: wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg - path: wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg + name: macos-signing-report-${{ inputs.version }}-${{ inputs.arch }} + path: macos-signing-report.json - name: Package individual binaries run: | - # Tarball and inner-dir names include the arch suffix so arm64 - # and x86_64 per-binary artifacts can coexist in a single - # GitHub Release without ReleaseAsset.name collisions (#24). + # Architecture-qualified names prevent release-asset collisions. ASSETS="${{ steps.collect.outputs.assets_dir }}" ARCH="${{ inputs.arch }}" PKGS=packages @@ -1185,3 +974,260 @@ jobs: with: name: individual-binaries-macos-${{ inputs.arch }} path: packages/*.tar.gz + + # 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 + id: deployed_wsjtx_smoke + timeout-minutes: 1 + run: | + APP="${GITHUB_WORKSPACE}/${{ steps.collect.outputs.stage_dir }}/wsjtx.app" + DIAGNOSTICS="${GITHUB_WORKSPACE}/wsjtx-build/deployed-startup-smoke-diagnostics" + + unset DYLD_LIBRARY_PATH + unset DYLD_FRAMEWORK_PATH + unset DYLD_INSERT_LIBRARIES + unset DYLD_ROOT_PATH + unset DYLD_IMAGE_SUFFIX + unset QT_PLUGIN_PATH + unset QT_QPA_PLATFORM_PLUGIN_PATH + unset QML_IMPORT_PATH + unset QML2_IMPORT_PATH + + export DYLD_FALLBACK_LIBRARY_PATH="/usr/lib" + export DYLD_FALLBACK_FRAMEWORK_PATH="/System/Library/Frameworks" + export QT_QPA_PLATFORM="cocoa" + export PATH="/usr/bin:/bin:/usr/sbin:/sbin" + + cd "$RUNNER_TEMP" + /bin/bash "${GITHUB_WORKSPACE}/test/run-wsjtx-startup-macos.sh" \ + "$DIAGNOSTICS" \ + "${APP}/Contents/MacOS/wsjtx" \ + --startup-smoke-test \ + --rig-name CI-DEPLOYED-STARTUP + + - name: Upload deployed WSJT-X startup diagnostics + if: failure() && steps.deployed_wsjtx_smoke.outcome == 'failure' + uses: actions/upload-artifact@v7 + with: + name: wsjtx-deployed-startup-smoke-macos-${{ inputs.arch }} + path: wsjtx-build/deployed-startup-smoke-diagnostics + if-no-files-found: ignore + retention-days: 7 + + sign_distribution: + if: inputs.signing_mode == 'distribution' + needs: build + runs-on: ${{ inputs.runner || (inputs.arch == 'x86_64' && 'macos-15-intel' || 'macos-15') }} + timeout-minutes: 30 + environment: apple-release-signing + env: + VERSION: ${{ inputs.version }} + ARCH: ${{ inputs.arch }} + APPLE_TEAM_ID: ${{ inputs.apple_team_id || vars.APPLE_TEAM_ID }} + APP_CERT_SHA1: ${{ inputs.application_certificate_sha1 || vars.APPLE_APPLICATION_CERTIFICATE_SHA1 }} + INST_CERT_SHA1: ${{ inputs.installer_certificate_sha1 || vars.APPLE_INSTALLER_CERTIFICATE_SHA1 }} + steps: + - name: Validate distribution credentials + env: + APP_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} + APP_P12_PW: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }} + INST_P12: ${{ secrets.DEVELOPER_ID_INSTALLER_P12 }} + INST_P12_PW: ${{ secrets.DEVELOPER_ID_INSTALLER_PASSWORD }} + ASC_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} + ASC_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} + ASC_PRIVATE_KEY_P8_BASE64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_P8_BASE64 }} + run: | + missing=() + for name in APP_P12 APP_P12_PW INST_P12 INST_P12_PW ASC_KEY_ID ASC_ISSUER_ID ASC_PRIVATE_KEY_P8_BASE64 APPLE_TEAM_ID APP_CERT_SHA1 INST_CERT_SHA1; do + [ -n "${!name}" ] || missing+=("$name") + done + if [ "${#missing[@]}" -ne 0 ]; then + printf '::error::Distribution signing is missing required credentials or identity configuration: %s\n' "${missing[*]}" + exit 1 + fi + + - name: Download unsigned component package + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: macos-signing-input-${{ inputs.version }}-${{ inputs.arch }} + path: signing-input + + - name: Expand signing input without executing it + run: | + pkgutil --expand-full signing-input/wsjtx-component.pkg "$RUNNER_TEMP/expanded-component" + test -d "$RUNNER_TEMP/expanded-component/Payload/Applications/wsjtx.app" + test -d "$RUNNER_TEMP/expanded-component/Payload/usr/local/wsjtx" + + - name: Import and verify Developer ID identities + id: identities + env: + APP_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} + APP_P12_PW: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }} + INST_P12: ${{ secrets.DEVELOPER_ID_INSTALLER_P12 }} + INST_P12_PW: ${{ secrets.DEVELOPER_ID_INSTALLER_PASSWORD }} + run: | + KEYCHAIN_PATH="$RUNNER_TEMP/release-signing.keychain-db" + KEYCHAIN_PASSWORD="$(openssl rand -hex 16)" + security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + security set-keychain-settings -lut 1800 "$KEYCHAIN_PATH" + security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + printf '%s' "$APP_P12" | base64 --decode > "$RUNNER_TEMP/app.p12" + printf '%s' "$INST_P12" | base64 --decode > "$RUNNER_TEMP/installer.p12" + security import "$RUNNER_TEMP/app.p12" -P "$APP_P12_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" + security import "$RUNNER_TEMP/installer.p12" -P "$INST_P12_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" + rm -f "$RUNNER_TEMP/app.p12" "$RUNNER_TEMP/installer.p12" + security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain-db + + APP_IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | awk -F'"' '/Developer ID Application/ {print $2; exit}') + INST_IDENTITY=$(security find-identity -v "$KEYCHAIN_PATH" | awk -F'"' '/Developer ID Installer/ {print $2; exit}') + [ -n "$APP_IDENTITY" ] || { echo "::error::No Developer ID Application identity was imported."; exit 1; } + [ -n "$INST_IDENTITY" ] || { echo "::error::No Developer ID Installer identity was imported."; exit 1; } + [[ "$APP_IDENTITY" == *"(${APPLE_TEAM_ID})"* ]] || { echo "::error::Application identity is not owned by the expected team."; exit 1; } + [[ "$INST_IDENTITY" == *"(${APPLE_TEAM_ID})"* ]] || { echo "::error::Installer identity is not owned by the expected team."; exit 1; } + + app_actual=$(security find-certificate -c "$APP_IDENTITY" -Z "$KEYCHAIN_PATH" | awk '/SHA-1 hash:/ {print toupper($3); exit}') + inst_actual=$(security find-certificate -c "$INST_IDENTITY" -Z "$KEYCHAIN_PATH" | awk '/SHA-1 hash:/ {print toupper($3); exit}') + app_expected=$(printf '%s' "$APP_CERT_SHA1" | tr -d ': ' | tr '[:lower:]' '[:upper:]') + inst_expected=$(printf '%s' "$INST_CERT_SHA1" | tr -d ': ' | tr '[:lower:]' '[:upper:]') + [ "$app_actual" = "$app_expected" ] || { echo "::error::Application certificate fingerprint mismatch."; exit 1; } + [ "$inst_actual" = "$inst_expected" ] || { echo "::error::Installer certificate fingerprint mismatch."; exit 1; } + echo "application=$APP_IDENTITY" >> "$GITHUB_OUTPUT" + echo "installer=$INST_IDENTITY" >> "$GITHUB_OUTPUT" + + - name: Sign staged application and command-line tools + env: + APP_IDENTITY: ${{ steps.identities.outputs.application }} + run: | + PAYLOAD="$RUNNER_TEMP/expanded-component/Payload" + APP="$PAYLOAD/Applications/wsjtx.app" + ENTITLEMENTS="$GITHUB_WORKSPACE/signing-input/entitlements.plist" + test -f "$ENTITLEMENTS" + + find "$APP/Contents/Frameworks" -type f \( -name "*.dylib" -o -perm +111 \) \ + -exec codesign --force --options runtime --timestamp --sign "$APP_IDENTITY" {} \; + find "$APP/Contents/Frameworks" -name "*.framework" -type d | while read -r framework; do + codesign --force --options runtime --timestamp --sign "$APP_IDENTITY" "$framework" + done + find "$APP/Contents/PlugIns" -type f -name "*.dylib" \ + -exec codesign --force --options runtime --timestamp --sign "$APP_IDENTITY" {} \; + find "$APP/Contents/MacOS" -type f -perm +111 \ + -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" --timestamp --sign "$APP_IDENTITY" {} \; + codesign --force --options runtime --entitlements "$ENTITLEMENTS" --timestamp --sign "$APP_IDENTITY" "$APP" + + find "$PAYLOAD/usr/local/wsjtx" -maxdepth 1 -type f -perm +111 \ + -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" --timestamp --sign "$APP_IDENTITY" {} \; + [ ! -d "$PAYLOAD/usr/local/wsjtx/lib" ] || find "$PAYLOAD/usr/local/wsjtx/lib" -type f \ + -exec codesign --force --options runtime --timestamp --sign "$APP_IDENTITY" {} \; + codesign --verify --deep --strict --verbose=2 "$APP" + + - name: Build signed distribution package + id: package + env: + INST_IDENTITY: ${{ steps.identities.outputs.installer }} + run: | + COMPONENT="$RUNNER_TEMP/wsjtx-signed-component.pkg" + pkgbuild \ + --root "$RUNNER_TEMP/expanded-component/Payload" \ + --scripts "$RUNNER_TEMP/expanded-component/Scripts" \ + --component-plist "$GITHUB_WORKSPACE/signing-input/components.plist" \ + --identifier "org.k1jt.wsjtx.${ARCH}" \ + --version "$VERSION" \ + --install-location / \ + "$COMPONENT" + pkgutil --payload-files "$COMPONENT" >/dev/null + PKG_OUT="wsjtx-${VERSION}-${ARCH}-macOS.pkg" + productbuild \ + --package "$COMPONENT" \ + --sign "$INST_IDENTITY" \ + "$PKG_OUT" + echo "path=$PKG_OUT" >> "$GITHUB_OUTPUT" + + - name: Verify rebuilt distribution package + run: | + PKG_OUT="${{ steps.package.outputs.path }}" + CHECK_PACKAGE="$RUNNER_TEMP/signed-package-check" + pkgutil --expand-full "$PKG_OUT" "$CHECK_PACKAGE" + COMPONENT="$CHECK_PACKAGE/wsjtx-signed-component.pkg" + PAYLOAD="$COMPONENT/Payload" + APP="$PAYLOAD/Applications/wsjtx.app" + test -x "$APP/Contents/MacOS/qmap" + test -x "$APP/Contents/MacOS/map65" + test -x "$COMPONENT/Scripts/postinstall" + test -d "$PAYLOAD/usr/local/wsjtx" + codesign --verify --deep --strict --verbose=2 "$APP" + + - name: Notarize and staple distribution package + id: notarize + env: + ASC_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }} + ASC_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} + ASC_PRIVATE_KEY_P8_BASE64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_P8_BASE64 }} + run: | + KEY_PATH="$RUNNER_TEMP/AuthKey_${ASC_KEY_ID}.p8" + printf '%s' "$ASC_PRIVATE_KEY_P8_BASE64" | base64 --decode > "$KEY_PATH" + chmod 600 "$KEY_PATH" + xcrun notarytool submit "${{ steps.package.outputs.path }}" \ + --key "$KEY_PATH" \ + --key-id "$ASC_KEY_ID" \ + --issuer "$ASC_ISSUER_ID" \ + --wait --output-format json > notarization.json + SUBMISSION_ID=$(jq -r '.id // empty' notarization.json) + STATUS=$(jq -r '.status // empty' notarization.json) + if [ "$STATUS" != "Accepted" ] || [ -z "$SUBMISSION_ID" ]; then + echo "::error::Apple notarization did not return Accepted (status=${STATUS:-missing})." + [ -n "$SUBMISSION_ID" ] && xcrun notarytool log "$SUBMISSION_ID" \ + --key "$KEY_PATH" --key-id "$ASC_KEY_ID" --issuer "$ASC_ISSUER_ID" || true + exit 1 + fi + xcrun stapler staple "${{ steps.package.outputs.path }}" + xcrun stapler validate "${{ steps.package.outputs.path }}" + echo "submission_id=$SUBMISSION_ID" >> "$GITHUB_OUTPUT" + echo "status=$STATUS" >> "$GITHUB_OUTPUT" + rm -f "$KEY_PATH" + + - name: Verify distribution trust and write signing report + run: | + PKG_OUT="${{ steps.package.outputs.path }}" + COMPONENT="$RUNNER_TEMP/signed-package-check/wsjtx-signed-component.pkg" + APP="$COMPONENT/Payload/Applications/wsjtx.app" + codesign --verify --deep --strict --verbose=2 "$APP" + codesign -dv --verbose=4 "$APP" 2> codesign-details.txt + grep -F "TeamIdentifier=${APPLE_TEAM_ID}" codesign-details.txt + pkgutil --check-signature "$PKG_OUT" | tee pkg-signature.txt + grep -F "Developer ID Installer:" pkg-signature.txt + grep -F "(${APPLE_TEAM_ID})" pkg-signature.txt + xcrun stapler validate "$PKG_OUT" + spctl --assess --type install --verbose=4 "$PKG_OUT" + SHA256=$(shasum -a 256 "$PKG_OUT" | awk '{print $1}') + jq -n \ + --arg mode distribution \ + --arg artifact "$PKG_OUT" \ + --arg sha256 "$SHA256" \ + --arg git_sha "$GITHUB_SHA" \ + --arg team_id "$APPLE_TEAM_ID" \ + --arg app_certificate_sha1 "$(printf '%s' "$APP_CERT_SHA1" | tr -d ': ' | tr '[:lower:]' '[:upper:]')" \ + --arg installer_certificate_sha1 "$(printf '%s' "$INST_CERT_SHA1" | tr -d ': ' | tr '[:lower:]' '[:upper:]')" \ + --arg notarization_id "${{ steps.notarize.outputs.submission_id }}" \ + --arg notarization_status "${{ steps.notarize.outputs.status }}" \ + '{schema_version: 1, mode: $mode, artifact: $artifact, sha256: $sha256, git_sha: $git_sha, team_id: $team_id, application_certificate_sha1: $app_certificate_sha1, installer_certificate_sha1: $installer_certificate_sha1, notarization: {id: $notarization_id, status: $notarization_status}, stapled: true, gatekeeper_accepted: true, isolated_signing_job: true}' \ + > macos-signing-report.json + + - name: Remove signing credentials + if: always() + run: | + rm -f "$RUNNER_TEMP/app.p12" "$RUNNER_TEMP/installer.p12" "$RUNNER_TEMP"/AuthKey_*.p8 + security delete-keychain "$RUNNER_TEMP/release-signing.keychain-db" 2>/dev/null || true + + - name: Upload signed distribution package + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: ${{ steps.package.outputs.path }} + path: ${{ steps.package.outputs.path }} + + - name: Upload distribution signing report + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: macos-signing-report-${{ inputs.version }}-${{ inputs.arch }} + path: macos-signing-report.json diff --git a/.github/workflows/build-selected-artifacts.yml b/.github/workflows/build-selected-artifacts.yml new file mode 100644 index 00000000..71e33737 --- /dev/null +++ b/.github/workflows/build-selected-artifacts.yml @@ -0,0 +1,181 @@ +name: Build Selected Artifacts + +on: + workflow_dispatch: + inputs: + targets: + description: "Artifact set to build" + required: true + type: choice + options: + - macos-arm64 + - windows-x64 + - macos-arm64-windows-x64 + - linux-x64 + - linux-arm64 + - macos-x64 + - all + default: macos-arm64 + mode: + description: "Build selected artifacts immediately or gate them on Linux x64 first" + required: true + type: choice + options: + - artifact-now + - linux-smoke-first + default: artifact-now + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.targets }}-${{ inputs.mode }} + cancel-in-progress: false + +permissions: + contents: read + packages: read + +jobs: + prepare: + 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 }} + steps: + - uses: actions/checkout@v7 + - id: v + 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" + - id: linux-image + name: Resolve Linux CI image generation + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: .github/scripts/resolve-linux-ci-image-tag.py + + # In linux-smoke-first mode, this is both the cheap gate and a normal Linux + # x64 artifact build. Do not also run linux-x64 for the same dispatch. + linux-smoke-x64: + needs: [prepare] + if: inputs.mode == 'linux-smoke-first' + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: "x86_64" + 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] + if: >- + inputs.mode != 'linux-smoke-first' && + (inputs.targets == 'linux-x64' || inputs.targets == 'all') + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: "x86_64" + 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] + if: >- + always() && + !cancelled() && + needs.prepare.result == 'success' && + (needs.linux-smoke-x64.result == 'success' || needs.linux-smoke-x64.result == 'skipped') && + (inputs.targets == 'linux-arm64' || inputs.targets == 'all') + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: "aarch64" + 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] + if: >- + always() && + !cancelled() && + needs.prepare.result == 'success' && + (needs.linux-smoke-x64.result == 'success' || needs.linux-smoke-x64.result == 'skipped') && + ( + inputs.targets == 'macos-arm64' || + inputs.targets == 'macos-arm64-windows-x64' || + inputs.targets == 'all' + ) + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: "arm64" + 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] + if: >- + always() && + !cancelled() && + needs.prepare.result == 'success' && + (needs.linux-smoke-x64.result == 'success' || needs.linux-smoke-x64.result == 'skipped') && + (inputs.targets == 'macos-x64' || inputs.targets == 'all') + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: "x86_64" + 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] + if: >- + always() && + !cancelled() && + needs.prepare.result == 'success' && + (needs.linux-smoke-x64.result == 'success' || needs.linux-smoke-x64.result == 'skipped') && + ( + inputs.targets == 'windows-x64' || + inputs.targets == 'macos-arm64-windows-x64' || + inputs.targets == 'all' + ) + uses: ./.github/workflows/build-windows.yml + with: + 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 1d6f8ec9..c2dca58d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -11,7 +11,17 @@ on: description: "Hamlib branch to build" required: false type: string - default: "4.7.0" + default: "4.7.2" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + save_ccache: + description: "Persist compiler objects from a trusted develop build" + required: false + type: boolean + default: false release_channel: description: "Build release channel: DEVEL, RC, or GA" required: false @@ -22,10 +32,69 @@ on: required: false type: string default: "" + outputs: + installer-artifact-id: + description: "Installer artifact id, for the SignPath submit step" + value: ${{ jobs.build.outputs.installer-artifact-id }} + # Also runnable on its own ("Run workflow" / gh workflow run) to build just + # the Windows installer, at ~1/6 the cost of the full ci.yml matrix. GitHub + # only exposes workflow_dispatch when the trigger is present on the default + # branch, so this must be merged to develop before it can be dispatched. + # Inputs mirror workflow_call with standalone defaults: hamlib_branch matches + # 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. + workflow_dispatch: + inputs: + version: + description: "WSJT-X version string (installer filename + artifact names)" + required: false + type: string + default: "3.2.0-devel" + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.2" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + save_ccache: + description: "Persist compiler objects when dispatching on develop" + required: false + type: boolean + default: true + release_channel: + description: "Build release channel" + required: false + type: choice + options: + - DEVEL + - RC + - GA + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" jobs: build: runs-on: windows-latest + timeout-minutes: 100 + outputs: + installer-artifact-id: ${{ steps.upload_installer.outputs.artifact-id }} + env: + BOOST_VERSION: 1.91.0 + BOOST_SOURCE_SHA256: de5e6b0e4913395c6bdfa90537febd9028ea4c0735d2cdb0cd9b45d5f51264f5 + WSJT_WINDOWS_API_FLOOR: "0x0601" + VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_RC_NUMBER: ${{ inputs.rc_number }} defaults: run: shell: msys2 {0} @@ -41,8 +110,16 @@ jobs: shell: pwsh run: git config --global core.autocrlf false - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + - name: Validate workflow inputs + shell: bash + env: + WSJTX_VERSION: ${{ inputs.version }} + run: .github/scripts/validate-ci-inputs.sh + + # Boost is source-built by build-windows-deps so the Windows 7 API floor + # and Boost.Atomic patch stay pinned; do not install MSYS2 Boost here. - uses: msys2/setup-msys2@v2 with: msystem: MINGW64 @@ -52,6 +129,7 @@ jobs: git make tar mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-ccache mingw-w64-x86_64-cmake mingw-w64-x86_64-qt5-base mingw-w64-x86_64-qt5-multimedia @@ -61,12 +139,10 @@ jobs: mingw-w64-x86_64-qt5-websockets mingw-w64-x86_64-qt5-activeqt mingw-w64-x86_64-fftw - mingw-w64-x86_64-boost mingw-w64-x86_64-libusb mingw-w64-x86_64-portaudio mingw-w64-x86_64-pkg-config mingw-w64-x86_64-nsis - mingw-w64-x86_64-osslsigncode mingw-w64-x86_64-ruby autoconf automake libtool @@ -76,73 +152,44 @@ jobs: - name: Install asciidoctor (Ruby gem) run: gem install asciidoctor --no-document - - name: Cache pFUnit - id: pfunit-cache - uses: actions/cache@v5 - with: - path: pfunit-prefix - key: pfunit-windows-v4.9.0-${{ hashFiles('.github/workflows/build-windows.yml') }} + - name: Select ccache key + id: ccache-key + shell: bash + env: + RECACHE: ${{ inputs.recache }} + run: .github/scripts/select-ccache-key-suffix.sh - - name: Build pFUnit - if: steps.pfunit-cache.outputs.cache-hit != 'true' - run: | - WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - git config --global core.longpaths true - git clone --depth 1 --branch v4.9.0 --recursive \ - https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src - cmake -S pfunit-src -B pfunit-build -G "MSYS Makefiles" \ - -DSKIP_MPI=YES \ - -DSKIP_OPENMP=YES \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/pfunit-prefix" - cmake --build pfunit-build -j$(nproc) - cmake --install pfunit-build + - name: Restore ccache + id: ccache + uses: actions/cache/restore@v6 + with: + path: .ccache + key: ccache-windows-x86_64-gcc-${{ github.sha }}${{ steps.ccache-key.outputs.suffix }} + restore-keys: | + ccache-windows-x86_64-gcc- - - name: Locate pFUnit config - id: pfunit + - name: Configure ccache run: | WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - # Locate each sub-package's config directly — MSYS2 pkg-config - # interacts badly with multi-entry CMAKE_PREFIX_PATH, so we pass - # explicit <pkg>_DIR hints instead. - for pkg in PFUNIT GFTL GFTL_SHARED FARGPARSE; do - CONFIG=$(find "${WORKSPACE}/pfunit-prefix" -name ${pkg}Config.cmake | head -1) - if [ -z "$CONFIG" ]; then - echo "ERROR: ${pkg}Config.cmake not found under pfunit-prefix" - find "${WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d - exit 1 - fi - DIR="$(dirname "$CONFIG")" - echo "Found ${pkg}Config.cmake at: $CONFIG" - echo "$(echo $pkg | tr '[:upper:]' '[:lower:]')_dir=${DIR}" >> "$GITHUB_OUTPUT" - done + echo "CCACHE_DIR=${WORKSPACE}/.ccache" >> "$GITHUB_ENV" + echo "ccache recache: ${{ inputs.recache }}" + if [ "${{ inputs.recache }}" = "true" ]; then + echo "CCACHE_RECACHE=1" >> "$GITHUB_ENV" + echo "Forcing ccache recache for this run" + fi + mkdir -p "${WORKSPACE}/.ccache" + ccache --version + ccache --zero-stats - - name: Cache Hamlib - id: hamlib-cache - uses: actions/cache@v5 + - name: Build Windows dependencies + id: windows-deps + uses: ./.github/actions/build-windows-deps with: - path: hamlib-prefix - key: hamlib-windows-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-windows.yml') }} - - - name: Build Hamlib - if: steps.hamlib-cache.outputs.cache-hit != 'true' - env: - MSYS2_PATH_TYPE: inherit - run: | - WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ - https://github.com/Hamlib/Hamlib.git hamlib-src - cd hamlib-src - ./bootstrap - ./configure \ - --prefix="${WORKSPACE}/hamlib-prefix" \ - --enable-shared --disable-static \ - --without-cxx-binding \ - --without-readline \ - CFLAGS="-DNDEBUG -g -O2 -fdata-sections -ffunction-sections" \ - LDFLAGS="-Wl,--gc-sections" - make -j$(nproc) - make install-strip + boost_version: ${{ env.BOOST_VERSION }} + boost_source_sha256: ${{ env.BOOST_SOURCE_SHA256 }} + windows_api_floor: ${{ env.WSJT_WINDOWS_API_FLOOR }} + hamlib_branch: ${{ inputs.hamlib_branch }} + save_caches: ${{ github.event_name != 'pull_request' }} - name: Install OmniRig shell: pwsh @@ -159,35 +206,71 @@ jobs: if (-not $omnirig) { throw "OmniRig install failed — OmniRig.exe not found" } echo "OMNIRIG_PATH=$($omnirig.FullName)" >> $env:GITHUB_ENV - - name: Fix dumpcpp name (MSYS2 ships dumpcpp-qt5, CMake expects dumpcpp) - run: | - ln -sf /mingw64/bin/dumpcpp-qt5.exe /mingw64/bin/dumpcpp.exe - - - name: Configure + - name: Configure build and tests run: | WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") OMNIRIG=$(cygpath "${OMNIRIG_PATH}") + BOOST_PREFIX="${{ steps.windows-deps.outputs.boost_prefix }}" + HAMLIB_PREFIX="${{ steps.windows-deps.outputs.hamlib_prefix }}" cmake -G "MSYS Makefiles" -S . -B wsjtx-build \ - -DCMAKE_PREFIX_PATH="${WORKSPACE}/hamlib-prefix" \ + -DCMAKE_PREFIX_PATH="${BOOST_PREFIX};${HAMLIB_PREFIX}" \ + -DBOOST_ROOT="${BOOST_PREFIX}" \ + -DBOOST_INCLUDEDIR="${BOOST_PREFIX}/include" \ + -DBOOST_LIBRARYDIR="${BOOST_PREFIX}/lib" \ + -DHamlib_INCLUDE_DIR="${HAMLIB_PREFIX}/include" \ + -DHamlib_LIBRARY="${HAMLIB_PREFIX}/lib/libhamlib.dll.a" \ + -DRIGCTL_EXE="${HAMLIB_PREFIX}/bin/rigctl.exe" \ + -DRIGCTLD_EXE="${HAMLIB_PREFIX}/bin/rigctld.exe" \ + -DRIGCTLCOM_EXE="${HAMLIB_PREFIX}/bin/rigctlcom.exe" \ + -DCMAKE_C_FLAGS="-D_WIN32_WINNT=${WSJT_WINDOWS_API_FLOOR} -DWINVER=${WSJT_WINDOWS_API_FLOOR}" \ + -DCMAKE_CXX_FLAGS="-D_WIN32_WINNT=${WSJT_WINDOWS_API_FLOOR} -DWINVER=${WSJT_WINDOWS_API_FLOOR} -DBOOST_USE_WINAPI_VERSION=${WSJT_WINDOWS_API_FLOOR}" \ + -DBoost_NO_SYSTEM_PATHS=ON \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DOMNIRIG_TYPE_LIB="${OMNIRIG}" \ -DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch -std=legacy" \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DWSJT_SKIP_MANPAGES=ON \ - -DWSJT_BUILD_TESTS=ON \ - -DWSJT_RELEASE_CHANNEL="${{ inputs.release_channel }}" \ - -DWSJT_RC_NUMBER="${{ inputs.rc_number }}" \ - -DPFUNIT_DIR="${{ steps.pfunit.outputs.pfunit_dir }}" \ - -DGFTL_DIR="${{ steps.pfunit.outputs.gftl_dir }}" \ - -DGFTL_SHARED_DIR="${{ steps.pfunit.outputs.gftl_shared_dir }}" \ - -DFARGPARSE_DIR="${{ steps.pfunit.outputs.fargparse_dir }}" \ + -DWSJT_ENABLE_TESTS=ON \ + -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \ + -DWSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL}" \ + -DWSJT_RC_NUMBER="${WSJT_RC_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 }}" \ + -DFARGPARSE_DIR="${{ steps.windows-deps.outputs.fargparse_dir }}" \ -Wno-dev - - name: Build + - name: Build and test targets run: cmake --build wsjtx-build -j$(nproc) + - name: Show ccache stats + if: always() + run: ccache --show-stats + + - name: Report suppressed ccache save + if: ${{ (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' }} + uses: actions/cache/save@v6 + with: + path: .ccache + key: ${{ steps.ccache.outputs.cache-primary-key }} + - name: Run tests id: ctest - run: ctest --output-on-failure --output-junit ctest-results.xml + run: | + # Tests that link wsjt_qt (e.g. test_jtty_txstream) pull in the + # rig-control code, so their exe imports libhamlib-4.dll. Hamlib is + # built --enable-shared into hamlib-prefix, so hamlib-prefix/bin must + # be on PATH for the test to load — the mingw runtime DLLs are already + # reachable via /mingw64/bin, but hamlib-prefix is not. Without this + # the test exits 0xc0000135 (STATUS_DLL_NOT_FOUND) at launch. The + # packaged installer is unaffected: cpack's bundle_fixup copies + # 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 working-directory: wsjtx-build - name: Publish test summary @@ -203,12 +286,22 @@ jobs: path: wsjtx-build/ctest-results.xml if-no-files-found: ignore + # MAP65 builds by default again. Under OPENMP_ONLY, m65impl resolves + # wsjt_fort_common to wsjt_fort_omp, so this keeps the Windows Fortran + # linkage covered by CI. - name: Verify binary run: | file wsjtx-build/jt9.exe - test -x wsjtx-build/map65/map65.exe + file wsjtx-build/map65/map65.exe + test -f wsjtx-build/map65/map65.exe - - name: Stage install + # Install to a staging prefix so bundle_fixup runs: its install(CODE) + # step copies Qt and dependent runtime DLLs next to the installed + # executables, making bin/ self-contained. Build-tree binaries are NOT + # self-contained (they resolve Qt/libgfortran/libgomp via /mingw64/bin), + # so the launch check below must run against the staged install, not the + # build tree — otherwise it would fail for binaries that ship fine. + - name: Stage install (runs bundle_fixup) run: | WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") cmake --install wsjtx-build --prefix "${WORKSPACE}/stage-main" @@ -219,17 +312,35 @@ jobs: WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") test -f "${WORKSPACE}/stage-main/bin/map65.exe" test -f "${WORKSPACE}/stage-main/bin/qmap.exe" - test -f "${WORKSPACE}/stage-main/bin/wsjtx.exe" - test -f "${WORKSPACE}/stage-main/bin/jt9.exe" bash .github/scripts/audit-staged-dll-imports-windows.sh \ "${WORKSPACE}/stage-main/bin" \ - "${WORKSPACE}/stage-main/bin/map65.exe" \ - "${WORKSPACE}/stage-main/bin/qmap.exe" \ + "${WORKSPACE}"/stage-main/bin/*.exe \ + "${WORKSPACE}"/stage-main/bin/*.dll + + - name: Smoke-launch staged WSJT-X (clean PATH) + id: wsjtx_smoke + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + .github/scripts/smoke-launch-windows.sh \ "${WORKSPACE}/stage-main/bin/wsjtx.exe" \ - "${WORKSPACE}/stage-main/bin/jt9.exe" + --startup-smoke-test --rig-name CI-STARTUP - # Emit an NSIS installer containing the full CLI tool set - # (wsjtx.exe, jt9, wsprd, fmtave, fcal, fmeasure + WSJT_BUILD_UTILS + - name: Upload WSJT-X startup diagnostics + if: failure() && steps.wsjtx_smoke.outcome == 'failure' + uses: actions/upload-artifact@v7 + with: + name: wsjtx-startup-smoke-windows + path: launch.out + if-no-files-found: ignore + retention-days: 7 + + - name: Smoke-launch staged jt9 (clean PATH) + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + .github/scripts/smoke-launch-windows.sh "${WORKSPACE}/stage-main/bin/jt9.exe" --help + + # 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. @@ -246,50 +357,28 @@ jobs: # wsjtx-<inputs.version>-win64.exe. release.yml's prepare job # enforces numeric-base parity; this override covers the # suffix gap. - cpack -G NSIS -V \ - -D CPACK_PACKAGE_VERSION="${{ inputs.version }}" \ - -D CPACK_PACKAGE_FILE_NAME="wsjtx-${{ inputs.version }}-win64" + cpack_args=( + -G NSIS + -D CPACK_PACKAGE_VERSION="${VERSION}" + -D CPACK_PACKAGE_FILE_NAME="wsjtx-${VERSION}-win64" + ) + if [ "${CPACK_VERBOSE:-0}" = "1" ]; then + cpack_args+=(-V) + fi + cpack "${cpack_args[@]}" ls -la *.exe - test -x map65/map65.exe - # Self-signed ephemeral signing — the signing step is wired into the - # pipeline, but the signature does NOT chain to a trusted root. This - # is intentional: Authenticode certification is a separate decision - # (CI/CD adoption decision #5). Generates an ephemeral cert per-run. - - name: Sign installer with self-signed ephemeral cert + - name: Verify installer has no Authenticode signature + shell: pwsh run: | - cd wsjtx-build - INSTALLER=$(ls wsjtx-${{ inputs.version }}-*.exe | head -1) - if [ -z "$INSTALLER" ]; then - echo "ERROR: no NSIS installer produced by cpack" - ls -la - exit 1 - fi - echo "Unsigned installer: $INSTALLER" - # MSYS2 auto-converts arguments starting with '/' into Windows paths - # (e.g., '/CN=...' becomes 'D:/a/_temp/msys64/CN=...'). - # MSYS2_ARG_CONV_EXCL="*" disables that conversion for this command. - MSYS2_ARG_CONV_EXCL="*" openssl req -x509 -newkey rsa:2048 \ - -keyout ephemeral-key.pem -out ephemeral-cert.pem \ - -days 365 -nodes \ - -subj "/CN=WSJT-X Ephemeral Dev Signing/O=WSJTX/C=US" - SIGNED="${INSTALLER%.exe}-signed.exe" - osslsigncode sign \ - -certs ephemeral-cert.pem -key ephemeral-key.pem \ - -n "WSJT-X Installer" \ - -i "https://github.com/WSJTX/wsjtx-internal" \ - -h sha256 \ - -in "$INSTALLER" -out "$SIGNED" - mv "$SIGNED" "$INSTALLER" - rm -f ephemeral-key.pem ephemeral-cert.pem - echo "Signed installer: $INSTALLER" - osslsigncode verify "$INSTALLER" || true - # Exit 0: osslsigncode verify returns non-zero on CA-untrust even - # when the signature itself is structurally valid. The ephemeral - # cert is self-signed by design; the "|| true" keeps CI green. - # Structural presence is proven by the sign step succeeding above. + $installer = Get-Item "wsjtx-build/wsjtx-${{ inputs.version }}-win64.exe" + $signature = Get-AuthenticodeSignature $installer.FullName + if ($signature.Status -ne 'NotSigned') { + throw "Installer Authenticode status is $($signature.Status), expected NotSigned" + } - name: Upload installer artifact + id: upload_installer uses: actions/upload-artifact@v7 with: name: wsjtx-${{ inputs.version }}-windows-x86_64-installer @@ -301,6 +390,5 @@ jobs: name: wsjtx-${{ inputs.version }}-windows-x86_64 path: | wsjtx-build/jt9.exe - wsjtx-build/map65/map65.exe wsjtx-build/wsprd.exe wsjtx-build/wsjtx.exe diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1bf639a..70ce9fe4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,92 +2,262 @@ name: CI on: push: - branches: [develop] + branches: [develop, "release/**"] pull_request: - branches: [develop] + branches: [develop, "release/**"] + # `labeled` is added to the defaults (opened/synchronize/reopened) so + # that applying `full-ci`, `sanitizers`, or `thread-sanitizer` to an + # already-open PR triggers + # a fresh run that includes the requested opt-in jobs (see the gates below). + types: [opened, synchronize, reopened, labeled] workflow_dispatch: + inputs: + recache: + description: "Force recompilation and persist refreshed ccache objects on develop" + required: false + type: boolean + default: false + save_ccache: + description: "Persist Linux ccache objects without forcing recompilation on develop" + required: false + type: boolean + default: false + armhf_image_tag: + description: "Immutable paired ARMHF image tag; empty resolves the promoted generation" + required: false + type: string + default: "" + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +permissions: + contents: read + packages: read jobs: # Single source of truth for the project version string: read it from - # CMakeLists.txt so CI and release.yml cannot disagree. Strip the + # release-state.txt so CI and release builds cannot disagree. Strip the # 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: 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 }} + build_linux_packages: ${{ steps.packaging-policy.outputs.build_packages }} steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + - name: Validate workflow job timeouts + run: .github/scripts/validate-workflow-timeouts.py + - name: Run CI policy self-tests + run: | + .github/scripts/validate-ci-inputs.sh --self-test + .github/scripts/is-linux-ci-image-input.sh --self-test + .github/scripts/select-ccache-key-suffix.sh --self-test + .github/scripts/select-linux-ccache-save.sh --self-test + .github/scripts/select-linux-packaging.sh --self-test + .github/scripts/test-linux-ccache-compiler-signature.sh + .github/scripts/test-verify-linux-ci-image.sh + python3 -m unittest discover -s .github/scripts/tests -p 'test_*.py' - id: v run: | - VERSION=$(grep -E '^\s*VERSION\s+[0-9]' CMakeLists.txt | head -1 | awk '{print $2}' | cut -d. -f1-3) - if [ -z "$VERSION" ]; then - echo "::error::Could not derive VERSION from CMakeLists.txt" - exit 1 + 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" + # PRs can consume develop caches, so only trusted develop executions may + # publish the Linux cache shared with later pull-request builds. + - id: ccache-policy + name: Select Linux ccache save policy + env: + EVENT_NAME: ${{ github.event_name }} + REQUEST_SAVE_CCACHE: ${{ inputs.save_ccache || false }} + RECACHE: ${{ inputs.recache || false }} + run: .github/scripts/select-linux-ccache-save.sh + - 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 + 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 + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'full-ci') + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REQUESTED_TAG: ${{ inputs.armhf_image_tag || '' }} + run: | + if [[ -n "$REQUESTED_TAG" ]]; then + echo "Using requested ARMHF CI image generation: $REQUESTED_TAG" + echo "image_tag=$REQUESTED_TAG" >> "$GITHUB_OUTPUT" + else + RESOLVE_ARMHF=true .github/scripts/resolve-linux-ci-image-tag.py fi - echo "Derived version from CMakeLists.txt: $VERSION" - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - macos-arm64-qt: - needs: prepare - uses: ./.github/workflows/prepare-macos-qt.yml - with: - arch: "arm64" - runner: "macos-15" - deployment_target: "11.0" - - macos-intel-qt: - needs: prepare - uses: ./.github/workflows/prepare-macos-qt.yml - with: - arch: "x86_64" - runner: "macos-15-intel" - deployment_target: "10.13" + # Two-tier CI to conserve Actions minutes. The default path runs one Linux + # x86_64 smoke leg; sanitizer and broader platform coverage are opt-in. + # + # * Default (every push / PR to develop): Linux x86_64 only -- `linux`. + # * ASan + UBSan: runs on PRs carrying `sanitizers` or `full-ci`. + # * TSan: runs only on PRs carrying `thread-sanitizer`. + # * Opt-in matrix (`linux-arm`, `linux-armhf`, macos, macos-intel, windows): runs when a + # PR carries the `full-ci` label, or when the workflow is started manually + # ("Run workflow" / workflow_dispatch). Release builds are unaffected -- + # they run the full matrix via release.yml on build/v* tags. + # + # Every non-prepare leg also `needs: linux`, so a break that fails + # everywhere fails fast on the cheapest runner before any costly leg + # starts, instead of burning them in parallel. `prepare` stays in `needs` + # for its version output. macos: - needs: [prepare, macos-arm64-qt] + needs: [prepare, linux] + # Opt-in only -- see the two-tier note above. + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'full-ci') uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" + hamlib_branch: "4.7.2" arch: "arm64" runner: "macos-15" deployment_target: "11.0" - secrets: inherit + recache: ${{ inputs.recache || false }} + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} macos-intel: - needs: [prepare, macos-intel-qt] + needs: [prepare, linux] + # Opt-in only -- see the two-tier note above. + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'full-ci') uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" + hamlib_branch: "4.7.2" arch: "x86_64" runner: "macos-15-intel" deployment_target: "10.13" - secrets: inherit + recache: ${{ inputs.recache || false }} + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} linux: - needs: prepare + needs: [prepare] uses: ./.github/workflows/build-linux.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" + hamlib_branch: "4.7.2" arch: "x86_64" + image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + allow_stale_image: true + recache: ${{ inputs.recache || false }} + 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: + name: Linux x86_64 ASan + UBSan + needs: [prepare, linux] + if: >- + contains(github.event.pull_request.labels.*.name, 'full-ci') || + contains(github.event.pull_request.labels.*.name, 'sanitizers') + uses: ./.github/workflows/build-linux-sanitizers.yml + with: + hamlib_branch: "4.7.2" + sanitizer: asan-ubsan + image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + allow_stale_image: true + recache: ${{ inputs.recache || false }} + advisory: true + + linux-tsan: + name: Linux x86_64 TSan + needs: [prepare, linux] + if: contains(github.event.pull_request.labels.*.name, 'thread-sanitizer') + uses: ./.github/workflows/build-linux-sanitizers.yml + with: + hamlib_branch: "4.7.2" + sanitizer: tsan + recache: ${{ inputs.recache || false }} + advisory: true + linux-arm: - needs: prepare + needs: [prepare, linux] + # Opt-in only -- see the two-tier note above. + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'full-ci') uses: ./.github/workflows/build-linux.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" + hamlib_branch: "4.7.2" arch: "aarch64" + image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + allow_stale_image: true + 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. + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'full-ci') + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: "armhf" + image_tag: ${{ needs.prepare.outputs.armhf_image_tag }} + allow_stale_image: true + 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: - needs: prepare + needs: [prepare, linux] + # Opt-in only -- see the two-tier note above. + if: >- + github.event_name == 'workflow_dispatch' || + contains(github.event.pull_request.labels.*.name, 'full-ci') uses: ./.github/workflows/build-windows.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - secrets: inherit + 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/hamlib-upstream-check.yml b/.github/workflows/hamlib-upstream-check.yml index 01add999..121babd1 100644 --- a/.github/workflows/hamlib-upstream-check.yml +++ b/.github/workflows/hamlib-upstream-check.yml @@ -12,9 +12,12 @@ permissions: jobs: check: + # Mirrored to the public repo at GA; upstream watch runs internal-only. + if: github.repository == 'WSJTX/wsjtx-internal' runs-on: ubuntu-latest + timeout-minutes: 10 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: persist-credentials: false @@ -90,10 +93,14 @@ jobs: Update \`hamlib_branch\` in: - - \`.github/workflows/ci.yml\` (five jobs) - - \`.github/workflows/release.yml\` (five jobs) + - \`.github/workflows/ci.yml\` (six target jobs) + - \`.github/workflows/release.yml\` (six target jobs) + - \`.github/scripts/linux-ci-image-config.sh\` + - \`.github/scripts/tsan-linux-deps-config.sh\` - Open a PR against \`develop\`, let CI run on all five platforms, then merge. + Update both exact commits, publish and validate a candidate Linux + image generation, update the remaining platform pins, then let CI run + on all six targets. ## Notes diff --git a/.github/workflows/prepare-macos-qt.yml b/.github/workflows/prepare-macos-qt.yml deleted file mode 100644 index de9f5fe5..00000000 --- a/.github/workflows/prepare-macos-qt.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Prepare macOS Qt - -on: - workflow_call: - inputs: - arch: - description: "Target architecture (arm64 or x86_64)" - required: true - type: string - runner: - description: "GitHub Actions runner label" - required: true - type: string - deployment_target: - description: "macOS deployment target version" - required: true - type: string - -jobs: - qt-cache-key: - runs-on: ubuntu-latest - outputs: - key: ${{ steps.qt-key.outputs.key }} - steps: - - uses: actions/checkout@v6 - - - name: Compute Qt cache key - id: qt-key - run: | - .github/scripts/macos-qt-cache-key.sh \ - --arch "${{ inputs.arch }}" \ - --runner "${{ inputs.runner }}" \ - --deployment-target "${{ inputs.deployment_target }}" \ - --github-output - - prepare: - needs: qt-cache-key - runs-on: ${{ inputs.runner }} - concurrency: - group: ${{ needs.qt-cache-key.outputs.key }} - cancel-in-progress: false - steps: - - uses: actions/checkout@v6 - - - name: Restore Qt cache - id: qt-cache - uses: actions/cache/restore@v5 - with: - path: qt-prefix - key: ${{ needs.qt-cache-key.outputs.key }} - - - name: Build Qt - if: steps.qt-cache.outputs.cache-hit != 'true' - run: | - .github/scripts/build-qt-macos.sh \ - --arch "${{ inputs.arch }}" \ - --deployment-target "${{ inputs.deployment_target }}" \ - --prefix "${GITHUB_WORKSPACE}/qt-prefix" - - - name: Verify Qt prefix - run: | - .github/scripts/verify-macos-artifacts.sh \ - --target "${{ inputs.deployment_target }}" \ - --arch "${{ inputs.arch }}" \ - --allow-prefix "${GITHUB_WORKSPACE}/qt-prefix" \ - "${GITHUB_WORKSPACE}/qt-prefix" - - - name: Save Qt cache - if: steps.qt-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v5 - with: - path: qt-prefix - key: ${{ needs.qt-cache-key.outputs.key }} diff --git a/.github/workflows/promote-release.yml b/.github/workflows/promote-release.yml new file mode 100644 index 00000000..9a3ccf6d --- /dev/null +++ b/.github/workflows/promote-release.yml @@ -0,0 +1,190 @@ +name: Promote Release Source + +on: + workflow_dispatch: + inputs: + version: + description: "Version without v (X.Y.Z or X.Y.Z-rcN)" + required: true + type: string + candidate_run_id: + description: "Successful Prepare Release Candidate workflow run" + required: true + type: string + operation: + description: "Validate only, or copy the exact source tag to the public repository" + required: true + type: choice + options: [validate, promote] + default: validate + +permissions: + actions: read + contents: read + +jobs: + validate: + runs-on: ubuntu-latest + timeout-minutes: 20 + outputs: + sha: ${{ steps.candidate.outputs.sha }} + public_tag: ${{ steps.candidate.outputs.public_tag }} + channel: ${{ steps.candidate.outputs.channel }} + prior_master: ${{ steps.public.outputs.prior_master }} + tag_exists: ${{ steps.public.outputs.tag_exists }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 + persist-credentials: false + - name: Validate candidate run and immutable tag + id: candidate + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ inputs.version }} + RUN_ID: ${{ inputs.candidate_run_id }} + run: | + set -euo pipefail + if [[ ! "$RUN_ID" =~ ^[0-9]+$ ]]; then + echo "::error::candidate_run_id must be numeric" + exit 1 + fi + IDENTITY=$(python3 .github/scripts/release-policy.py classify "$VERSION") + BRANCH=$(jq -r .release_branch <<<"$IDENTITY") + CHANNEL=$(jq -r .channel <<<"$IDENTITY") + TAG="build/v$VERSION" + + RUN=$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID") + if [ "$(jq -r .path <<<"$RUN")" != ".github/workflows/release-tag-helper.yml" ] || \ + [ "$(jq -r .conclusion <<<"$RUN")" != success ]; then + echo "::error::Run $RUN_ID must be a successful release-tag-helper.yml run" + exit 1 + fi + 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" + 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" + + CANDIDATE_DIR="$RUNNER_TEMP/release-candidate" + gh run download "$RUN_ID" --name "release-candidate-$VERSION" --dir "$CANDIDATE_DIR" + PROVENANCE=$(find "$CANDIDATE_DIR" -name candidate-provenance.json -type f -print -quit) + if [ -z "$PROVENANCE" ]; then + echo "::error::Candidate provenance was not found in run $RUN_ID" + exit 1 + fi + test "$(jq -r .tag "$PROVENANCE")" = "$TAG" + test "$(jq -r .commit "$PROVENANCE")" = "$TAG_SHA" + test "$(jq -r .version "$PROVENANCE")" = "$VERSION" + { + echo "sha=$TAG_SHA" + echo "tag=$TAG" + echo "public_tag=v$VERSION" + echo "branch=$BRANCH" + echo "channel=$CHANNEL" + } >> "$GITHUB_OUTPUT" + + - name: Validate public ref state + id: public + env: + PUBLIC_TAG: ${{ steps.candidate.outputs.public_tag }} + 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" + + - name: Summarize validation + env: + VERSION: ${{ inputs.version }} + RUN_ID: ${{ inputs.candidate_run_id }} + SHA: ${{ steps.candidate.outputs.sha }} + CHANNEL: ${{ steps.candidate.outputs.channel }} + PRIOR_MASTER: ${{ steps.public.outputs.prior_master }} + run: | + { + echo "## Public source validation" + echo + echo "- Version: \`$VERSION\` ($CHANNEL)" + echo "- Candidate run: [\`$RUN_ID\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$RUN_ID)" + echo "- Exact commit: \`$SHA\`" + echo "- Public tag: \`v$VERSION\`" + echo "- Prior public master: \`${PRIOR_MASTER:-<none>}\`" + } >> "$GITHUB_STEP_SUMMARY" + + promote: + if: inputs.operation == 'promote' + needs: validate + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: source-promotion + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + fetch-depth: 0 + ref: ${{ needs.validate.outputs.sha }} + persist-credentials: false + - 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 }} + run: | + set -euo pipefail + if [ -z "$TOKEN" ]; then + echo "::error::CROSS_REPO_TOKEN is required for source promotion" + 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 diff --git a/.github/workflows/public-release.yml b/.github/workflows/public-release.yml new file mode 100644 index 00000000..14d4e611 --- /dev/null +++ b/.github/workflows/public-release.yml @@ -0,0 +1,389 @@ +name: Build and Publish Public Release + +on: + push: + tags: ["v*"] + +permissions: + contents: read + +concurrency: + group: public-release-${{ github.ref }} + cancel-in-progress: false + +jobs: + prepare: + if: github.repository == 'WSJTX/wsjtx' + runs-on: ubuntu-latest + timeout-minutes: 10 + outputs: + version: ${{ steps.identity.outputs.version }} + release_channel: ${{ steps.identity.outputs.channel }} + rc_number: ${{ steps.identity.outputs.rc_number }} + macos_sign_mode: ${{ steps.identity.outputs.macos_sign_mode }} + windows_signing: ${{ steps.identity.outputs.windows_signing }} + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - name: Validate public release tag and source identity + id: identity + env: + MACOS_DISTRIBUTION_SIGNING_ENABLED: ${{ vars.MACOS_DISTRIBUTION_SIGNING_ENABLED }} + run: | + set -euo pipefail + if [[ ! "$GITHUB_REF_NAME" =~ ^v(.+)$ ]]; then + echo "::error::Expected vX.Y.Z or vX.Y.Z-rcN" + exit 1 + fi + VERSION="${GITHUB_REF_NAME#v}" + 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" + if [ "$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 + + macos: + needs: prepare + uses: ./.github/workflows/build-macos.yml + permissions: + actions: read + contents: read + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + 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: + needs: prepare + uses: ./.github/workflows/build-macos.yml + permissions: + actions: read + contents: read + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + 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] + uses: ./.github/workflows/build-linux.yml + permissions: + actions: read + contents: read + packages: read + with: + version: ${{ needs.prepare.outputs.version }} + 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 }} + build_packages: true + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} + + linux-arm: + needs: [prepare, linux-images] + uses: ./.github/workflows/build-linux.yml + permissions: + actions: read + contents: read + packages: read + with: + version: ${{ needs.prepare.outputs.version }} + 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 }} + build_packages: true + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} + + linux-armhf: + needs: [prepare, linux-images] + uses: ./.github/workflows/build-linux.yml + permissions: + actions: read + contents: read + packages: read + with: + version: ${{ needs.prepare.outputs.version }} + 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 }} + build_packages: true + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} + + windows: + needs: prepare + uses: ./.github/workflows/sign-windows-release.yml + permissions: + actions: read + contents: read + with: + version: ${{ needs.prepare.outputs.version }} + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} + windows_signing: ${{ needs.prepare.outputs.windows_signing }} + + assemble: + needs: [prepare, linux-images, macos, macos-intel, linux, linux-arm, linux-armhf, windows] + runs-on: ubuntu-latest + timeout-minutes: 30 + permissions: + actions: read + contents: read + packages: read + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: actions/download-artifact@v8 + with: + path: artifacts + - name: Build corresponding source archive + env: + VERSION: ${{ needs.prepare.outputs.version }} + run: | + set -euo pipefail + git archive --format=tar --prefix="wsjtx-$VERSION/" "$GITHUB_SHA" | + gzip -n > "artifacts/wsjtx-$VERSION-src.tar.gz" + test -s "artifacts/wsjtx-$VERSION-src.tar.gz" + python3 .github/scripts/release-policy.py validate-archive "$VERSION" \ + "artifacts/wsjtx-$VERSION-src.tar.gz" --commit "$GITHUB_SHA" + - name: Verify GitHub automatic source archives + env: + VERSION: ${{ needs.prepare.outputs.version }} + run: | + set -euo pipefail + curl --fail --location --retry 3 \ + "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz" \ + --output "$RUNNER_TEMP/github-source.tar.gz" + curl --fail --location --retry 3 \ + "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.zip" \ + --output "$RUNNER_TEMP/github-source.zip" + python3 .github/scripts/release-policy.py validate-archive "$VERSION" \ + "$RUNNER_TEMP/github-source.tar.gz" --commit "$GITHUB_SHA" + python3 .github/scripts/release-policy.py validate-archive "$VERSION" \ + "$RUNNER_TEMP/github-source.zip" --commit "$GITHUB_SHA" + - name: Verify public artifacts and signing reports + env: + VERSION: ${{ needs.prepare.outputs.version }} + MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} + WINDOWS_MODE: ${{ needs.prepare.outputs.windows_signing }} + run: | + set -euo pipefail + python3 .github/scripts/release-policy.py verify-assets "$VERSION" artifacts \ + --macos-mode "$MACOS_MODE" --windows-mode "$WINDOWS_MODE" + python3 .github/scripts/release-policy.py verify-signing-reports "$VERSION" artifacts \ + --commit "$GITHUB_SHA" --tag "$GITHUB_REF_NAME" \ + --macos-mode "$MACOS_MODE" --windows-mode "$WINDOWS_MODE" + - name: Generate checksums and release manifest + env: + VERSION: ${{ needs.prepare.outputs.version }} + MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} + WINDOWS_MODE: ${{ needs.prepare.outputs.windows_signing }} + run: | + python3 .github/scripts/release-policy.py write-manifest "$VERSION" artifacts \ + --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 }}" \ + --macos-mode "$MACOS_MODE" --windows-mode "$WINDOWS_MODE" + - name: Assemble publication bundle + env: + VERSION: ${{ needs.prepare.outputs.version }} + MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} + WINDOWS_MODE: ${{ needs.prepare.outputs.windows_signing }} + run: | + set -euo pipefail + mkdir -p release-bundle/verification + while IFS= read -r file; do + cp "$file" release-bundle/ + done < <(python3 .github/scripts/release-policy.py release-files "$VERSION" artifacts \ + --macos-mode "$MACOS_MODE" --windows-mode "$WINDOWS_MODE") + cp artifacts/SHA256SUMS artifacts/release-manifest.json release-bundle/ + cp -R artifacts/macos-signing-report-* release-bundle/verification/ + if [ "$WINDOWS_MODE" = signpath ]; then + cp -R artifacts/wsjtx-*-windows-signing-request \ + artifacts/wsjtx-*-windows-signing-verification \ + release-bundle/verification/ + fi + - name: Upload publication bundle for approval + uses: actions/upload-artifact@v7 + with: + name: release-bundle-${{ needs.prepare.outputs.version }} + path: release-bundle + if-no-files-found: error + retention-days: 30 + + publish: + needs: [prepare, assemble] + runs-on: ubuntu-latest + timeout-minutes: 20 + environment: public-release + permissions: + actions: read + contents: write + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: actions/download-artifact@v8 + with: + name: release-bundle-${{ needs.prepare.outputs.version }} + path: release-bundle + - name: Recheck bundle and immutable public tag + env: + VERSION: ${{ needs.prepare.outputs.version }} + MACOS_MODE: ${{ needs.prepare.outputs.macos_sign_mode }} + WINDOWS_MODE: ${{ needs.prepare.outputs.windows_signing }} + run: | + set -euo pipefail + (cd release-bundle && sha256sum --check 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 '.assets | length' release-bundle/release-manifest.json)" -gt 0 + EXPECTED_MACOS_MODE=distribution + if [ "$MACOS_MODE" = validation ]; then + EXPECTED_MACOS_MODE=manual + fi + test "$(jq -r .macos_signing.mode release-bundle/release-manifest.json)" = "$EXPECTED_MACOS_MODE" + test "$(jq -r .windows_signing.mode release-bundle/release-manifest.json)" = "$WINDOWS_MODE" + python3 .github/scripts/release-policy.py classify "$VERSION" >/dev/null + TAG_SHA=$(git ls-remote origin "refs/tags/$GITHUB_REF_NAME" | awk '{print $1}') + if [ "$TAG_SHA" != "$GITHUB_SHA" ]; then + echo "::error::$GITHUB_REF_NAME now resolves to ${TAG_SHA:-missing}, expected $GITHUB_SHA" + exit 1 + fi + - name: Publish public GitHub Release + env: + 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) + 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) + if [ "$(jq -r .isDraft <<<"$RELEASE")" != false ]; then + echo "::error::Existing release $GITHUB_REF_NAME is unexpectedly a draft." + exit 1 + fi + EXPECTED_PRERELEASE=false + if [ "$CHANNEL" = RC ]; then + EXPECTED_PRERELEASE=true + fi + if [ "$(jq -r .isPrerelease <<<"$RELEASE")" != "$EXPECTED_PRERELEASE" ]; then + echo "::error::Existing release $GITHUB_REF_NAME has the wrong prerelease state." + exit 1 + fi + mapfile -t ACTUAL_NAMES < <(jq -r '.assets[].name' <<<"$RELEASE" | sort) + EXTRA=$(comm -13 \ + <(printf '%s\n' "${EXPECTED_NAMES[@]}") \ + <(printf '%s\n' "${ACTUAL_NAMES[@]}") || true) + if [ -n "$EXTRA" ]; then + echo "::error::Existing release contains assets outside the publication bundle:" + printf '%s\n' "$EXTRA" + exit 1 + fi + mkdir -p "$RUNNER_TEMP/existing-assets" + MISSING=() + for file in "${FILES[@]}"; do + name=$(basename "$file") + if [ "$MACOS_MODE" = validation ] && [[ "$name" == wsjtx-*-macOS.pkg ]]; then + if printf '%s\n' "${ACTUAL_NAMES[@]}" | grep -Fxq "$name"; then + echo "Preserving manually replaceable macOS asset: $name" + else + MISSING+=("$file") + fi + continue + fi + if gh release download "$GITHUB_REF_NAME" --pattern "$name" --dir "$RUNNER_TEMP/existing-assets"; then + cmp "$file" "$RUNNER_TEMP/existing-assets/$name" || { + echo "::error::Published asset $name differs; automatic replacement is forbidden." + exit 1 + } + else + MISSING+=("$file") + fi + done + if [ "${#MISSING[@]}" -gt 0 ]; then + gh release upload "$GITHUB_REF_NAME" "${MISSING[@]}" + fi + mapfile -t FINAL_NAMES < <(gh release view "$GITHUB_REF_NAME" --json assets --jq '.assets[].name' | sort) + if ! diff -u \ + <(printf '%s\n' "${EXPECTED_NAMES[@]}") \ + <(printf '%s\n' "${FINAL_NAMES[@]}"); then + echo "::error::Published asset set does not match the publication bundle." + exit 1 + fi + echo "Existing assets satisfy the publication bundle policy." + else + FLAGS=() + if [ "$CHANNEL" = RC ]; then + FLAGS+=(--prerelease) + fi + gh release create "$GITHUB_REF_NAME" \ + --verify-tag \ + --title "WSJT-X $VERSION" \ + --generate-notes \ + "${FLAGS[@]}" \ + "${FILES[@]}" + CREATED=true + fi + if [ "$CREATED" = true ]; then + QUICK_DOWNLOADS=$(python3 .github/scripts/generate-quick-downloads.py \ + "$GITHUB_REPOSITORY" "$GITHUB_REF_NAME" "${FILES[@]}" || true) + if [ -n "$QUICK_DOWNLOADS" ]; then + GENERATED_NOTES=$(gh release view "$GITHUB_REF_NAME" --json body --jq .body) + printf '%s\n\n---\n\n%s\n' "$QUICK_DOWNLOADS" "$GENERATED_NOTES" > "$RUNNER_TEMP/release-notes.md" + gh release edit "$GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/release-notes.md" + else + echo "::warning::Quick Downloads picker was empty; generated notes were left unchanged." + fi + fi diff --git a/.github/workflows/publish-linux-ci-images.yml b/.github/workflows/publish-linux-ci-images.yml new file mode 100644 index 00000000..e1bc4c30 --- /dev/null +++ b/.github/workflows/publish-linux-ci-images.yml @@ -0,0 +1,632 @@ +name: Publish Linux CI Images + +on: + workflow_call: + inputs: + publication_target: + description: "Image destination: internal or public-release" + required: false + type: string + default: "internal" + mode: + description: "Refresh or rollback" + required: false + type: string + default: "refresh" + promote: + description: "Promote candidates after every validation succeeds" + required: false + type: boolean + default: true + rollback_tag: + description: "Retained validated-build-* tag to promote when mode is rollback" + required: false + type: string + default: "" + include_armhf: + description: "Build and validate the ARMHF cross-builder/runtime pair" + required: false + type: boolean + default: false + image_set: + description: "Image cohort: normal, tsan, or normal-and-tsan" + required: false + type: string + default: "normal" + outputs: + image_tag: + description: "Immutable tag shared by the published image cohort" + value: ${{ jobs.metadata.outputs.build_tag }} + x86_64_digest: + description: "Digest of the linux-noble release image" + value: ${{ jobs.build-normal.outputs.digest }} + aarch64_digest: + description: "Digest of the linux-arm64-bookworm release image" + value: ${{ jobs.build-arm64.outputs.digest }} + armhf_digest: + description: "Digest of the linux-armv7-bookworm release image" + value: ${{ jobs.build-armhf-runtime.outputs.digest }} + armhf_cross_digest: + description: "Digest of the linux-armhf-cross-bookworm release image" + value: ${{ jobs.build-armhf-cross.outputs.digest }} + workflow_dispatch: + inputs: + mode: + description: "Build a new generation or roll stable back to a retained tag" + required: true + type: choice + options: + - refresh + - rollback + default: refresh + promote: + description: "Promote candidates after every validation succeeds" + required: false + type: boolean + default: true + rollback_tag: + description: "Retained validated-build-* tag to promote when mode is rollback" + required: false + type: string + default: "" + include_armhf: + description: "Build and validate the ARMHF cross-builder/runtime pair" + required: false + type: boolean + default: false + image_set: + description: "Images to publish or roll back" + required: true + type: choice + options: + - normal + - tsan + - normal-and-tsan + default: normal + publication_target: + description: "Image destination" + required: true + type: choice + options: + - internal + - public-release + default: internal + +permissions: + contents: read + packages: write + +concurrency: + group: linux-ci-image-publishing + cancel-in-progress: false + +jobs: + validate-inputs: + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - name: Validate publication request + env: + MODE: ${{ inputs.mode }} + ROLLBACK_TAG: ${{ inputs.rollback_tag }} + IMAGE_SET: ${{ inputs.image_set }} + INCLUDE_ARMHF: ${{ inputs.include_armhf }} + PROMOTE: ${{ inputs.promote }} + REQUEST_REF: ${{ github.ref }} + REQUEST_REPOSITORY: ${{ github.repository }} + PUBLICATION_TARGET: ${{ inputs.publication_target }} + shell: bash + run: | + case "$MODE" in + refresh) + if [ -n "$ROLLBACK_TAG" ]; then + echo "::error::rollback_tag must be empty in refresh mode" + exit 2 + fi + ;; + rollback) + if [[ ! "$ROLLBACK_TAG" =~ ^validated-build-[0-9]{8}-[0-9]+-[0-9]+$ ]]; then + echo "::error::rollback_tag must identify a validated retained generation" + exit 2 + fi + ;; + *) + echo "::error::Unsupported publication mode: $MODE" + exit 2 + ;; + esac + + case "$IMAGE_SET" in + normal|tsan|normal-and-tsan) ;; + *) + echo "::error::Unsupported image_set: $IMAGE_SET" + exit 2 + ;; + esac + + case "$PUBLICATION_TARGET" in + internal) ;; + public-release) + if [ "$REQUEST_REPOSITORY" != WSJTX/wsjtx ]; then + 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" + exit 2 + fi + if [ "$MODE" != refresh ] || [ "$PROMOTE" != false ] || \ + [ "$IMAGE_SET" != normal ] || [ "$INCLUDE_ARMHF" != true ]; then + echo "::error::Public release images require refresh, promote=false, image_set=normal, and include_armhf=true" + exit 2 + fi + ;; + *) + echo "::error::Unsupported publication_target: $PUBLICATION_TARGET" + exit 2 + ;; + esac + + if [ "$IMAGE_SET" = tsan ] && [ "$INCLUDE_ARMHF" = true ]; then + echo "::error::include_armhf is valid only when normal images are selected" + exit 2 + fi + + if { [ "$MODE" = rollback ] || [ "$PROMOTE" = true ]; } && \ + [ "$REQUEST_REF" != refs/heads/develop ]; then + echo "::error::Promotion and rollback must run from refs/heads/develop" + exit 2 + fi + + metadata: + if: inputs.mode != 'rollback' + needs: validate-inputs + runs-on: ubuntu-24.04 + timeout-minutes: 10 + outputs: + build_tag: ${{ steps.metadata.outputs.build_tag }} + candidate_tag: ${{ steps.metadata.outputs.candidate_tag }} + created: ${{ steps.metadata.outputs.created }} + version: ${{ steps.metadata.outputs.version }} + normal_hamlib_ref: ${{ steps.metadata.outputs.normal_hamlib_ref }} + tsan_hamlib_ref: ${{ steps.metadata.outputs.tsan_hamlib_ref }} + normal_noble_recipe: ${{ steps.metadata.outputs.normal_noble_recipe }} + normal_bookworm_recipe: ${{ steps.metadata.outputs.normal_bookworm_recipe }} + armhf_cross_recipe: ${{ steps.metadata.outputs.armhf_cross_recipe }} + armhf_runtime_recipe: ${{ steps.metadata.outputs.armhf_runtime_recipe }} + tsan_noble_recipe: ${{ steps.metadata.outputs.tsan_noble_recipe }} + refresh_epoch: ${{ steps.metadata.outputs.refresh_epoch }} + package_root: ${{ steps.metadata.outputs.package_root }} + normal_cache_from: ${{ steps.metadata.outputs.normal_cache_from }} + arm64_cache_from: ${{ steps.metadata.outputs.arm64_cache_from }} + armhf_cross_cache_from: ${{ steps.metadata.outputs.armhf_cross_cache_from }} + armhf_cache_from: ${{ steps.metadata.outputs.armhf_cache_from }} + steps: + - uses: actions/checkout@v7 + - id: metadata + env: + IMAGE_SET: ${{ inputs.image_set }} + PUBLICATION_TARGET: ${{ inputs.publication_target }} + shell: bash + run: | + created="$(date -u +%Y-%m-%dT%H:%M:%SZ)" + date_tag="$(date -u +%Y%m%d)" + version="$(awk -F= '$1 == "version" {print $2; exit}' release-state.txt)" + if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Could not derive a numeric version from release-state.txt" + exit 1 + fi + { + if [ "$PUBLICATION_TARGET" = public-release ]; then + release_tag="release-${GITHUB_REF_NAME}-${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + echo "build_tag=$release_tag" + echo "candidate_tag=candidate-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + 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_cache_from=type=gha,scope=public-release-linux-armv7-bookworm" + else + echo "build_tag=build-${date_tag}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + echo "candidate_tag=candidate-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + 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_cache_from=type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-armv7-bookworm:stable" + fi + echo "created=$created" + echo "version=$version" + echo "refresh_epoch=$(date -u +%Y-%m)" + if [ "$IMAGE_SET" != tsan ]; then + . .github/scripts/linux-ci-image-config.sh + echo "normal_hamlib_ref=$LINUX_HAMLIB_REF" + echo "normal_noble_recipe=$(.github/scripts/linux-ci-image-fingerprint.sh normal-noble)" + echo "normal_bookworm_recipe=$(.github/scripts/linux-ci-image-fingerprint.sh normal-bookworm)" + echo "armhf_cross_recipe=$(.github/scripts/linux-ci-image-fingerprint.sh armhf-cross-bookworm)" + echo "armhf_runtime_recipe=$(.github/scripts/linux-ci-image-fingerprint.sh armhf-runtime-bookworm)" + fi + if [ "$IMAGE_SET" != normal ]; then + . .github/scripts/tsan-linux-deps-config.sh + echo "tsan_hamlib_ref=$TSAN_HAMLIB_REF" + echo "tsan_noble_recipe=$(.github/scripts/linux-ci-image-fingerprint.sh tsan-noble)" + fi + } >> "$GITHUB_OUTPUT" + + build-normal: + if: inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan' + needs: metadata + runs-on: ubuntu-24.04 + timeout-minutes: 120 + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v7 + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: build + uses: docker/build-push-action@v7 + with: + context: . + file: .github/images/linux-ci/Dockerfile.noble + target: normal + platforms: linux/amd64 + push: true + provenance: false + sbom: false + labels: ${{ inputs.publication_target == 'public-release' && 'org.opencontainers.image.source=https://github.com/WSJTX/wsjtx' || '' }} + tags: | + ${{ needs.metadata.outputs.package_root }}/linux-noble:${{ needs.metadata.outputs.candidate_tag }} + ${{ needs.metadata.outputs.package_root }}/linux-noble:${{ needs.metadata.outputs.build_tag }} + build-args: | + IMAGE_CREATED=${{ needs.metadata.outputs.created }} + IMAGE_GENERATION=${{ needs.metadata.outputs.build_tag }} + IMAGE_REVISION=${{ github.sha }} + IMAGE_RECIPE_SHA256=${{ needs.metadata.outputs.normal_noble_recipe }} + IMAGE_REFRESH_EPOCH=${{ needs.metadata.outputs.refresh_epoch }} + cache-from: ${{ needs.metadata.outputs.normal_cache_from }} + cache-to: type=inline + + build-tsan: + if: inputs.image_set == 'tsan' || inputs.image_set == 'normal-and-tsan' + needs: metadata + runs-on: ubuntu-24.04 + timeout-minutes: 240 + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v7 + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: build + uses: docker/build-push-action@v7 + with: + context: . + file: .github/images/linux-ci/Dockerfile.noble + target: tsan + platforms: linux/amd64 + push: true + provenance: false + sbom: false + labels: ${{ inputs.publication_target == 'public-release' && 'org.opencontainers.image.source=https://github.com/WSJTX/wsjtx' || '' }} + tags: | + ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble:${{ needs.metadata.outputs.candidate_tag }} + ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble:${{ needs.metadata.outputs.build_tag }} + build-args: | + IMAGE_CREATED=${{ needs.metadata.outputs.created }} + IMAGE_GENERATION=${{ needs.metadata.outputs.build_tag }} + IMAGE_REVISION=${{ github.sha }} + IMAGE_RECIPE_SHA256=${{ needs.metadata.outputs.tsan_noble_recipe }} + IMAGE_REFRESH_EPOCH=${{ needs.metadata.outputs.refresh_epoch }} + cache-from: type=registry,ref=ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble:stable + cache-to: type=inline + + build-arm64: + if: inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan' + needs: metadata + runs-on: ubuntu-24.04-arm + timeout-minutes: 120 + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v7 + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: build + uses: docker/build-push-action@v7 + with: + context: . + file: .github/images/linux-ci/Dockerfile.bookworm + platforms: linux/arm64 + push: true + provenance: false + sbom: false + labels: ${{ inputs.publication_target == 'public-release' && 'org.opencontainers.image.source=https://github.com/WSJTX/wsjtx' || '' }} + tags: | + ${{ needs.metadata.outputs.package_root }}/linux-arm64-bookworm:${{ needs.metadata.outputs.candidate_tag }} + ${{ needs.metadata.outputs.package_root }}/linux-arm64-bookworm:${{ needs.metadata.outputs.build_tag }} + build-args: | + IMAGE_ARCH=aarch64 + IMAGE_CREATED=${{ needs.metadata.outputs.created }} + IMAGE_GENERATION=${{ needs.metadata.outputs.build_tag }} + IMAGE_REVISION=${{ github.sha }} + IMAGE_RECIPE_SHA256=${{ needs.metadata.outputs.normal_bookworm_recipe }} + IMAGE_REFRESH_EPOCH=${{ needs.metadata.outputs.refresh_epoch }} + cache-from: ${{ needs.metadata.outputs.arm64_cache_from }} + cache-to: type=inline + + build-armhf-cross: + if: >- + inputs.include_armhf && + (inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan') + needs: metadata + runs-on: ubuntu-24.04 + timeout-minutes: 180 + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v7 + - name: Reclaim disk for the ARMHF cross-toolchain + run: | + # crosstool-NG needs about 8 GiB of transient build storage. Remove + # unused hosted-runner SDKs so the Actions worker retains log space. + df -h / + sudo rm -rf -- /usr/local/lib/android /usr/share/dotnet /opt/ghc + df -h / + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: build + uses: docker/build-push-action@v7 + with: + context: . + file: .github/images/linux-ci/Dockerfile.armhf-cross + platforms: linux/amd64 + push: true + provenance: false + sbom: false + labels: ${{ inputs.publication_target == 'public-release' && 'org.opencontainers.image.source=https://github.com/WSJTX/wsjtx' || '' }} + tags: | + ${{ needs.metadata.outputs.package_root }}/linux-armhf-cross-bookworm:${{ needs.metadata.outputs.candidate_tag }} + ${{ needs.metadata.outputs.package_root }}/linux-armhf-cross-bookworm:${{ needs.metadata.outputs.build_tag }} + build-args: | + IMAGE_CREATED=${{ needs.metadata.outputs.created }} + IMAGE_GENERATION=${{ needs.metadata.outputs.build_tag }} + IMAGE_REVISION=${{ github.sha }} + 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 + + build-armhf-runtime: + if: >- + inputs.include_armhf && + (inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan') + needs: + - metadata + - build-armhf-cross + runs-on: ubuntu-24.04-arm + timeout-minutes: 180 + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v7 + - uses: docker/setup-qemu-action@v4 + with: + image: tonistiigi/binfmt:qemu-v10.2.3-68@sha256:400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0 + platforms: linux/arm/v7 + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: build + uses: docker/build-push-action@v7 + with: + context: . + file: .github/images/linux-ci/Dockerfile.armhf-runtime + platforms: linux/arm/v7 + push: true + provenance: false + sbom: false + labels: ${{ inputs.publication_target == 'public-release' && 'org.opencontainers.image.source=https://github.com/WSJTX/wsjtx' || '' }} + tags: | + ${{ needs.metadata.outputs.package_root }}/linux-armv7-bookworm:${{ needs.metadata.outputs.candidate_tag }} + ${{ needs.metadata.outputs.package_root }}/linux-armv7-bookworm:${{ needs.metadata.outputs.build_tag }} + build-args: | + CROSS_BUILDER_IMAGE=${{ needs.metadata.outputs.package_root }}/linux-armhf-cross-bookworm:${{ needs.metadata.outputs.build_tag }} + IMAGE_CREATED=${{ needs.metadata.outputs.created }} + IMAGE_GENERATION=${{ needs.metadata.outputs.build_tag }} + IMAGE_REVISION=${{ github.sha }} + IMAGE_RECIPE_SHA256=${{ needs.metadata.outputs.armhf_runtime_recipe }} + IMAGE_REFRESH_EPOCH=${{ needs.metadata.outputs.refresh_epoch }} + cache-from: ${{ needs.metadata.outputs.armhf_cache_from }} + cache-to: type=inline + + warm-normal-ccache: + if: >- + inputs.promote && + (inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan') + needs: + - metadata + - build-normal + uses: ./.github/workflows/build-linux.yml + permissions: + contents: read + packages: read + with: + version: ${{ needs.metadata.outputs.version }} + hamlib_branch: ${{ needs.metadata.outputs.normal_hamlib_ref }} + arch: x86_64 + image_tag: ${{ needs.metadata.outputs.build_tag }} + allow_stale_image: false + recache: false + save_ccache: true + + warm-arm64-ccache: + if: >- + inputs.promote && + (inputs.image_set == 'normal' || inputs.image_set == 'normal-and-tsan') + needs: + - metadata + - build-arm64 + uses: ./.github/workflows/build-linux.yml + permissions: + contents: read + packages: read + with: + version: ${{ needs.metadata.outputs.version }} + hamlib_branch: ${{ needs.metadata.outputs.normal_hamlib_ref }} + arch: aarch64 + image_tag: ${{ needs.metadata.outputs.build_tag }} + allow_stale_image: false + recache: false + save_ccache: true + + promote: + if: >- + always() && inputs.mode == 'refresh' && inputs.promote && + (inputs.image_set == 'tsan' || + (needs.build-normal.result == 'success' && + needs.build-arm64.result == 'success' && + needs.warm-normal-ccache.result == 'success' && + needs.warm-arm64-ccache.result == 'success' && + (inputs.include_armhf == false || + (needs.build-armhf-cross.result == 'success' && needs.build-armhf-runtime.result == 'success')))) && + (inputs.image_set == 'normal' || needs.build-tsan.result == 'success') + needs: + - metadata + - build-normal + - build-tsan + - build-arm64 + - build-armhf-cross + - build-armhf-runtime + - warm-normal-ccache + - warm-arm64-ccache + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Promote validated image digests + env: + VALIDATED_TAG: validated-${{ needs.metadata.outputs.build_tag }} + INCLUDE_ARMHF: ${{ inputs.include_armhf }} + IMAGE_SET: ${{ inputs.image_set }} + shell: bash + run: | + if [ "$IMAGE_SET" != tsan ]; then + docker buildx imagetools create --prefer-index=false \ + --tag "ghcr.io/wsjtx/wsjtx-internal/linux-noble:${VALIDATED_TAG}" \ + ghcr.io/wsjtx/wsjtx-internal/linux-noble@${{ needs.build-normal.outputs.digest }} + docker buildx imagetools create --prefer-index=false \ + --tag "ghcr.io/wsjtx/wsjtx-internal/linux-arm64-bookworm:${VALIDATED_TAG}" \ + ghcr.io/wsjtx/wsjtx-internal/linux-arm64-bookworm@${{ needs.build-arm64.outputs.digest }} + if [ "$INCLUDE_ARMHF" = true ]; then + docker buildx imagetools create --prefer-index=false \ + --tag "ghcr.io/wsjtx/wsjtx-internal/linux-armhf-cross-bookworm:${VALIDATED_TAG}" \ + ghcr.io/wsjtx/wsjtx-internal/linux-armhf-cross-bookworm@${{ needs.build-armhf-cross.outputs.digest }} + docker buildx imagetools create --prefer-index=false \ + --tag "ghcr.io/wsjtx/wsjtx-internal/linux-armv7-bookworm:${VALIDATED_TAG}" \ + ghcr.io/wsjtx/wsjtx-internal/linux-armv7-bookworm@${{ needs.build-armhf-runtime.outputs.digest }} + fi + fi + if [ "$IMAGE_SET" != normal ]; then + docker buildx imagetools create --prefer-index=false \ + --tag "ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble:${VALIDATED_TAG}" \ + ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble@${{ needs.build-tsan.outputs.digest }} + fi + + if [ "$IMAGE_SET" != normal ]; then + docker buildx imagetools create --prefer-index=false \ + --tag ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble:stable \ + ghcr.io/wsjtx/wsjtx-internal/linux-tsan-noble@${{ needs.build-tsan.outputs.digest }} + fi + if [ "$IMAGE_SET" != tsan ]; then + docker buildx imagetools create --prefer-index=false \ + --tag ghcr.io/wsjtx/wsjtx-internal/linux-arm64-bookworm:stable \ + ghcr.io/wsjtx/wsjtx-internal/linux-arm64-bookworm@${{ needs.build-arm64.outputs.digest }} + if [ "$INCLUDE_ARMHF" = true ]; then + docker buildx imagetools create --prefer-index=false \ + --tag ghcr.io/wsjtx/wsjtx-internal/linux-armhf-cross-bookworm:stable \ + ghcr.io/wsjtx/wsjtx-internal/linux-armhf-cross-bookworm@${{ needs.build-armhf-cross.outputs.digest }} + docker buildx imagetools create --prefer-index=false \ + --tag ghcr.io/wsjtx/wsjtx-internal/linux-armv7-bookworm:stable \ + ghcr.io/wsjtx/wsjtx-internal/linux-armv7-bookworm@${{ needs.build-armhf-runtime.outputs.digest }} + fi + # linux-noble:stable moves last within the normal image cohort. + docker buildx imagetools create --prefer-index=false \ + --tag ghcr.io/wsjtx/wsjtx-internal/linux-noble:stable \ + ghcr.io/wsjtx/wsjtx-internal/linux-noble@${{ needs.build-normal.outputs.digest }} + fi + + rollback: + if: inputs.mode == 'rollback' + needs: validate-inputs + runs-on: ubuntu-24.04 + timeout-minutes: 15 + steps: + - uses: docker/setup-buildx-action@v4 + - uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Restore retained generation + env: + ROLLBACK_TAG: ${{ inputs.rollback_tag }} + INCLUDE_ARMHF: ${{ inputs.include_armhf }} + IMAGE_SET: ${{ inputs.image_set }} + shell: bash + run: | + packages=() + stable_packages=() + if [ "$IMAGE_SET" != tsan ]; then + packages+=(linux-noble linux-arm64-bookworm) + stable_packages+=(linux-arm64-bookworm) + if [ "$INCLUDE_ARMHF" = true ]; then + packages+=(linux-armhf-cross-bookworm linux-armv7-bookworm) + stable_packages+=(linux-armhf-cross-bookworm linux-armv7-bookworm) + fi + # linux-noble:stable moves last within the normal image cohort. + stable_packages+=(linux-noble) + fi + if [ "$IMAGE_SET" != normal ]; then + packages+=(linux-tsan-noble) + if [ "$IMAGE_SET" = tsan ]; then + stable_packages=(linux-tsan-noble) + else + stable_packages=(linux-tsan-noble "${stable_packages[@]}") + fi + fi + + for package in "${packages[@]}"; do + docker buildx imagetools inspect \ + "ghcr.io/wsjtx/wsjtx-internal/${package}:${ROLLBACK_TAG}" >/dev/null + done + + for package in "${stable_packages[@]}"; do + docker buildx imagetools create --prefer-index=false \ + --tag "ghcr.io/wsjtx/wsjtx-internal/${package}:stable" \ + "ghcr.io/wsjtx/wsjtx-internal/${package}:${ROLLBACK_TAG}" + done diff --git a/.github/workflows/release-tag-helper.yml b/.github/workflows/release-tag-helper.yml new file mode 100644 index 00000000..c8cc375e --- /dev/null +++ b/.github/workflows/release-tag-helper.yml @@ -0,0 +1,126 @@ +name: Prepare Release Candidate + +on: + workflow_dispatch: + inputs: + version: + description: "Version without v (X.Y.Z or X.Y.Z-rcN)" + required: true + type: string + expected_sha: + description: "Full SHA at the tip of release/X.Y" + required: true + type: string + operation: + description: "Validate only, or create the immutable candidate tag and start its build" + required: true + type: choice + options: [validate, create] + default: validate + +permissions: + actions: read + contents: write + +jobs: + prepare: + runs-on: ubuntu-latest + timeout-minutes: 15 + environment: candidate-tagging + outputs: + candidate_tag: ${{ steps.validate.outputs.candidate_tag }} + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - name: Fetch release branches and tags + run: git fetch origin '+refs/heads/release/*:refs/remotes/origin/release/*' '+refs/tags/*:refs/tags/*' + - name: Validate release commit + id: validate + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ inputs.version }} + EXPECTED_SHA: ${{ inputs.expected_sha }} + run: | + set -euo pipefail + if [[ ! "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]]; then + echo "::error::expected_sha must be a full 40-character lowercase commit SHA" + exit 1 + fi + IDENTITY=$(python3 .github/scripts/release-policy.py classify "$VERSION") + BRANCH=$(jq -r .release_branch <<<"$IDENTITY") + if [ "$GITHUB_SHA" != "$EXPECTED_SHA" ]; then + echo "::error::Run this workflow from $BRANCH at $EXPECTED_SHA" + exit 1 + fi + BRANCH_SHA=$(git rev-parse --verify --quiet "refs/remotes/origin/$BRANCH^{commit}" || true) + if [ "$BRANCH_SHA" != "$EXPECTED_SHA" ]; then + echo "::error::$BRANCH tip is ${BRANCH_SHA:-missing}, expected $EXPECTED_SHA" + exit 1 + fi + git checkout --detach "$EXPECTED_SHA" + python3 .github/scripts/release-policy.py validate-source "$VERSION" + + 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]') + if [ -z "$CI_RUN" ] || [ "$CI_RUN" = null ]; then + echo "::error::No completed ci.yml run found for $EXPECTED_SHA" + exit 1 + fi + CI_ID=$(jq -r .id <<<"$CI_RUN") + CI_CONCLUSION=$(jq -r .conclusion <<<"$CI_RUN") + if [ "$CI_CONCLUSION" != success ]; then + echo "::error::Latest ci.yml run $CI_ID concluded $CI_CONCLUSION" + exit 1 + fi + { + echo "branch=$BRANCH" + echo "ci_run_id=$CI_ID" + echo "candidate_tag=build/v$VERSION" + } >> "$GITHUB_OUTPUT" + + - name: Verify candidate tag is create-only + id: tag + env: + VERSION: ${{ inputs.version }} + EXPECTED_SHA: ${{ inputs.expected_sha }} + run: | + .github/scripts/check-candidate-tag.sh "build/v$VERSION" "$EXPECTED_SHA" >> "$GITHUB_OUTPUT" + + - name: Create candidate tag + if: inputs.operation == 'create' && steps.tag.outputs.exists != 'true' + env: + VERSION: ${{ inputs.version }} + EXPECTED_SHA: ${{ inputs.expected_sha }} + run: | + git tag "build/v$VERSION" "$EXPECTED_SHA" + git push origin "refs/tags/build/v$VERSION:refs/tags/build/v$VERSION" + + - name: Summarize candidate preparation + env: + VERSION: ${{ inputs.version }} + EXPECTED_SHA: ${{ inputs.expected_sha }} + OPERATION: ${{ inputs.operation }} + BRANCH: ${{ steps.validate.outputs.branch }} + CI_RUN_ID: ${{ steps.validate.outputs.ci_run_id }} + run: | + { + echo "## Release candidate preparation" + echo + echo "- Version: \`$VERSION\`" + echo "- Commit: \`$EXPECTED_SHA\`" + echo "- Release branch: \`$BRANCH\`" + echo "- CI run: [\`$CI_RUN_ID\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$CI_RUN_ID)" + echo "- Operation: \`$OPERATION\`" + } >> "$GITHUB_STEP_SUMMARY" + + candidate: + if: inputs.operation == 'create' + needs: prepare + permissions: + contents: read + packages: read + uses: ./.github/workflows/release.yml + with: + candidate_tag: ${{ needs.prepare.outputs.candidate_tag }} + expected_sha: ${{ inputs.expected_sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8b9bd42..bde30629 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,359 +1,191 @@ -name: Release +name: Build Release Candidate on: - push: - tags: ["build/v*"] + workflow_call: + inputs: + candidate_tag: + description: "Immutable internal tag (build/vX.Y.Z or build/vX.Y.Z-rcN)" + required: true + type: string + expected_sha: + description: "Full commit SHA selected by the release tag helper" + required: true + type: string + +permissions: + contents: read + packages: read + +concurrency: + group: release-candidate-${{ inputs.candidate_tag }} + cancel-in-progress: false jobs: - # ── Derive the version string once from the pushed tag ──────────── - # Strips the "build/v" prefix so artifacts are named "wsjtx-3.0.1-rc1-*" - # rather than "wsjtx-build/v3.0.1-rc1-*". RC/beta suffixes (e.g. - # build/v3.0.1-rc1 → 3.0.1-rc1) are preserved so pre-release artifacts - # are distinguishable from GA. All downstream jobs consume this - # single output so the five platform artifacts cannot disagree. prepare: 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 }} + 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 }} + env: + CANDIDATE_TAG: ${{ inputs.candidate_tag }} + EXPECTED_SHA: ${{ inputs.expected_sha }} steps: - - uses: actions/checkout@v6 - - id: v + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + ref: ${{ env.CANDIDATE_TAG }} + - name: Verify immutable candidate identity + id: identity run: | - VERSION="${GITHUB_REF_NAME#build/v}" - if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - RELEASE_CHANNEL=GA - RC_NUMBER="" - elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc([1-9][0-9]*)$ ]]; then - RELEASE_CHANNEL=RC - RC_NUMBER="${BASH_REMATCH[1]}" - else - echo "::error::Unsupported release tag version: $VERSION" - echo "::error::Supported release tags are build/vX.Y.Z and build/vX.Y.Z-rcN." + 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" exit 1 fi - - { - echo "version=$VERSION" - echo "release_channel=$RELEASE_CHANNEL" - echo "rc_number=$RC_NUMBER" - } >> "$GITHUB_OUTPUT" - - # Enforce that the pushed tag's numeric version base - # matches CMakeLists.txt:55 VERSION (first 3 components). CMake's - # VERSION field is numeric-only and cannot carry pre-release - # suffixes like -rc1 or -beta1, so this check compares the tag - # version stripped of any `-<suffix>` against the first three - # dotted components of CMakeLists.txt VERSION. Mismatch means the - # release commit forgot to bump CMakeLists.txt in lockstep with - # the tag; fail fast here before five platform builds burn ~30 - # minutes of CI. - - name: Verify tag ↔ CMakeLists.txt version parity - run: | - TAG_VERSION="${GITHUB_REF_NAME#build/v}" - TAG_NUMERIC="${TAG_VERSION%%-*}" - CMAKE_VERSION=$(sed -nE 's/^[[:space:]]*VERSION[[:space:]]+([0-9][0-9.]*).*/\1/p' CMakeLists.txt | head -1) - CMAKE_NUMERIC=$(echo "$CMAKE_VERSION" | awk -F. '{printf "%s.%s.%s", $1, $2, $3}') - echo "Tag version: $TAG_VERSION (numeric base: $TAG_NUMERIC)" - echo "CMakeLists.txt VER: $CMAKE_VERSION (first 3 components: $CMAKE_NUMERIC)" - if [ "$TAG_NUMERIC" != "$CMAKE_NUMERIC" ]; then - echo "::error::Tag numeric base ($TAG_NUMERIC) != CMakeLists.txt VERSION first 3 components ($CMAKE_NUMERIC)." - echo "::error::Bump CMakeLists.txt:55 VERSION in the same commit that gets tagged, then retry." + ACTUAL_SHA=$(git rev-parse HEAD) + if [ "$ACTUAL_SHA" != "$EXPECTED_SHA" ]; then + echo "::error::Candidate tag resolves to $ACTUAL_SHA, expected $EXPECTED_SHA" exit 1 fi - echo "Parity check PASSED." - - # ── Build all five platforms ─────────────────────────────────────── - macos-arm64-qt: - needs: prepare - uses: ./.github/workflows/prepare-macos-qt.yml - with: - arch: "arm64" - runner: "macos-15" - deployment_target: "11.0" - - macos-intel-qt: - needs: prepare - uses: ./.github/workflows/prepare-macos-qt.yml - with: - arch: "x86_64" - runner: "macos-15-intel" - deployment_target: "10.13" + VERSION="${CANDIDATE_TAG#build/v}" + 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 macos: - needs: [prepare, macos-arm64-qt] + needs: prepare uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "arm64" - runner: "macos-15" + hamlib_branch: "4.7.2" + arch: arm64 + runner: macos-15 deployment_target: "11.0" release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit + signing_mode: validation macos-intel: - needs: [prepare, macos-intel-qt] + needs: prepare uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "x86_64" + hamlib_branch: "4.7.2" + 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 }} - runner: "macos-15-intel" - deployment_target: "10.13" - secrets: inherit + signing_mode: validation linux: needs: prepare uses: ./.github/workflows/build-linux.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "x86_64" + hamlib_branch: "4.7.2" + arch: x86_64 + image_tag: ${{ needs.prepare.outputs.linux_image_tag }} + save_ccache: true + build_packages: true release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit linux-arm: needs: prepare uses: ./.github/workflows/build-linux.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" - arch: "aarch64" + hamlib_branch: "4.7.2" + arch: aarch64 + image_tag: ${{ needs.prepare.outputs.linux_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. + linux-armhf: + needs: prepare + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.2" + arch: armhf + image_tag: ${{ needs.prepare.outputs.armhf_image_tag }} + allow_stale_image: true + save_ccache: true + build_packages: true release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit windows: needs: prepare uses: ./.github/workflows/build-windows.yml with: version: ${{ needs.prepare.outputs.version }} - hamlib_branch: "4.7.1" + hamlib_branch: "4.7.2" release_channel: ${{ needs.prepare.outputs.release_channel }} rc_number: ${{ needs.prepare.outputs.rc_number }} - secrets: inherit - # ── Publish release + sync to public repo ────────────────────────── - release: - needs: [prepare, macos, macos-intel, linux, linux-arm, windows] + candidate-ready: + needs: [prepare, macos, macos-intel, linux, linux-arm, linux-armhf, windows] runs-on: ubuntu-latest - permissions: - contents: write + timeout-minutes: 15 steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Download all artifacts - uses: actions/download-artifact@v8 + - uses: actions/checkout@v7 + - uses: actions/download-artifact@v8 with: path: artifacts - - # Source tarball is published on GA releases only, not on RC (-rc*, - # -beta*, etc.) pre-releases. Rationale: RCs may carry code for features - # that are not yet intended for open source distribution (limited-access - # field testing). GA releases always include a source tarball per the - # CI/CD adoption decision on platform-matrix assets. - - name: Build source tarball (GA only) - if: ${{ !contains(github.ref_name, '-') }} - env: - VERSION: ${{ needs.prepare.outputs.version }} - run: | - # This repo has no git submodules, so git archive's default - # single-tree output captures the full source. If submodules - # are ever added, this step must be revisited — git archive - # does not recurse into submodules on its own. - git archive \ - --format=tar.gz \ - --prefix="wsjtx-${VERSION}/" \ - -o "artifacts/wsjtx-${VERSION}-src.tar.gz" \ - "${GITHUB_REF_NAME}" - ls -lh "artifacts/wsjtx-${VERSION}-src.tar.gz" - - - name: List artifacts - run: find artifacts -type f | sort - - # ── All-platforms-ready gate ─────────────────────────────────────── - # Refuse to publish unless every platform produced an installer-grade - # artifact. The release job's `needs:` already enforces structural - # success (all 5 builds ran and exited 0), but a build can exit 0 - # without actually packaging — e.g. a packaging step behind an `if:` - # that evaluated false, or an upload-artifact step that silently - # matched zero files. This gate fails the release job BEFORE any - # asset upload so partial releases never reach GitHub Releases or - # the public mirror. - # - # Expected artifact layout (one installer per platform, per the - # five build-*.yml upload-artifact steps): - # artifacts/wsjtx-<ver>-arm64-macOS.pkg/*.pkg - # artifacts/wsjtx-<ver>-x86_64-macOS.pkg/*.pkg - # artifacts/wsjtx-<ver>-linux-x86_64-AppImage/*.AppImage - # artifacts/wsjtx-<ver>-linux-aarch64-AppImage/*.AppImage - # artifacts/wsjtx-<ver>-windows-x86_64-installer/*.exe - # - # Policy: publish only when all five platforms have produced an - # installer-grade artifact. Adjust or remove this step if the - # policy evolves (e.g. to publish any-platform-ready). - - name: Verify installer-grade artifacts (all-platforms-ready gate) - env: - VERSION: ${{ needs.prepare.outputs.version }} - run: | - shopt -s nullglob - labels=( - "macOS arm64 .pkg" - "macOS x86_64 .pkg" - "Linux x86_64 .AppImage" - "Linux aarch64 .AppImage" - "Windows x86_64 .exe" - ) - patterns=( - "artifacts/wsjtx-${VERSION}-arm64-macOS.pkg/*.pkg" - "artifacts/wsjtx-${VERSION}-x86_64-macOS.pkg/*.pkg" - "artifacts/wsjtx-${VERSION}-linux-x86_64-AppImage/*.AppImage" - "artifacts/wsjtx-${VERSION}-linux-aarch64-AppImage/*.AppImage" - "artifacts/wsjtx-${VERSION}-windows-x86_64-installer/*.exe" - ) - missing=0 - echo "Installer-grade artifact gate — checking 5 platforms…" - for i in "${!labels[@]}"; do - # shellcheck disable=SC2206 # word-split is intentional; nullglob makes it safe. - matches=( ${patterns[$i]} ) - if [ ${#matches[@]} -eq 0 ]; then - echo "::error::MISSING ${labels[$i]} — no match for ${patterns[$i]}" - missing=$((missing + 1)) - else - size=$(stat --printf '%s' "${matches[0]}") - printf ' ok %-22s %s (%s bytes)\n' "${labels[$i]}" "${matches[0]}" "$size" - fi - done - if [ "$missing" -gt 0 ]; then - echo "::error::All-platforms-ready gate FAILED — $missing of 5 platform(s) missing installer-grade artifact." - echo "::error::Refusing to publish a partial release. Fix the failing build job(s) and retry the tag." - exit 1 - fi - echo "All-platforms-ready gate PASSED — all 5 installer-grade artifacts present. Proceeding to publish." - - - name: Create GitHub Release - env: - GH_TOKEN: ${{ github.token }} - run: | - TAG="${GITHUB_REF_NAME}" - # Filter to user-facing release assets. `find artifacts -type f` - # without filtering pulls in 5× ctest-results.xml (one per - # platform) and per-binary tarballs from individual-binaries-* - # that collide on basename across architectures — `gh release - # create` uses basenames as asset names and duplicates cause - # upload failures. - mapfile -t files < <(find artifacts -maxdepth 2 -type f \ - \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ - -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) - # SemVer pre-release tags contain a hyphen after the version - # (e.g., v3.0.1-rc1, v3.0.1-rc2, v3.0.1-beta1). Flag those as - # GitHub pre-releases so they don't appear as the latest stable. - PRERELEASE_FLAG="" - if [[ "$TAG" == *-* ]]; then - PRERELEASE_FLAG="--prerelease" - fi - gh release create "$TAG" \ - --title "WSJT-X ${{ needs.prepare.outputs.version }}" \ - --generate-notes \ - $PRERELEASE_FLAG \ - "${files[@]}" - - # ── Public mirror: GA only ───────────────────────────────────────── - # RC/beta tags (any tag carrying a '-' in the version, e.g. - # build/v3.0.1-rc1) stay internal — the public WSJTX/wsjtx repo is - # for stable releases only. The Build source tarball step above - # uses the same predicate; mirror logic must too. - - # Defense-in-depth: the workflow trigger already constrains - # github.ref_name to tags matching build/v*, but if this job - # ever runs outside that trigger (workflow_dispatch, manual - # re-run with a fork ref, misconfiguration) the force-push - # below would overwrite WSJTX/wsjtx:master with arbitrary content. - # Abort here if the ref doesn't match the expected release-tag - # shape. - - name: Verify release tag format (GA only) - if: ${{ !contains(github.ref_name, '-') }} - run: | - if [[ "$GITHUB_REF_TYPE" != "tag" || "$GITHUB_REF_NAME" != build/v* ]]; then - echo "::error::Refusing to sync — expected tag build/v*, got $GITHUB_REF_TYPE:$GITHUB_REF_NAME" - exit 1 - fi - - - name: Push to public repo (GA only) - if: ${{ !contains(github.ref_name, '-') }} - env: - TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} + - name: Verify all candidate artifacts + run: python3 .github/scripts/release-policy.py verify-assets "${{ needs.prepare.outputs.version }}" artifacts + - name: Verify candidate packaging reports run: | - # A "successful" release that silently skips the mirror sync is - # the worst failure mode — it looks green in Actions but leaves - # users unable to download. Fail loud instead. - if [ -z "$TOKEN" ]; then - echo "::error::CROSS_REPO_TOKEN not set — refusing to publish without public-mirror sync" - exit 1 - fi - # Use CROSS_REPO_TOKEN (PAT with Contents:write on WSJTX/wsjtx) - # over HTTPS. Idempotent: on job re-run the remote already exists, - # so skip add. - if ! git remote get-url public >/dev/null 2>&1; then - git remote add public "https://x-access-token:${TOKEN}@github.com/WSJTX/wsjtx.git" - fi - - # Strip "build/" prefix per public release convention. Public - # users search for "v3.0.1", not "build/v3.0.1". Internal tag - # stays as-is for the wsjtx-internal release. - PUBLIC_TAG="${GITHUB_REF_NAME#build/}" - - # Derive the bare-prefix tag locally so the workflow doesn't - # depend on the team having pushed both tag forms. -f overwrites - # any pre-existing local tag at a stale SHA. - git tag -f "$PUBLIC_TAG" "$GITHUB_REF_NAME" - - # Human-auditable record of what the force-push is overwriting. - # If public master doesn't exist yet, ls-remote returns empty — - # still safe, just logs "no prior SHA". - PRIOR_SHA=$(git ls-remote public master | awk '{print $1}') - LOCAL_SHA=$(git rev-parse HEAD) - echo "Public mirror force-push audit:" - echo " internal tag: $GITHUB_REF_NAME" - echo " public tag: $PUBLIC_TAG" - echo " prior SHA: ${PRIOR_SHA:-<none>}" - echo " new SHA: $LOCAL_SHA" - - # --force retained per CI/CD adoption decision #3 (option a): - # automate the existing sync pattern. The v3.0.0 tag SHAs already - # match on both repos, so the force-push aligns history rather - # than rewrites it in the normal release case. - git push public HEAD:master --force - git push public "refs/tags/${PUBLIC_TAG}:refs/tags/${PUBLIC_TAG}" - - # Create the public-side GitHub Release with installer assets - # attached. Without this step, public-side Releases page is empty - # after a mirror push (source + tag, no downloadables) and end users - # can't find the artifacts. - - name: Create public GitHub Release (GA only) - if: ${{ !contains(github.ref_name, '-') }} + python3 .github/scripts/release-policy.py verify-signing-reports \ + "${{ needs.prepare.outputs.version }}" artifacts \ + --commit "${{ inputs.expected_sha }}" --tag "${{ inputs.candidate_tag }}" \ + --macos-mode validation --windows-mode unsigned + - name: Record candidate provenance env: - GH_TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} VERSION: ${{ needs.prepare.outputs.version }} + CANDIDATE_TAG: ${{ inputs.candidate_tag }} + CANDIDATE_SHA: ${{ inputs.expected_sha }} + WINDOWS_RELEASE_MODE: ${{ needs.prepare.outputs.windows_signing }} run: | - PUBLIC_TAG="${GITHUB_REF_NAME#build/}" - # Same asset filter as the internal release. Re-find rather than - # carrying a list — keeps the all-platforms-ready gate, internal - # release, and public release mechanically aligned on one filter. - mapfile -t files < <(find artifacts -maxdepth 2 -type f \ - \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ - -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) - gh release create "$PUBLIC_TAG" \ - -R WSJTX/wsjtx \ - --title "WSJT-X ${VERSION}" \ - --generate-notes \ - "${files[@]}" + jq -n \ + --arg version "$VERSION" \ + --arg tag "$CANDIDATE_TAG" \ + --arg commit "$CANDIDATE_SHA" \ + --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"}}' \ + > artifacts/candidate-provenance.json + - name: Upload complete candidate + uses: actions/upload-artifact@v7 + with: + name: release-candidate-${{ needs.prepare.outputs.version }} + path: artifacts + if-no-files-found: error + retention-days: 30 diff --git a/.github/workflows/sign-windows-release.yml b/.github/workflows/sign-windows-release.yml new file mode 100644 index 00000000..a040ab43 --- /dev/null +++ b/.github/workflows/sign-windows-release.yml @@ -0,0 +1,142 @@ +name: Sign Windows Release + +on: + workflow_call: + inputs: + version: + required: true + type: string + release_channel: + required: true + type: string + rc_number: + required: false + type: string + default: "" + windows_signing: + required: false + type: string + default: signpath +permissions: + actions: read + contents: read + +jobs: + build: + uses: ./.github/workflows/build-windows.yml + 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' + needs: build + runs-on: ubuntu-latest + timeout-minutes: 90 + environment: windows-release-signing + permissions: + actions: read + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - name: Require a public RC or GA invocation + env: + VERSION: ${{ inputs.version }} + CHANNEL: ${{ inputs.release_channel }} + RC_NUMBER: ${{ inputs.rc_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 "$GITHUB_REPOSITORY" = WSJTX/wsjtx + - name: Submit release signing request to SignPath + id: signpath + uses: signpath/github-action-submit-signing-request@v3 + with: + api-token: ${{ secrets.SIGNPATH_API_TOKEN }} + organization-id: "4c211821-e011-48a2-8a84-2cc29a76a8bf" + project-slug: wsjtx + signing-policy-slug: release-signing + github-artifact-id: ${{ needs.build.outputs.installer-artifact-id }} + wait-for-completion: true + wait-for-completion-timeout-in-seconds: "3600" + output-artifact-directory: signed + - name: Record signing request + env: + REQUEST_URL: ${{ steps.signpath.outputs.signing-request-web-url }} + run: | + printf '{"schema":1,"provider":"SignPath","policy":"release-signing","request_url":"%s","tag":"%s","commit":"%s"}\n' \ + "$REQUEST_URL" "$GITHUB_REF_NAME" "$GITHUB_SHA" > windows-signing-request.json + - name: Upload signed installer + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: wsjtx-${{ inputs.version }}-windows-x86_64-installer-signed + path: signed/*.exe + if-no-files-found: error + - name: Upload signing request report + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: wsjtx-${{ inputs.version }}-windows-signing-request + path: windows-signing-request.json + if-no-files-found: error + + verify: + needs: sign + runs-on: windows-latest + timeout-minutes: 15 + environment: windows-release-signing + steps: + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: wsjtx-${{ inputs.version }}-windows-x86_64-installer-signed + path: signed + - name: Verify trusted Authenticode signature and timestamp + shell: pwsh + env: + EXPECTED_SIGNER_SUBJECT: ${{ vars.WINDOWS_SIGNER_SUBJECT }} + EXPECTED_SIGNER_THUMBPRINTS: ${{ vars.WINDOWS_SIGNER_THUMBPRINTS }} + run: | + $exe = Get-ChildItem signed -Filter *.exe + if ($exe.Count -ne 1) { throw "Expected exactly one signed installer" } + $signtool = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\signtool.exe" | + Sort-Object FullName | Select-Object -Last 1 + if (-not $signtool) { throw "signtool.exe not found" } + & $signtool.FullName verify /pa /all /v $exe.FullName + if ($LASTEXITCODE -ne 0) { throw "Authenticode trust verification failed" } + $signature = Get-AuthenticodeSignature $exe.FullName + if ($signature.Status -ne 'Valid') { throw "Authenticode status is $($signature.Status)" } + if (-not $signature.TimeStamperCertificate) { throw "Installer signature has no trusted timestamp" } + if (-not $env:EXPECTED_SIGNER_SUBJECT) { throw "WINDOWS_SIGNER_SUBJECT is not configured" } + if ($signature.SignerCertificate.Subject -ne $env:EXPECTED_SIGNER_SUBJECT) { + throw "Unexpected Authenticode signer subject: $($signature.SignerCertificate.Subject)" + } + $allowedThumbprints = $env:EXPECTED_SIGNER_THUMBPRINTS.Split(',') | + ForEach-Object { $_.Replace(' ', '').ToUpperInvariant() } | + Where-Object { $_ } + $actualThumbprint = $signature.SignerCertificate.Thumbprint.ToUpperInvariant() + if ($allowedThumbprints.Count -eq 0 -or $actualThumbprint -notin $allowedThumbprints) { + throw "Unexpected Authenticode signer thumbprint: $actualThumbprint" + } + $sha256 = (Get-FileHash -Algorithm SHA256 $exe.FullName).Hash.ToLowerInvariant() + [ordered]@{ + schema = 1 + tag = $env:GITHUB_REF_NAME + commit = $env:GITHUB_SHA + artifact = $exe.Name + sha256 = $sha256 + status = $signature.Status.ToString() + signer_subject = $signature.SignerCertificate.Subject + signer_thumbprint = $signature.SignerCertificate.Thumbprint + identity_verified = $true + timestamp_subject = $signature.TimeStamperCertificate.Subject + timestamp_thumbprint = $signature.TimeStamperCertificate.Thumbprint + } | ConvertTo-Json | Set-Content windows-signing-verification.json + - name: Upload verification report + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: wsjtx-${{ inputs.version }}-windows-signing-verification + path: windows-signing-verification.json + if-no-files-found: error diff --git a/.github/workflows/signpath-smoke.yml b/.github/workflows/signpath-smoke.yml new file mode 100644 index 00000000..b6aa3a41 --- /dev/null +++ b/.github/workflows/signpath-smoke.yml @@ -0,0 +1,74 @@ +name: SignPath Smoke Test + +# Signs a trivial PE through the full SignPath round trip (token, slugs, +# artifact configuration, trusted build system) without building or +# exposing WSJT source. + +on: + workflow_dispatch: + inputs: + signing-policy-slug: + description: "SignPath signing policy to exercise" + required: false + type: choice + options: + - test-signing + - release-signing + default: test-signing + +jobs: + smoke: + if: github.repository == 'WSJTX/wsjtx' + runs-on: ubuntu-latest + timeout-minutes: 90 + environment: windows-release-signing + permissions: + actions: read + contents: read + steps: + - name: Build trivial PE file + run: | + # Keep this job independent of the dispatched repository ref. It + # submits an executable with the SignPath API token below. + sudo apt-get update -q + sudo apt-get install -y -q gcc-mingw-w64-x86-64 + cat > smoke.c <<'EOF' + #include <stdio.h> + int main(void) { puts("WSJT SignPath smoke test"); return 0; } + EOF + x86_64-w64-mingw32-gcc smoke.c -o signpath-smoke.exe + file signpath-smoke.exe + + - name: Upload unsigned artifact + id: upload + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 + with: + name: signpath-smoke + path: signpath-smoke.exe + + - name: Submit signing request to SignPath + id: signpath + uses: signpath/github-action-submit-signing-request@v3 + with: + api-token: ${{ secrets.SIGNPATH_API_TOKEN }} + organization-id: "4c211821-e011-48a2-8a84-2cc29a76a8bf" + project-slug: "wsjtx" + signing-policy-slug: ${{ inputs.signing-policy-slug }} + github-artifact-id: ${{ steps.upload.outputs.artifact-id }} + wait-for-completion: true + wait-for-completion-timeout-in-seconds: "3600" + output-artifact-directory: signed + + - name: Verify returned signature + run: | + echo "Signing request: ${{ steps.signpath.outputs.signing-request-web-url }}" + sudo apt-get install -y -q osslsigncode + ls -la signed/ + # The test cert never chains to a trusted root, so chain + # verification can't gate here. Require instead that an + # Authenticode signature is present and parses as PKCS#7 — + # both commands hard-fail on an unsigned or malformed exe. + osslsigncode extract-signature -in signed/signpath-smoke.exe -out smoke-sig.der + openssl pkcs7 -inform DER -in smoke-sig.der -print_certs -noout + # Chain status, informational only: + osslsigncode verify signed/signpath-smoke.exe || true diff --git a/.github/workflows/warm-dependency-caches.yml b/.github/workflows/warm-dependency-caches.yml new file mode 100644 index 00000000..db9f6593 --- /dev/null +++ b/.github/workflows/warm-dependency-caches.yml @@ -0,0 +1,443 @@ +name: Refresh Build Caches + +on: + push: + branches: [develop] + paths: + - ".github/workflows/ci.yml" + - ".github/workflows/release.yml" + - ".github/workflows/build-linux.yml" + - ".github/workflows/warm-dependency-caches.yml" + - ".github/actions/build-linux-payload/**" + - ".github/images/linux-ci/**" + - ".github/scripts/linux-ci-image-config.sh" + - ".github/scripts/linux-ci-image-fingerprint.sh" + - ".github/scripts/linux-ci-image-inputs.sh" + - ".github/scripts/linux-ccache-compiler-signature.sh" + - ".github/scripts/select-ccache-key-suffix.sh" + - ".github/scripts/select-linux-ccache-save.sh" + - ".github/scripts/run-apt-get.sh" + - ".github/scripts/build-pfunit-linux.sh" + - ".github/scripts/build-hamlib-linux.sh" + - ".github/scripts/tsan-linux-deps-config.sh" + - ".github/scripts/build-qt-tsan-linux.sh" + - ".github/scripts/build-boost-tsan-linux.sh" + - ".github/scripts/build-hamlib-tsan-linux.sh" + - ".github/scripts/verify-linux-ci-image.sh" + - ".github/scripts/verify-tsan-deps-linux.sh" + - ".github/workflows/build-macos.yml" + - ".github/workflows/build-windows.yml" + - ".github/actions/warm-macos-deps/**" + - ".github/actions/build-windows-deps/**" + - ".github/scripts/build-*-macos.sh" + - ".github/scripts/build-*-windows.sh" + - ".github/scripts/*armhf*" + - ".github/scripts/install-*-macos*.sh" + - ".github/scripts/macos-qt-cache-key.sh" + - ".github/scripts/verify-macos-*.sh" + schedule: + - cron: "23 10 * * 1" + - cron: "17 9 1 * *" + workflow_dispatch: + inputs: + targets: + description: "Platform caches to warm" + required: false + type: choice + options: + - macos-arm64 + - macos-x86_64 + - macos + - windows + - linux + - linux-arm64 + - linux-tsan + - linux-images + - linux-retention + - all + default: macos-arm64 + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.2" + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + detect: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + packages: read + outputs: + linux_images: ${{ steps.detect.outputs.linux_images }} + linux_arm64: ${{ steps.detect.outputs.linux_arm64 }} + retention: ${{ steps.detect.outputs.retention }} + windows: ${{ steps.detect.outputs.windows }} + macos_arm64: ${{ steps.detect.outputs.macos_arm64 }} + macos_x86_64: ${{ steps.detect.outputs.macos_x86_64 }} + image_set: ${{ steps.detect.outputs.image_set }} + hamlib_branch: ${{ steps.detect.outputs.hamlib_branch }} + version: ${{ steps.detect.outputs.version }} + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 2 + + - id: detect + name: Select cache warmers + shell: bash + env: + EVENT_NAME: ${{ github.event_name }} + SCHEDULE: ${{ github.event.schedule }} + BEFORE_SHA: ${{ github.event.before }} + CURRENT_SHA: ${{ github.sha }} + TARGETS: ${{ inputs.targets || '' }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch || '4.7.2' }} + run: | + set -euo pipefail + .github/scripts/validate-ci-inputs.sh + + normal_images=false + tsan_images=false + retention=false + linux_arm64=false + windows=false + macos_arm64=false + macos_x86_64=false + + enable_cache_all() { + linux_arm64=true + windows=true + macos_arm64=true + macos_x86_64=true + } + + enable_all() { + normal_images=true + retention=true + enable_cache_all + } + + case "$EVENT_NAME" in + schedule) + retention=true + # Refresh the promoted image monthly only when no newer refresh occurred. + if [ "$SCHEDULE" = "17 9 1 * *" ] && \ + python3 .github/scripts/should-refresh-linux-ci-images.py --max-age-days 30; then + normal_images=true + tsan_images=true + elif [ "$SCHEDULE" = "23 10 * * 1" ]; then + enable_cache_all + fi + ;; + workflow_dispatch) + case "$TARGETS" in + all) + enable_all + ;; + linux|linux-images) + normal_images=true + linux_arm64=true + ;; + linux-arm64) + linux_arm64=true + ;; + linux-tsan) + tsan_images=true + ;; + linux-retention) + retention=true + ;; + windows) + windows=true + ;; + macos) + macos_arm64=true + macos_x86_64=true + ;; + macos-arm64) + macos_arm64=true + ;; + macos-x86_64) + macos_x86_64=true + ;; + *) + echo "::error::Unsupported targets input: $TARGETS" + exit 2 + ;; + esac + ;; + push) + if [ -n "$BEFORE_SHA" ] && [ "$BEFORE_SHA" != "0000000000000000000000000000000000000000" ]; then + base="$BEFORE_SHA" + else + base="${CURRENT_SHA}^" + fi + + if ! git cat-file -e "${base}^{commit}" 2>/dev/null; then + git fetch --no-tags --depth=1 origin "$base" || true + fi + + if git cat-file -e "${base}^{commit}" 2>/dev/null; then + changed="$(git diff --name-only "$base" "$CURRENT_SHA")" + else + echo "::notice::Could not compare $base..$CURRENT_SHA; warming all dependency caches" + changed="" + enable_all + tsan_images=true + fi + + while IFS= read -r path; do + [ -n "$path" ] || continue + case "$path" in + .github/workflows/ci.yml|.github/workflows/release.yml|.github/workflows/warm-dependency-caches.yml|.github/scripts/select-ccache-key-suffix.sh) + enable_cache_all + ;; + .github/workflows/build-linux.yml|.github/actions/build-linux-payload/*|.github/scripts/select-linux-ccache-save.sh) + linux_arm64=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 + ;; + .github/workflows/build-macos.yml|.github/actions/warm-macos-deps/*|.github/scripts/build-*-macos.sh|.github/scripts/install-*-macos*.sh|.github/scripts/macos-qt-cache-key.sh|.github/scripts/verify-macos-*.sh) + macos_arm64=true + macos_x86_64=true + ;; + *) + case "$(.github/scripts/is-linux-ci-image-input.sh --classify "$path")" in + normal) + normal_images=true + ;; + tsan) + tsan_images=true + ;; + normal-and-tsan) + normal_images=true + tsan_images=true + ;; + esac + ;; + esac + done <<< "$changed" + ;; + *) + echo "::error::Unsupported event: $EVENT_NAME" + exit 2 + ;; + esac + + if [ "$normal_images" = true ] && [ "$tsan_images" = true ]; then + image_set=normal-and-tsan + elif [ "$normal_images" = true ]; then + image_set=normal + elif [ "$tsan_images" = true ]; then + image_set=tsan + else + image_set=none + fi + linux_images=false + if [ "$image_set" != none ]; then + linux_images=true + fi + + VERSION=$(awk -F= '$1 == "version" {print $2; exit}' release-state.txt) + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Could not derive VERSION from release-state.txt" + exit 1 + fi + + { + echo "linux_images=$linux_images" + echo "linux_arm64=$linux_arm64" + echo "retention=$retention" + echo "windows=$windows" + echo "macos_arm64=$macos_arm64" + echo "macos_x86_64=$macos_x86_64" + echo "image_set=$image_set" + echo "hamlib_branch=$HAMLIB_BRANCH" + echo "version=$VERSION" + } >> "$GITHUB_OUTPUT" + + { + echo "## Build cache warmer selection" + echo + echo "| Target | Enabled |" + echo "| --- | --- |" + echo "| Linux GHCR image set | $image_set |" + echo "| Linux arm64 ccache | $linux_arm64 |" + 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" + + refresh-linux-images: + needs: detect + if: needs.detect.outputs.linux_images == 'true' + uses: ./.github/workflows/publish-linux-ci-images.yml + permissions: + contents: read + packages: write + with: + # ARMHF is part of the normal Linux image cohort. The reusable publisher + # validates and promotes its paired images before dependent builds resolve them. + promote: true + include_armhf: true + image_set: ${{ needs.detect.outputs.image_set }} + + retain-linux-images: + needs: [detect, refresh-linux-images] + if: >- + always() && + needs.detect.outputs.retention == 'true' && + (needs.refresh-linux-images.result == 'success' || + needs.refresh-linux-images.result == 'skipped') + runs-on: ubuntu-24.04 + timeout-minutes: 10 + permissions: + contents: read + packages: write + concurrency: + group: linux-ci-image-publishing + cancel-in-progress: false + steps: + - uses: actions/checkout@v7 + - name: Apply GHCR retention + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + APPLY: ${{ github.event_name == 'schedule' }} + shell: bash + run: | + args=( + --owner WSJTX + --max-age-days 60 + --keep 3 + --package wsjtx-internal/linux-noble + --package wsjtx-internal/linux-tsan-noble + --package wsjtx-internal/linux-arm64-bookworm + --package wsjtx-internal/linux-armhf-cross-bookworm + --package wsjtx-internal/linux-armv7-bookworm + ) + if [ "$APPLY" = true ]; then + args+=(--apply) + fi + .github/scripts/ghcr_retention.py "${args[@]}" + + warm-linux-arm64-ccache: + needs: detect + if: >- + github.ref == 'refs/heads/develop' && + needs.detect.outputs.linux_arm64 == '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 + with: + version: ${{ needs.detect.outputs.version }} + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + arch: aarch64 + save_ccache: true + + warm-windows-x86_64-deps: + needs: detect + if: needs.detect.outputs.windows == 'true' + runs-on: windows-latest + timeout-minutes: 60 + steps: + - name: Disable core.autocrlf before checkout + shell: pwsh + run: git config --global core.autocrlf false + + - uses: actions/checkout@v7 + + # Boost is source-built by build-windows-deps so the Windows 7 API floor + # and Boost.Atomic patch stay pinned; do not install MSYS2 Boost here. + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + cache: true + install: >- + git make tar curl + mingw-w64-x86_64-gcc + mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-cmake + mingw-w64-x86_64-python + mingw-w64-x86_64-pkg-config + autoconf automake libtool + + - uses: ./.github/actions/build-windows-deps + with: + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + save_caches: "true" + + warm-windows-ccache: + needs: [detect, warm-windows-x86_64-deps] + if: needs.detect.outputs.windows == 'true' + uses: ./.github/workflows/build-windows.yml + with: + version: ${{ needs.detect.outputs.version }} + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + save_ccache: true + + warm-macos-arm64-deps: + needs: detect + if: needs.detect.outputs.macos_arm64 == 'true' + runs-on: macos-15 + timeout-minutes: 40 + steps: + - uses: actions/checkout@v7 + - uses: ./.github/actions/warm-macos-deps + with: + arch: arm64 + runner: macos-15 + deployment_target: "11.0" + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + + warm-macos-x86_64-deps: + needs: detect + if: needs.detect.outputs.macos_x86_64 == 'true' + runs-on: macos-15-intel + timeout-minutes: 100 + steps: + - uses: actions/checkout@v7 + - uses: ./.github/actions/warm-macos-deps + with: + arch: x86_64 + runner: macos-15-intel + deployment_target: "10.13" + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + + warm-macos-arm64-ccache: + needs: [detect, warm-macos-arm64-deps] + if: needs.detect.outputs.macos_arm64 == 'true' + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.detect.outputs.version }} + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + arch: arm64 + runner: macos-15 + deployment_target: "11.0" + save_ccache: true + + warm-macos-x86_64-ccache: + needs: [detect, warm-macos-x86_64-deps] + if: needs.detect.outputs.macos_x86_64 == 'true' + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.detect.outputs.version }} + hamlib_branch: ${{ needs.detect.outputs.hamlib_branch }} + arch: x86_64 + runner: macos-15-intel + deployment_target: "10.13" + save_ccache: true |
