summaryrefslogtreecommitdiff
path: root/.github/scripts
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
commit059831534c7e884f0a607ed86b582fd00d821731 (patch)
tree76bcb67a78f8aa2654fd34c2ad801a62136b0170 /.github/scripts
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to '.github/scripts')
-rwxr-xr-x.github/scripts/armhf-ci-image-config.sh41
-rwxr-xr-x.github/scripts/armhf-static-ldd.sh98
-rwxr-xr-x.github/scripts/audit-armhf-cross-build.sh104
-rw-r--r--.github/scripts/audit-staged-dll-imports-windows.sh17
-rwxr-xr-x.github/scripts/build-armhf-toolchain-smoke.sh83
-rwxr-xr-x.github/scripts/build-boost-macos.sh29
-rwxr-xr-x.github/scripts/build-boost-tsan-linux.sh55
-rwxr-xr-x.github/scripts/build-boost-windows.sh87
-rwxr-xr-x.github/scripts/build-hamlib-armhf-cross.sh65
-rwxr-xr-x.github/scripts/build-hamlib-linux.sh32
-rwxr-xr-x.github/scripts/build-hamlib-macos.sh9
-rwxr-xr-x.github/scripts/build-hamlib-tsan-linux.sh52
-rwxr-xr-x.github/scripts/build-hamlib-windows.sh24
-rwxr-xr-x.github/scripts/build-linux-armhf-cross.sh62
-rwxr-xr-x.github/scripts/build-pfunit-linux.sh29
-rwxr-xr-x.github/scripts/build-pfunit-macos.sh48
-rwxr-xr-x.github/scripts/build-pfunit-windows.sh21
-rwxr-xr-x.github/scripts/build-qt-macos.sh5
-rwxr-xr-x.github/scripts/build-qt-tsan-linux.sh135
-rwxr-xr-x.github/scripts/check-candidate-tag.sh32
-rwxr-xr-x.github/scripts/deploy-macos-app.sh243
-rwxr-xr-x.github/scripts/deploy-macos-cli-tools.sh259
-rwxr-xr-x.github/scripts/generate-quick-downloads.py122
-rwxr-xr-x.github/scripts/ghcr_retention.py234
-rwxr-xr-x.github/scripts/is-linux-ci-image-input.sh127
-rw-r--r--.github/scripts/linux-artifact-validation.sh290
-rwxr-xr-x.github/scripts/linux-ccache-compiler-signature.sh157
-rwxr-xr-x.github/scripts/linux-ci-image-config.sh17
-rwxr-xr-x.github/scripts/linux-ci-image-fingerprint.sh17
-rw-r--r--.github/scripts/linux-ci-image-inputs.sh75
-rwxr-xr-x.github/scripts/list-release-assets.sh20
-rwxr-xr-x.github/scripts/normalize-armhf-sysroot-symlinks.sh30
-rwxr-xr-x.github/scripts/package-linux-armhf.sh137
-rw-r--r--.github/scripts/release-policy.py406
-rwxr-xr-x.github/scripts/resolve-linux-ci-image-tag.py124
-rwxr-xr-x.github/scripts/run-apt-get.sh96
-rwxr-xr-x.github/scripts/select-ccache-key-suffix.sh55
-rwxr-xr-x.github/scripts/select-linux-ccache-save.sh70
-rwxr-xr-x.github/scripts/select-linux-packaging.sh97
-rw-r--r--.github/scripts/should-refresh-linux-ci-images.py62
-rwxr-xr-x.github/scripts/smoke-launch-windows.sh62
-rwxr-xr-x.github/scripts/test-linux-ccache-compiler-signature.sh87
-rwxr-xr-x.github/scripts/test-verify-linux-ci-image.sh160
-rw-r--r--.github/scripts/tests/test_armhf_ci_manifest.py90
-rw-r--r--.github/scripts/tests/test_armhf_cross_configuration.py176
-rw-r--r--.github/scripts/tests/test_armhf_static_ldd.py123
-rw-r--r--.github/scripts/tests/test_armhf_sysroot_symlinks.py42
-rw-r--r--.github/scripts/tests/test_check_candidate_tag.py81
-rwxr-xr-x.github/scripts/tests/test_ghcr_retention.py143
-rw-r--r--.github/scripts/tests/test_linux_artifact_validation.py230
-rw-r--r--.github/scripts/tests/test_linux_ccache_policy.py99
-rw-r--r--.github/scripts/tests/test_linux_image_publication_policy.py181
-rw-r--r--.github/scripts/tests/test_release_policy.py383
-rwxr-xr-x.github/scripts/tests/test_resolve_linux_ci_image_tag.py125
-rw-r--r--.github/scripts/tests/test_should_refresh_linux_ci_images.py63
-rwxr-xr-x.github/scripts/tsan-linux-deps-config.sh210
-rwxr-xr-x.github/scripts/validate-ci-inputs.sh177
-rwxr-xr-x.github/scripts/validate-linux-armhf-runtime.sh66
-rwxr-xr-x.github/scripts/validate-workflow-timeouts.py76
-rwxr-xr-x.github/scripts/verify-armhf-ci-image.sh253
-rwxr-xr-x.github/scripts/verify-linux-ci-image.sh268
-rwxr-xr-x.github/scripts/verify-macos-artifacts.sh11
-rwxr-xr-x.github/scripts/verify-macos-static-archives.sh11
-rwxr-xr-x.github/scripts/verify-sanitizer-instrumentation.py136
-rwxr-xr-x.github/scripts/verify-tsan-deps-linux.sh138
-rwxr-xr-x.github/scripts/write-armhf-ci-manifest.sh121
66 files changed, 7161 insertions, 17 deletions
diff --git a/.github/scripts/armhf-ci-image-config.sh b/.github/scripts/armhf-ci-image-config.sh
new file mode 100755
index 00000000..6e97c2f0
--- /dev/null
+++ b/.github/scripts/armhf-ci-image-config.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+# Pinned inputs shared by the ARMHF cross-builder and runtime image pair.
+# shellcheck disable=SC2034
+
+_armhf_config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+# shellcheck source=.github/scripts/linux-ci-image-config.sh
+. "$_armhf_config_dir/linux-ci-image-config.sh"
+unset _armhf_config_dir
+
+ARMHF_CI_IMAGE_SCHEMA=1
+ARMHF_CROSSTOOL_NG_VERSION=1.28.0
+ARMHF_CROSSTOOL_NG_SHA256=5750e29a2bda5cd8d67900592576b1670a1987a4dcd5e4f6beae09138a1f5699
+ARMHF_CROSSTOOL_NG_URL="https://github.com/crosstool-ng/crosstool-ng/releases/download/crosstool-ng-${ARMHF_CROSSTOOL_NG_VERSION}/crosstool-ng-${ARMHF_CROSSTOOL_NG_VERSION}.tar.xz"
+
+ARMHF_TARGET_TRIPLET=arm-linux-gnueabihf
+ARMHF_TOOLCHAIN_PREFIX=/opt/wsjtx/armhf-toolchain
+ARMHF_SYSROOT=/opt/wsjtx/armhf-sysroot
+ARMHF_RUNTIME_PREFIX=/opt/wsjtx/armhf-runtime
+ARMHF_QEMU_EXECUTABLE=/usr/local/bin/qemu-arm-static
+ARMHF_GCC_VERSION=13.4.0
+ARMHF_GLIBC_VERSION=2.36
+ARMHF_BINUTILS_VERSION=2.40
+ARMHF_LINUX_HEADERS_VERSION=6.1.147
+ARMHF_MIN_KERNEL_VERSION=3.2.0
+
+ARMHF_SYSROOT_PACKAGES=(
+ libc6-dev libstdc++6 libgfortran5 libgomp1 libatomic1
+ libfftw3-dev libboost-log-dev
+ qtbase5-dev qttools5-dev qtmultimedia5-dev libqt5serialport5-dev
+ libqt5sql5-sqlite libqt5websockets5-dev libqt5multimedia5-plugins
+ libusb-1.0-0-dev libudev-dev portaudio19-dev
+)
+
+ARMHF_GCC_RUNTIME_LIBRARIES=(
+ libatomic.so.1
+ libgcc_s.so.1
+ libgfortran.so.5
+ libgomp.so.1
+ libstdc++.so.6
+)
diff --git a/.github/scripts/armhf-static-ldd.sh b/.github/scripts/armhf-static-ldd.sh
new file mode 100755
index 00000000..bb85e6f3
--- /dev/null
+++ b/.github/scripts/armhf-static-ldd.sh
@@ -0,0 +1,98 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# linuxdeploy's ldd probe crashes when an ARM loader is nested under user-mode
+# QEMU. Resolve DT_NEEDED entries from the clean ARMHF runtime without executing
+# the target; packaged runtime behavior is still proved by the QEMU smoke test.
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: armhf-static-ldd.sh ELF" >&2
+ exit 2
+fi
+
+target=$1
+runtime_prefix=${WSJT_ARMHF_RUNTIME_PREFIX:-/opt/wsjtx/armhf-runtime}
+search_path=${ARMHF_STATIC_LDD_LIBRARY_PATH:-}
+
+base_search_directories=("$runtime_prefix")
+if [ -n "$search_path" ]; then
+ IFS=: read -r -a configured_directories <<< "$search_path"
+ base_search_directories+=("${configured_directories[@]}")
+fi
+
+status=0
+declare -A resolved_libraries=()
+
+resolve_dependencies() {
+ local elf=$1 dynamic origin line directory library resolved metadata
+ local -a needed=() encoded_directories=() search_directories=()
+
+ dynamic="$(readelf -dW -- "$elf")" || exit
+ origin="$(dirname -- "$elf")"
+ while IFS= read -r line; do
+ if [[ "$line" =~ \(NEEDED\).*Shared[[:space:]]library:[[:space:]]\[([^]]+)\] ]]; then
+ needed+=("${BASH_REMATCH[1]}")
+ elif [[ "$line" =~ \((RUNPATH|RPATH)\).*Library[[:space:]](runpath|rpath):[[:space:]]\[([^]]+)\] ]]; then
+ IFS=: read -r -a encoded <<< "${BASH_REMATCH[3]}"
+ for directory in "${encoded[@]}"; do
+ # shellcheck disable=SC2016 # expand the loader's literal ORIGIN token
+ directory=${directory//'${ORIGIN}'/$origin}
+ # shellcheck disable=SC2016 # expand the loader's literal ORIGIN token
+ directory=${directory//'$ORIGIN'/$origin}
+ encoded_directories+=("$directory")
+ done
+ fi
+ done <<< "$dynamic"
+ search_directories=(
+ "${base_search_directories[@]}"
+ "${encoded_directories[@]}"
+ /lib/arm-linux-gnueabihf
+ /usr/lib/arm-linux-gnueabihf
+ /lib
+ /usr/lib
+ )
+
+ for library in "${needed[@]}"; do
+ if [[ "$library" == libquadmath.so* ]]; then
+ echo "$elf unexpectedly depends on unavailable ARMHF runtime $library" >&2
+ exit 1
+ fi
+ if [ -n "${resolved_libraries[$library]:-}" ]; then
+ continue
+ fi
+
+ resolved=
+ if [[ "$library" == */* ]] && [ -f "$library" ]; then
+ resolved=$library
+ else
+ for directory in "${search_directories[@]}"; do
+ if [ -f "$directory/$library" ]; then
+ resolved=$directory/$library
+ break
+ fi
+ done
+ fi
+
+ if [ -z "$resolved" ]; then
+ printf '%s => not found (0x00000000)\n' "$library"
+ status=1
+ continue
+ fi
+
+ metadata="$(file -L -- "$resolved")" || exit
+ case "$metadata" in
+ *"ELF 32-bit"*"ARM, EABI5"*) ;;
+ *)
+ echo "$elf resolves $library to a non-ARMHF ELF: $metadata" >&2
+ exit 1
+ ;;
+ esac
+ resolved_libraries[$library]=$resolved
+ printf '%s => %s (0x00000000)\n' "$library" "$resolved"
+ resolve_dependencies "$resolved"
+ done
+}
+
+resolve_dependencies "$target"
+
+exit "$status"
diff --git a/.github/scripts/audit-armhf-cross-build.sh b/.github/scripts/audit-armhf-cross-build.sh
new file mode 100755
index 00000000..d8088612
--- /dev/null
+++ b/.github/scripts/audit-armhf-cross-build.sh
@@ -0,0 +1,104 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: audit-armhf-cross-build.sh BUILD_DIR" >&2
+ exit 2
+fi
+
+build_dir=$1
+toolchain_prefix=${WSJT_ARMHF_TOOLCHAIN_PREFIX:-/opt/wsjtx/armhf-toolchain}
+sysroot=${WSJT_ARMHF_SYSROOT:-/opt/wsjtx/armhf-sysroot}
+runtime_prefix=${WSJT_ARMHF_RUNTIME_PREFIX:-/opt/wsjtx/armhf-runtime}
+triplet=arm-linux-gnueabihf
+readelf="$toolchain_prefix/bin/$triplet-readelf"
+object_count=0
+
+while IFS= read -r -d '' object; do
+ headers="$("$readelf" -hW "$object")"
+ case "$headers" in
+ *"Class:"*"ELF32"*"Machine:"*"ARM"*"Version5 EABI"*) ;;
+ *)
+ echo "Target build contains a non-ARMHF object: $object" >&2
+ exit 1
+ ;;
+ esac
+ object_count=$((object_count + 1))
+done < <(find "$build_dir" -type f -name '*.o' -print0)
+if [ "$object_count" -eq 0 ]; then
+ echo "No target objects found below $build_dir" >&2
+ exit 1
+fi
+
+for tool in qmake moc uic rcc lrelease lconvert; do
+ metadata="$(file -L "/usr/lib/qt5/bin/$tool")"
+ case "$metadata" in
+ *"ELF 64-bit"*"x86-64"*) ;;
+ *) echo "Qt host tool is not x86-64: $metadata" >&2; exit 1 ;;
+ esac
+done
+for target in \
+ "$sysroot/usr/lib/$triplet/libQt5Core.so.5" \
+ "$sysroot/usr/lib/$triplet/libQt5Widgets.so.5" \
+ "$sysroot/usr/lib/$triplet/qt5/plugins/platforms/libqxcb.so" \
+ "$sysroot/usr/bin/rigctl" \
+ "$sysroot/usr/bin/rigctld" \
+ "$sysroot/usr/bin/rigctlcom"; do
+ metadata="$(file -L "$target")"
+ case "$metadata" in
+ *"ELF 32-bit"*"ARM, EABI5"*) ;;
+ *) echo "Target dependency has the wrong architecture: $metadata" >&2; exit 1 ;;
+ esac
+done
+
+binary_count=0
+while IFS= read -r -d '' target_file; do
+ metadata="$(file -L "$target_file")"
+ case "$metadata" in
+ *"ELF 32-bit"*"ARM, EABI5"*) ;;
+ *"ELF"*)
+ echo "Target build contains a non-ARMHF binary: $metadata" >&2
+ exit 1
+ ;;
+ *) continue ;;
+ esac
+ dynamic="$($readelf -dW "$target_file" 2>/dev/null || true)"
+ if [[ "$dynamic" == *"Shared library: [libquadmath.so"* ]]; then
+ echo "$target_file unexpectedly depends on libquadmath" >&2
+ exit 1
+ fi
+ versions="$($readelf --version-info -W "$target_file" 2>/dev/null || true)"
+ if [[ "$versions" == *"GLIBC_PRIVATE"* ]]; then
+ echo "$target_file unexpectedly depends on a private glibc symbol" >&2
+ exit 1
+ fi
+ binary_count=$((binary_count + 1))
+done < <(find "$build_dir" -type f \( -perm /111 -o -name '*.so*' \) -print0)
+if [ "$binary_count" -eq 0 ]; then
+ echo "No target executables or shared libraries found below $build_dir" >&2
+ exit 1
+fi
+
+for executable in wsjtx jt9 qmap/qmap map65/map65 ft8code wsprd; do
+ versions="$("$readelf" --version-info -W "$build_dir/$executable")"
+ remaining=$versions
+ maximum=0
+ while [[ "$remaining" =~ GLIBC_([0-9]+\.[0-9]+) ]]; do
+ version=${BASH_REMATCH[1]}
+ if dpkg --compare-versions "$version" gt "$maximum"; then
+ maximum=$version
+ fi
+ remaining=${remaining#*"${BASH_REMATCH[0]}"}
+ done
+ if dpkg --compare-versions "$maximum" gt 2.36; then
+ echo "$build_dir/$executable requires GLIBC_$maximum, newer than Bookworm" >&2
+ exit 1
+ fi
+ for runtime in libstdc++.so.6 libgcc_s.so.1 libgfortran.so.5 libgomp.so.1; do
+ if [[ "$versions" == *"${runtime%%.so*}"* ]]; then
+ test -f "$runtime_prefix/$runtime"
+ fi
+ done
+ echo "$executable: maximum GLIBC_$maximum"
+done
+echo "Audited $object_count ARMHF objects and $binary_count target binaries; Qt host tools are x86-64"
diff --git a/.github/scripts/audit-staged-dll-imports-windows.sh b/.github/scripts/audit-staged-dll-imports-windows.sh
index b16adaca..ca8b75f2 100644
--- a/.github/scripts/audit-staged-dll-imports-windows.sh
+++ b/.github/scripts/audit-staged-dll-imports-windows.sh
@@ -50,6 +50,23 @@ for exe in "$@"; do
echo "(none)"
fi
+ win7_blocked_imports=$(
+ objdump -p "$exe" |
+ awk '
+ /DLL Name:/ { dll=tolower($3) }
+ /api-ms-win-core-synch-l1-2-0\.dll/ { print "api-ms-win-core-synch-l1-2-0.dll" }
+ /WaitOnAddress/ { print dll "::WaitOnAddress" }
+ /WakeByAddressSingle/ { print dll "::WakeByAddressSingle" }
+ ' |
+ sort -u
+ )
+
+ if [ -n "$win7_blocked_imports" ]; then
+ echo "::error::$exe imports Windows 8+ synchronization APIs that block Windows 7 compatibility:"
+ echo "$win7_blocked_imports"
+ fail=1
+ fi
+
high_risk=$(
echo "$imports" |
awk '{ lower=tolower($0); if (lower ~ /^(libgomp|libgfortran|libgcc_s|libquadmath|libportaudio|libhamlib|libfftw|qt5.*\.dll)/) print lower }' |
diff --git a/.github/scripts/build-armhf-toolchain-smoke.sh b/.github/scripts/build-armhf-toolchain-smoke.sh
new file mode 100755
index 00000000..3cfaa4d2
--- /dev/null
+++ b/.github/scripts/build-armhf-toolchain-smoke.sh
@@ -0,0 +1,83 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 3 ]; then
+ echo "Usage: build-armhf-toolchain-smoke.sh TOOLCHAIN_PREFIX SYSROOT OUTPUT_DIR" >&2
+ exit 2
+fi
+
+toolchain_prefix=$1
+sysroot=$2
+output_dir=$3
+triplet=arm-linux-gnueabihf
+compiler_prefix="$toolchain_prefix/bin/$triplet"
+target_include="$sysroot/usr/include/$triplet"
+target_lib="$sysroot/usr/lib/$triplet"
+target_base_lib="$sysroot/lib/$triplet"
+common_flags=(
+ "--sysroot=$sysroot"
+ -isystem "$target_include"
+ "-B$target_lib/"
+ "-L$target_lib"
+ "-Wl,-rpath-link,$target_lib"
+ "-Wl,-rpath-link,$target_base_lib"
+)
+
+mkdir -p "$output_dir"
+source_dir="$(mktemp -d)"
+trap 'rm -rf "$source_dir"' EXIT
+
+cat > "$source_dir/c.c" <<'EOF'
+#include <stdatomic.h>
+#include <stdio.h>
+int main(void) {
+ _Atomic long long value = 41;
+ printf("c atomic: %lld\n", atomic_fetch_add(&value, 1) + 1);
+ return 0;
+}
+EOF
+cat > "$source_dir/cxx.cpp" <<'EOF'
+#include <iostream>
+#include <numeric>
+#include <vector>
+int main() {
+ std::vector<int> values{1, 2, 3, 4};
+ std::cout << "c++ standard library: "
+ << std::accumulate(values.begin(), values.end(), 0) << '\n';
+ return 0;
+}
+EOF
+cat > "$source_dir/fortran.f90" <<'EOF'
+program fortran_smoke
+ use omp_lib
+ implicit none
+ integer :: i, total
+ total = 0
+ !$omp parallel do reduction(+:total)
+ do i = 1, 4
+ total = total + i
+ end do
+ !$omp end parallel do
+ print '(A,I0)', 'fortran openmp: ', total
+end program fortran_smoke
+EOF
+
+"${compiler_prefix}-gcc" "${common_flags[@]}" "$source_dir/c.c" -latomic \
+ -o "$output_dir/c-smoke"
+"${compiler_prefix}-g++" "${common_flags[@]}" "$source_dir/cxx.cpp" \
+ -o "$output_dir/cxx-smoke"
+"${compiler_prefix}-gfortran" "${common_flags[@]}" -fopenmp \
+ "$source_dir/fortran.f90" -o "$output_dir/fortran-smoke"
+
+for executable in "$output_dir"/*-smoke; do
+ metadata="$(file "$executable")"
+ headers="$("${compiler_prefix}-readelf" -hW "$executable")"
+ programs="$("${compiler_prefix}-readelf" -lW "$executable")"
+ case "$metadata:$headers:$programs" in
+ *"ELF 32-bit"*"ARM, EABI5"*"hard-float ABI"*"/lib/ld-linux-armhf.so.3"*) ;;
+ *)
+ echo "ARMHF toolchain smoke output has invalid ABI metadata: $executable" >&2
+ exit 1
+ ;;
+ esac
+done
diff --git a/.github/scripts/build-boost-macos.sh b/.github/scripts/build-boost-macos.sh
index 06e9de1a..c3b876f0 100755
--- a/.github/scripts/build-boost-macos.sh
+++ b/.github/scripts/build-boost-macos.sh
@@ -1,15 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
-if [ "$#" -ne 4 ]; then
- echo "Usage: build-boost-macos.sh VERSION ARCH DEPLOYMENT_TARGET PREFIX" >&2
+if [ "$#" -ne 5 ]; then
+ echo "Usage: build-boost-macos.sh VERSION SOURCE_SHA256 ARCH DEPLOYMENT_TARGET PREFIX" >&2
exit 2
fi
version="$1"
-arch="$2"
-deployment_target="$3"
-prefix="$4"
+source_sha256="$2"
+arch="$3"
+deployment_target="$4"
+prefix="$5"
version_underscores=${version//./_}
boost_arch=x86
@@ -17,7 +18,25 @@ if [ "$arch" = "arm64" ]; then
boost_arch=arm
fi
+sha256_file() {
+ if command -v shasum >/dev/null 2>&1; then
+ shasum -a 256 "$1" | awk '{print $1}'
+ elif command -v sha256sum >/dev/null 2>&1; then
+ sha256sum "$1" | awk '{print $1}'
+ else
+ echo "No SHA-256 tool found; expected shasum or sha256sum" >&2
+ return 1
+ fi
+}
+
curl -L --fail --retry 5 --retry-delay 10 -o boost.tar.bz2 "https://archives.boost.io/release/${version}/source/boost_${version_underscores}.tar.bz2"
+actual_sha256="$(sha256_file boost.tar.bz2)"
+if [ "$actual_sha256" != "$source_sha256" ]; then
+ echo "::error::Boost source SHA-256 mismatch" >&2
+ echo "Expected: ${source_sha256}" >&2
+ echo "Actual: ${actual_sha256}" >&2
+ exit 1
+fi
tar -xjf boost.tar.bz2
cd "boost_${version_underscores}"
diff --git a/.github/scripts/build-boost-tsan-linux.sh b/.github/scripts/build-boost-tsan-linux.sh
new file mode 100755
index 00000000..3139b370
--- /dev/null
+++ b/.github/scripts/build-boost-tsan-linux.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: build-boost-tsan-linux.sh PREFIX" >&2
+ exit 2
+fi
+
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+# shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+. "${script_dir}/tsan-linux-deps-config.sh"
+
+prefix=$1
+tsan_require_toolchain
+
+if [ -e "$prefix" ] && [ -n "$(ls -A "$prefix")" ]; then
+ echo "Boost TSan prefix already exists and is not empty: $prefix" >&2
+ exit 1
+fi
+
+build_root="$(mktemp -d "${RUNNER_TEMP:-/tmp}/wsjtx-boost-tsan.XXXXXX")"
+archive="${build_root}/boost.tar.bz2"
+version_underscores=${TSAN_BOOST_VERSION//./_}
+
+mkdir -p "$prefix"
+curl -L --fail --retry 5 --retry-delay 10 \
+ -o "$archive" "$TSAN_BOOST_SOURCE_URL"
+
+actual_sha256="$(sha256sum "$archive" | awk '{print $1}')"
+if [ "$actual_sha256" != "$TSAN_BOOST_SOURCE_SHA256" ]; then
+ echo "Boost source SHA-256 mismatch" >&2
+ echo "Expected: $TSAN_BOOST_SOURCE_SHA256" >&2
+ echo "Actual: $actual_sha256" >&2
+ exit 1
+fi
+
+tar -xjf "$archive" -C "$build_root"
+cd "${build_root}/boost_${version_underscores}"
+
+printf 'using gcc : %s : %s ;\n' "$TSAN_GCC_SUFFIX" "$TSAN_CXX" > user-config.jam
+./bootstrap.sh --prefix="$prefix" --with-libraries=log
+./b2 -j"$(nproc)" \
+ --user-config="${PWD}/user-config.jam" \
+ toolset="gcc-${TSAN_GCC_SUFFIX}" \
+ variant=release \
+ link=shared \
+ runtime-link=shared \
+ threading=multi \
+ cxxstd=11 \
+ cxxflags="$TSAN_SANITIZER_FLAGS" \
+ linkflags="$TSAN_LINK_FLAGS" \
+ --layout=system \
+ install
+
+tsan_write_dependency_manifest boost "$prefix"
diff --git a/.github/scripts/build-boost-windows.sh b/.github/scripts/build-boost-windows.sh
new file mode 100755
index 00000000..0e56b920
--- /dev/null
+++ b/.github/scripts/build-boost-windows.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 4 ]; then
+ echo "Usage: build-boost-windows.sh VERSION SOURCE_SHA256 WIN32_WINNT PREFIX" >&2
+ exit 2
+fi
+
+version="$1"
+source_sha256="$2"
+win32_winnt="$3"
+prefix="$4"
+version_underscores=${version//./_}
+api_floor_flags="-D_WIN32_WINNT=${win32_winnt} -DWINVER=${win32_winnt} -DBOOST_USE_WINAPI_VERSION=${win32_winnt}"
+install_prefix=$(cygpath -m "$prefix")
+
+sha256_file() {
+ if command -v sha256sum >/dev/null 2>&1; then
+ sha256sum "$1" | awk '{print $1}'
+ elif command -v shasum >/dev/null 2>&1; then
+ shasum -a 256 "$1" | awk '{print $1}'
+ else
+ echo "No SHA-256 tool found; expected sha256sum or shasum" >&2
+ return 1
+ fi
+}
+
+curl -L --fail --retry 5 --retry-delay 10 -o boost.tar.bz2 "https://archives.boost.io/release/${version}/source/boost_${version_underscores}.tar.bz2"
+actual_sha256="$(sha256_file boost.tar.bz2)"
+if [ "$actual_sha256" != "$source_sha256" ]; then
+ echo "::error::Boost source SHA-256 mismatch" >&2
+ echo "Expected: ${source_sha256}" >&2
+ echo "Actual: ${actual_sha256}" >&2
+ exit 1
+fi
+tar -xjf boost.tar.bz2
+cd "boost_${version_underscores}"
+
+python3 - <<'PY'
+from pathlib import Path
+
+platform = Path("boost/atomic/detail/platform.hpp")
+text = platform.read_text()
+old = """#if defined(BOOST_WINDOWS)
+
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND windows
+
+#else // defined(BOOST_WINDOWS)
+"""
+new = """#if defined(BOOST_WINDOWS)
+
+#include <boost/winapi/config.hpp>
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN8
+#define BOOST_ATOMIC_DETAIL_WAIT_BACKEND windows
+#endif
+
+#else // defined(BOOST_WINDOWS)
+"""
+if old not in text:
+ raise SystemExit("Boost.Atomic Windows wait backend block not found")
+platform.write_text(text.replace(old, new, 1))
+
+jamfile = Path("libs/atomic/build/Jamfile.v2")
+text = jamfile.read_text()
+for line in (
+ " <target-os>windows:<library>synchronization\n",
+ " <toolset>gcc,<target-os>windows:<define>_WIN32_WINNT=0x0A00\n",
+):
+ if line not in text:
+ raise SystemExit(f"Boost.Atomic Jamfile line not found: {line.rstrip()}")
+ text = text.replace(line, "", 2)
+jamfile.write_text(text)
+PY
+
+./bootstrap.sh --prefix="$install_prefix" --with-libraries=log
+./b2 --with-log -j"$(nproc)" \
+ toolset=gcc \
+ variant=release \
+ link=shared \
+ runtime-link=shared \
+ threading=multi \
+ cxxstd=11 \
+ address-model=64 \
+ --layout=tagged \
+ cflags="${api_floor_flags}" \
+ cxxflags="${api_floor_flags}" \
+ install
diff --git a/.github/scripts/build-hamlib-armhf-cross.sh b/.github/scripts/build-hamlib-armhf-cross.sh
new file mode 100755
index 00000000..00e80453
--- /dev/null
+++ b/.github/scripts/build-hamlib-armhf-cross.sh
@@ -0,0 +1,65 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 3 ]; then
+ echo "Usage: build-hamlib-armhf-cross.sh COMMIT SYSROOT TOOLCHAIN_PREFIX" >&2
+ exit 2
+fi
+
+commit=$1
+sysroot=$2
+toolchain_prefix=$3
+triplet=arm-linux-gnueabihf
+target_include="$sysroot/usr/include/$triplet"
+target_lib="$sysroot/usr/lib/$triplet"
+target_base_lib="$sysroot/lib/$triplet"
+
+export PATH="$toolchain_prefix/bin:$PATH"
+export PKG_CONFIG_SYSROOT_DIR="$sysroot"
+export PKG_CONFIG_PATH=
+export PKG_CONFIG_LIBDIR="$target_lib/pkgconfig:$sysroot/usr/share/pkgconfig"
+
+git init hamlib-src
+git -C hamlib-src remote add origin https://github.com/Hamlib/Hamlib.git
+git -C hamlib-src fetch --depth 1 origin "$commit"
+git -C hamlib-src checkout --detach FETCH_HEAD
+actual_commit="$(git -C hamlib-src rev-parse HEAD)"
+if [ "$actual_commit" != "$commit" ]; then
+ echo "Hamlib source mismatch: expected $commit, got $actual_commit" >&2
+ exit 1
+fi
+
+cd hamlib-src
+./bootstrap
+./configure \
+ --build=x86_64-pc-linux-gnu \
+ --host="$triplet" \
+ --prefix=/usr \
+ --disable-shared --enable-static \
+ --without-cxx-binding \
+ --without-readline \
+ --without-indi \
+ CC="${triplet}-gcc" \
+ CXX="${triplet}-g++" \
+ AR="${triplet}-ar" \
+ NM="${triplet}-nm" \
+ OBJDUMP="${triplet}-objdump" \
+ RANLIB="${triplet}-ranlib" \
+ STRIP="${triplet}-strip" \
+ CFLAGS="--sysroot=$sysroot -isystem $target_include -g -O2 -fPIC -fdata-sections -ffunction-sections" \
+ CXXFLAGS="--sysroot=$sysroot -isystem $target_include -g -O2 -fPIC -fdata-sections -ffunction-sections" \
+ LDFLAGS="--sysroot=$sysroot -B$target_lib/ -L$target_lib -Wl,-rpath-link,$target_lib -Wl,-rpath-link,$target_base_lib -Wl,--gc-sections"
+make -j"$(nproc)"
+make DESTDIR="$sysroot" install
+
+for utility in rigctl rigctld rigctlcom; do
+ metadata="$(file "$sysroot/usr/bin/$utility")"
+ case "$metadata" in
+ *"ELF 32-bit"*"ARM, EABI5"*) ;;
+ *)
+ echo "Cross-built Hamlib utility has the wrong architecture: $metadata" >&2
+ exit 1
+ ;;
+ esac
+done
+test -f "$sysroot/usr/lib/libhamlib.a"
diff --git a/.github/scripts/build-hamlib-linux.sh b/.github/scripts/build-hamlib-linux.sh
new file mode 100755
index 00000000..11676c56
--- /dev/null
+++ b/.github/scripts/build-hamlib-linux.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: build-hamlib-linux.sh REF PREFIX" >&2
+ exit 2
+fi
+
+ref="$1"
+prefix="$2"
+
+git init hamlib-src
+git -C hamlib-src remote add origin https://github.com/Hamlib/Hamlib.git
+git -C hamlib-src fetch --depth 1 origin "$ref"
+git -C hamlib-src checkout --detach FETCH_HEAD
+actual_commit="$(git -C hamlib-src rev-parse HEAD)"
+if [[ "$ref" =~ ^[0-9a-f]{40}$ ]] && [ "$actual_commit" != "$ref" ]; then
+ echo "Hamlib source mismatch: expected $ref, got $actual_commit" >&2
+ exit 1
+fi
+cd hamlib-src
+./bootstrap
+./configure \
+ --prefix="$prefix" \
+ --disable-shared --enable-static \
+ --without-cxx-binding \
+ --without-readline \
+ --without-indi \
+ CFLAGS="-g -O2 -fPIC -fdata-sections -ffunction-sections" \
+ LDFLAGS="-Wl,--gc-sections"
+make -j"$(nproc)"
+make install
diff --git a/.github/scripts/build-hamlib-macos.sh b/.github/scripts/build-hamlib-macos.sh
index 637492e4..525f3ebf 100755
--- a/.github/scripts/build-hamlib-macos.sh
+++ b/.github/scripts/build-hamlib-macos.sh
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
-if [ "$#" -ne 3 ]; then
- echo "Usage: build-hamlib-macos.sh BRANCH DEPLOYMENT_TARGET PREFIX" >&2
+if [ "$#" -ne 4 ]; then
+ echo "Usage: build-hamlib-macos.sh BRANCH DEPLOYMENT_TARGET PREFIX LIBUSB_PREFIX" >&2
exit 2
fi
branch="$1"
deployment_target="$2"
prefix="$3"
+libusb_prefix="$4"
git clone --depth 1 --branch "$branch" \
https://github.com/Hamlib/Hamlib.git hamlib-src
@@ -18,7 +19,9 @@ cd hamlib-src
--prefix="$prefix" \
--disable-shared --enable-static \
--without-cxx-binding \
+ PKG_CONFIG_PATH="${libusb_prefix}/lib/pkgconfig" \
+ CPPFLAGS="-I${libusb_prefix}/include" \
CFLAGS="-mmacosx-version-min=${deployment_target}" \
- LDFLAGS="-mmacosx-version-min=${deployment_target}"
+ LDFLAGS="-L${libusb_prefix}/lib -mmacosx-version-min=${deployment_target} -Wl,-headerpad_max_install_names"
make -j"$(sysctl -n hw.ncpu)"
make install
diff --git a/.github/scripts/build-hamlib-tsan-linux.sh b/.github/scripts/build-hamlib-tsan-linux.sh
new file mode 100755
index 00000000..d3b37d57
--- /dev/null
+++ b/.github/scripts/build-hamlib-tsan-linux.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: build-hamlib-tsan-linux.sh PREFIX" >&2
+ exit 2
+fi
+
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+# shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+. "${script_dir}/tsan-linux-deps-config.sh"
+
+prefix=$1
+tsan_require_toolchain
+
+if [ -e "$prefix" ] && [ -n "$(ls -A "$prefix")" ]; then
+ echo "Hamlib TSan prefix already exists and is not empty: $prefix" >&2
+ exit 1
+fi
+
+build_root="$(mktemp -d "${RUNNER_TEMP:-/tmp}/wsjtx-hamlib-tsan.XXXXXX")"
+source_dir="${build_root}/hamlib-src"
+mkdir -p "$prefix" "$source_dir"
+
+git -C "$source_dir" init
+git -C "$source_dir" remote add origin https://github.com/Hamlib/Hamlib.git
+git -C "$source_dir" fetch --depth 1 origin "$TSAN_HAMLIB_COMMIT"
+git -C "$source_dir" checkout --detach FETCH_HEAD
+
+actual_commit="$(git -C "$source_dir" rev-parse HEAD)"
+if [ "$actual_commit" != "$TSAN_HAMLIB_COMMIT" ]; then
+ echo "Hamlib source commit mismatch: expected $TSAN_HAMLIB_COMMIT, got $actual_commit" >&2
+ exit 1
+fi
+
+git -C "$source_dir" fetch --depth 2 origin "$TSAN_HAMLIB_PATCH_COMMIT"
+git -C "$source_dir" cherry-pick --no-commit "$TSAN_HAMLIB_PATCH_COMMIT"
+
+cd "$source_dir"
+./bootstrap
+./configure \
+ --prefix="$prefix" \
+ --disable-shared --enable-static \
+ --without-indi \
+ --without-cxx-binding \
+ CC="$TSAN_CC" \
+ CFLAGS="${TSAN_SANITIZER_FLAGS} -fPIC -fdata-sections -ffunction-sections" \
+ LDFLAGS="${TSAN_LINK_FLAGS} -Wl,--gc-sections"
+make -j"$(nproc)"
+make install
+
+tsan_write_dependency_manifest hamlib "$prefix"
diff --git a/.github/scripts/build-hamlib-windows.sh b/.github/scripts/build-hamlib-windows.sh
new file mode 100755
index 00000000..a4240998
--- /dev/null
+++ b/.github/scripts/build-hamlib-windows.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: build-hamlib-windows.sh BRANCH PREFIX" >&2
+ exit 2
+fi
+
+branch="$1"
+prefix="$2"
+
+git clone --depth 1 --branch "$branch" \
+ https://github.com/Hamlib/Hamlib.git hamlib-src
+cd hamlib-src
+./bootstrap
+./configure \
+ --prefix="$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
diff --git a/.github/scripts/build-linux-armhf-cross.sh b/.github/scripts/build-linux-armhf-cross.sh
new file mode 100755
index 00000000..cfbb2f03
--- /dev/null
+++ b/.github/scripts/build-linux-armhf-cross.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+VERSION="${VERSION:?missing}"
+ARCH="${ARCH:?missing}"
+HAMLIB_BRANCH="${HAMLIB_BRANCH:?missing}"
+WSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL:-DEVEL}"
+WSJT_RC_NUMBER="${WSJT_RC_NUMBER:-}"
+if [ "$ARCH" != armhf ]; then
+ echo "build-linux-armhf-cross.sh supports only arch=armhf" >&2
+ exit 2
+fi
+
+unset GITHUB_TOKEN
+cd /work
+# shellcheck source=.github/scripts/armhf-ci-image-config.sh
+source .github/scripts/armhf-ci-image-config.sh
+# shellcheck source=.github/scripts/linux-artifact-validation.sh
+source .github/scripts/linux-artifact-validation.sh
+.github/scripts/verify-armhf-ci-image.sh cross-builder "$ARCH" "$HAMLIB_BRANCH"
+
+export CC="$ARMHF_TOOLCHAIN_PREFIX/bin/$ARMHF_TARGET_TRIPLET-gcc"
+export CXX="$ARMHF_TOOLCHAIN_PREFIX/bin/$ARMHF_TARGET_TRIPLET-g++"
+export FC="$ARMHF_TOOLCHAIN_PREFIX/bin/$ARMHF_TARGET_TRIPLET-gfortran"
+for compiler in "$CC" "$CXX" "$FC"; do
+ version="$("$compiler" -dumpfullversion -dumpversion)"
+ if [ "$version" != "$ARMHF_GCC_VERSION" ]; then
+ echo "Expected GCC $ARMHF_GCC_VERSION, found $version at $compiler" >&2
+ exit 1
+ fi
+done
+
+export CCACHE_DIR="${CCACHE_DIR:-/work/.ccache-armhf}"
+mkdir -p "$CCACHE_DIR"
+ccache --zero-stats
+started="$(date +%s)"
+cmake -S . -B wsjtx-build \
+ -DCMAKE_TOOLCHAIN_FILE=/work/.github/cmake/armhf-toolchain.cmake \
+ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
+ -DWSJT_SKIP_MANPAGES=ON \
+ -DWSJT_ENABLE_TESTS=ON \
+ -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \
+ -DWSJT_RELEASE_CHANNEL="$WSJT_RELEASE_CHANNEL" \
+ -DWSJT_RC_NUMBER="$WSJT_RC_NUMBER" \
+ -Wno-dev
+cmake --build wsjtx-build --parallel "$(nproc)"
+ended="$(date +%s)"
+{
+ printf 'started_epoch=%s\n' "$started"
+ printf 'ended_epoch=%s\n' "$ended"
+ printf 'duration_seconds=%s\n' "$((ended - started))"
+} > wsjtx-build/armhf-cross-build-timing.env
+ccache --show-stats
+
+validate_linux_build_executables wsjtx-build "$ARCH"
+.github/scripts/audit-armhf-cross-build.sh wsjtx-build
+echo "::group::Prepare ARMHF AppDir"
+cmake --install wsjtx-build --prefix /work/AppDir/usr
+validate_linux_application_tree AppDir appdir "$ARCH"
+echo "::endgroup::"
+echo "ARMHF cross-build complete for version=$VERSION"
diff --git a/.github/scripts/build-pfunit-linux.sh b/.github/scripts/build-pfunit-linux.sh
new file mode 100755
index 00000000..4020fca8
--- /dev/null
+++ b/.github/scripts/build-pfunit-linux.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: build-pfunit-linux.sh REF PREFIX" >&2
+ exit 2
+fi
+
+ref="$1"
+prefix="$2"
+
+git init pfunit-src
+git -C pfunit-src remote add origin \
+ https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
+git -C pfunit-src fetch --depth 1 origin "$ref"
+git -C pfunit-src checkout --detach FETCH_HEAD
+actual_commit="$(git -C pfunit-src rev-parse HEAD)"
+if [[ "$ref" =~ ^[0-9a-f]{40}$ ]] && [ "$actual_commit" != "$ref" ]; then
+ echo "pFUnit source mismatch: expected $ref, got $actual_commit" >&2
+ exit 1
+fi
+git -C pfunit-src submodule update --init --recursive --depth 1
+cmake -S pfunit-src -B pfunit-build \
+ -DSKIP_MPI=YES \
+ -DSKIP_OPENMP=YES \
+ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
+ -DCMAKE_INSTALL_PREFIX="$prefix"
+cmake --build pfunit-build -j"$(nproc)"
+cmake --install pfunit-build
diff --git a/.github/scripts/build-pfunit-macos.sh b/.github/scripts/build-pfunit-macos.sh
new file mode 100755
index 00000000..0b53fdf8
--- /dev/null
+++ b/.github/scripts/build-pfunit-macos.sh
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -lt 4 ] || [ "$#" -gt 6 ]; then
+ echo "Usage: build-pfunit-macos.sh TAG FORTRAN_COMPILER DEPLOYMENT_TARGET PREFIX [FORTRAN_FLAGS] [LINKER_FLAGS]" >&2
+ exit 2
+fi
+
+tag="$1"
+fortran_compiler="$2"
+deployment_target="$3"
+prefix="$4"
+fortran_flags="${5:-}"
+linker_flags="${6:-}"
+
+git clone --depth 1 --branch "$tag" --recursive \
+ https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src
+
+gftl_shared_v1_cmake="pfunit-src/extern/fArgParse/extern/gFTL-shared/src/v1/CMakeLists.txt"
+if [ -f "$gftl_shared_v1_cmake" ]; then
+ gftl_shared_v1_cmake_tmp="${gftl_shared_v1_cmake}.tmp"
+ awk '
+ $0 == "add_executable (demo.x demo.F90)" {
+ print "add_executable (demo.x EXCLUDE_FROM_ALL demo.F90)"
+ replaced = 1
+ next
+ }
+ { print }
+ END { if (!replaced) exit 42 }
+ ' "$gftl_shared_v1_cmake" > "$gftl_shared_v1_cmake_tmp" || {
+ echo "::error::Could not exclude gFTL-shared demo.x from the pFUnit dependency build"
+ exit 1
+ }
+ mv "$gftl_shared_v1_cmake_tmp" "$gftl_shared_v1_cmake"
+fi
+
+cmake -S pfunit-src -B pfunit-build \
+ -DSKIP_MPI=YES \
+ -DSKIP_OPENMP=YES \
+ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
+ -DCMAKE_C_COMPILER=/usr/bin/cc \
+ -DCMAKE_Fortran_COMPILER="$fortran_compiler" \
+ -DCMAKE_Fortran_FLAGS="$fortran_flags" \
+ -DCMAKE_EXE_LINKER_FLAGS="$linker_flags" \
+ -DCMAKE_OSX_DEPLOYMENT_TARGET="$deployment_target" \
+ -DCMAKE_INSTALL_PREFIX="$prefix"
+cmake --build pfunit-build -j"$(sysctl -n hw.ncpu)"
+cmake --install pfunit-build
diff --git a/.github/scripts/build-pfunit-windows.sh b/.github/scripts/build-pfunit-windows.sh
new file mode 100755
index 00000000..90504e01
--- /dev/null
+++ b/.github/scripts/build-pfunit-windows.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: build-pfunit-windows.sh TAG PREFIX" >&2
+ exit 2
+fi
+
+tag="$1"
+prefix="$2"
+
+git config --global core.longpaths true
+git clone --depth 1 --branch "$tag" --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="$prefix"
+cmake --build pfunit-build -j"$(nproc)"
+cmake --install pfunit-build
diff --git a/.github/scripts/build-qt-macos.sh b/.github/scripts/build-qt-macos.sh
index 3bc0434b..f60f821e 100755
--- a/.github/scripts/build-qt-macos.sh
+++ b/.github/scripts/build-qt-macos.sh
@@ -161,9 +161,8 @@ jobs="$(sysctl -n hw.ncpu)"
make -j"$jobs"
make install
-"${prefix}/bin/qmake" -query
-"${prefix}/bin/qmake" -query QT_VERSION | awk -v expected="$QT_VERSION" '
+"${prefix}/bin/qtpaths" --qt-version | awk -v expected="$QT_VERSION" '
$0 != expected {
- printf "Expected qmake QT_VERSION %s, got %s\n", expected, $0 > "/dev/stderr"
+ printf "Expected Qt version %s, got %s\n", expected, $0 > "/dev/stderr"
exit 1
}'
diff --git a/.github/scripts/build-qt-tsan-linux.sh b/.github/scripts/build-qt-tsan-linux.sh
new file mode 100755
index 00000000..d2c3d756
--- /dev/null
+++ b/.github/scripts/build-qt-tsan-linux.sh
@@ -0,0 +1,135 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: build-qt-tsan-linux.sh PREFIX" >&2
+ exit 2
+fi
+
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+# shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+. "${script_dir}/tsan-linux-deps-config.sh"
+
+prefix=$1
+tsan_require_toolchain
+
+if [ -e "$prefix" ] && [ -n "$(ls -A "$prefix")" ]; then
+ echo "Qt TSan prefix already exists and is not empty: $prefix" >&2
+ exit 1
+fi
+
+build_root="$(mktemp -d "${RUNNER_TEMP:-/tmp}/wsjtx-qt-tsan.XXXXXX")"
+archive="${build_root}/qt-everywhere-opensource-src-${TSAN_QT_VERSION}.tar.xz"
+
+cleanup_build_root() {
+ local expected_root=${RUNNER_TEMP:-/tmp}
+ if [[ $build_root != "$expected_root"/wsjtx-qt-tsan.* ]]; then
+ echo "Refusing to remove unexpected Qt build directory: $build_root" >&2
+ return 1
+ fi
+ rm -rf -- "$build_root"
+}
+
+trap cleanup_build_root EXIT
+mkdir -p "$prefix"
+
+curl -L --fail --retry 5 --retry-delay 10 \
+ -o "$archive" "$TSAN_QT_SOURCE_URL"
+
+actual_sha256="$(sha256sum "$archive" | awk '{print $1}')"
+if [ "$actual_sha256" != "$TSAN_QT_SOURCE_SHA256" ]; then
+ echo "Qt source SHA-256 mismatch" >&2
+ echo "Expected: $TSAN_QT_SOURCE_SHA256" >&2
+ echo "Actual: $actual_sha256" >&2
+ exit 1
+fi
+
+tar -xf "$archive" -C "$build_root"
+rm -f "$archive"
+source_dir="${build_root}/qt-everywhere-src-${TSAN_QT_VERSION}"
+if [ ! -d "$source_dir" ]; then
+ source_dir="${build_root}/qt-everywhere-opensource-src-${TSAN_QT_VERSION}"
+fi
+if [ ! -d "$source_dir" ]; then
+ echo "Could not locate extracted Qt source under $build_root" >&2
+ exit 1
+fi
+
+cd "$source_dir"
+export CC="$TSAN_CC"
+export CXX="$TSAN_CXX"
+export CFLAGS="$TSAN_SANITIZER_FLAGS"
+export CXXFLAGS="$TSAN_SANITIZER_FLAGS"
+export LDFLAGS="$TSAN_LINK_FLAGS"
+
+configure_args=(
+ -opensource
+ -confirm-license
+ -release
+ -shared
+ -prefix "$prefix"
+ -sanitize thread
+ -force-debug-info
+ -no-strip
+ "QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO=-O1 -g1"
+ "QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO=-O1 -g1"
+ -nomake examples
+ -nomake tests
+ -qt-zlib
+ -qt-libpng
+ -qt-libjpeg
+ -qt-pcre
+ -qt-harfbuzz
+ -qt-sqlite
+ -no-sql-mysql
+ -no-sql-psql
+ -openssl-runtime
+ -skip qt3d
+ -skip qtactiveqt
+ -skip qtandroidextras
+ -skip qtcharts
+ -skip qtconnectivity
+ -skip qtdatavis3d
+ -skip qtdeclarative
+ -skip qtdoc
+ -skip qtgamepad
+ -skip qtgraphicaleffects
+ -skip qtimageformats
+ -skip qtlocation
+ -skip qtlottie
+ -skip qtmacextras
+ -skip qtnetworkauth
+ -skip qtpurchasing
+ -skip qtquick3d
+ -skip qtquickcontrols
+ -skip qtquickcontrols2
+ -skip qtquicktimeline
+ -skip qtremoteobjects
+ -skip qtscript
+ -skip qtscxml
+ -skip qtsensors
+ -skip qtserialbus
+ -skip qtspeech
+ -skip qtvirtualkeyboard
+ -skip qtwayland
+ -skip qtwebchannel
+ -skip qtwebengine
+ -skip qtwebglplugin
+ -skip qtwebview
+ -skip qtx11extras
+ -skip qtxmlpatterns
+)
+
+./configure "${configure_args[@]}"
+make -j"$(nproc)"
+make install
+
+actual_version="$("${prefix}/bin/qtpaths" --qt-version)"
+if [ "$actual_version" != "$TSAN_QT_VERSION" ]; then
+ echo "Qt version mismatch: expected $TSAN_QT_VERSION, got $actual_version" >&2
+ exit 1
+fi
+
+tsan_write_dependency_manifest qt "$prefix"
+cleanup_build_root
+trap - EXIT
diff --git a/.github/scripts/check-candidate-tag.sh b/.github/scripts/check-candidate-tag.sh
new file mode 100755
index 00000000..860f91f2
--- /dev/null
+++ b/.github/scripts/check-candidate-tag.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: check-candidate-tag.sh TAG EXPECTED_SHA" >&2
+ exit 2
+fi
+
+tag=$1
+expected_sha=$2
+ref="refs/tags/$tag"
+
+if git show-ref --verify --quiet "$ref"; then
+ if ! current=$(git rev-parse --verify --quiet "$ref^{commit}"); then
+ echo "::error::$tag does not identify a commit" >&2
+ exit 1
+ fi
+ if [ "$current" != "$expected_sha" ]; then
+ echo "::error::$tag already exists at $current; release tags are never moved" >&2
+ exit 1
+ fi
+ printf 'exists=true\n'
+ printf '%s already identifies %s; creation is idempotently satisfied.\n' "$tag" "$expected_sha" >&2
+else
+ status=$?
+ if [ "$status" -ne 1 ]; then
+ echo "::error::Could not inspect $ref (git show-ref exited $status)" >&2
+ exit "$status"
+ fi
+ printf 'exists=false\n'
+fi
diff --git a/.github/scripts/deploy-macos-app.sh b/.github/scripts/deploy-macos-app.sh
new file mode 100755
index 00000000..f4eaaae7
--- /dev/null
+++ b/.github/scripts/deploy-macos-app.sh
@@ -0,0 +1,243 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+usage() {
+ cat <<'USAGE'
+Usage: deploy-macos-app.sh --app PATH --workspace-prefix PATH --qt-prefix PATH --boost-prefix PATH --fftw-prefix PATH --libusb-prefix PATH --portaudio-prefix PATH --fortran-prefix PATH --gcc-lib PATH [--fortran-original-prefix PATH] [--homebrew-prefix PATH]
+USAGE
+}
+
+APP=""
+WORKSPACE_PREFIX="${GITHUB_WORKSPACE:-}"
+QT_PREFIX=""
+BOOST_PREFIX=""
+FFTW_PREFIX=""
+LIBUSB_PREFIX=""
+PORTAUDIO_PREFIX=""
+FORTRAN_PREFIX=""
+FORTRAN_ORIGINAL_PREFIX=""
+GCC_LIB=""
+HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-}"
+
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ --app) APP="$2"; shift 2 ;;
+ --workspace-prefix) WORKSPACE_PREFIX="$2"; shift 2 ;;
+ --qt-prefix) QT_PREFIX="$2"; shift 2 ;;
+ --boost-prefix) BOOST_PREFIX="$2"; shift 2 ;;
+ --fftw-prefix) FFTW_PREFIX="$2"; shift 2 ;;
+ --libusb-prefix) LIBUSB_PREFIX="$2"; shift 2 ;;
+ --portaudio-prefix) PORTAUDIO_PREFIX="$2"; shift 2 ;;
+ --fortran-prefix) FORTRAN_PREFIX="$2"; shift 2 ;;
+ --fortran-original-prefix) FORTRAN_ORIGINAL_PREFIX="$2"; shift 2 ;;
+ --gcc-lib) GCC_LIB="$2"; shift 2 ;;
+ --homebrew-prefix) HOMEBREW_PREFIX="$2"; shift 2 ;;
+ --help|-h) usage; exit 0 ;;
+ *) echo "Unknown argument: $1" >&2; usage >&2; exit 2 ;;
+ esac
+done
+
+for value_name in APP WORKSPACE_PREFIX QT_PREFIX BOOST_PREFIX FFTW_PREFIX LIBUSB_PREFIX PORTAUDIO_PREFIX FORTRAN_PREFIX GCC_LIB HOMEBREW_PREFIX; do
+ if [ -z "${!value_name}" ]; then
+ echo "Missing required argument or environment: ${value_name}" >&2
+ usage >&2
+ exit 2
+ fi
+done
+
+FRAMEWORKS="${APP}/Contents/Frameworks"
+mkdir -p "${FRAMEWORKS}"
+
+dump_bundle_context() {
+ local status="$1"
+ local line="$2"
+ local command="$3"
+ echo "::error::deploy-macos-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
+"${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" == "$WORKSPACE_PREFIX"/* ]]; then
+ echo "$lib"
+ return 0
+ elif [[ "$lib" == @rpath/* ]]; then
+ local name="${lib#@rpath/}"
+ for dir in \
+ "$FRAMEWORKS" \
+ "${BOOST_PREFIX}/lib" \
+ "${FFTW_PREFIX}/lib" \
+ "${LIBUSB_PREFIX}/lib" \
+ "${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"
+ if [ -n "$FORTRAN_ORIGINAL_PREFIX" ] && [[ "$ref" == "$FORTRAN_ORIGINAL_PREFIX"/* ]]; then
+ return 0
+ fi
+ case "$ref" in
+ *Qt*.framework/*)
+ return 1
+ ;;
+ "$HOMEBREW_PREFIX"/*|"$WORKSPACE_PREFIX"/*|@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
+ "$WORKSPACE_PREFIX"/*|"$HOMEBREW_PREFIX"/*)
+ run_logged install_name_tool -delete_rpath "$rpath" "$binary"
+ ;;
+ esac
+ done < <(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true)
+
+ local rpaths
+ rpaths=$(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true)
+ case $'\n'"$rpaths"$'\n' in
+ *$'\n''@executable_path/../Frameworks'$'\n'*) ;;
+ *)
+ run_logged install_name_tool -add_rpath "@executable_path/../Frameworks" "$binary"
+ ;;
+ esac
+}
+
+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/*" -print -quit 2>/dev/null)
+ 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
+ "$HOMEBREW_PREFIX"/*|"$WORKSPACE_PREFIX"/*)
+ echo "${binary}: ${ref}" >> "$remaining_refs"
+ ;;
+ esac
+ if [ -n "$FORTRAN_ORIGINAL_PREFIX" ] && [[ "$ref" == "$FORTRAN_ORIGINAL_PREFIX"/* ]]; then
+ echo "${binary}: ${ref}" >> "$remaining_refs"
+ fi
+ 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
+fi
+
+echo "All dylibs bundled successfully"
diff --git a/.github/scripts/deploy-macos-cli-tools.sh b/.github/scripts/deploy-macos-cli-tools.sh
new file mode 100755
index 00000000..d8603599
--- /dev/null
+++ b/.github/scripts/deploy-macos-cli-tools.sh
@@ -0,0 +1,259 @@
+#!/usr/bin/env bash
+set -Eeuo pipefail
+
+usage() {
+ cat <<'USAGE'
+Usage: deploy-macos-cli-tools.sh --assets PATH --stage PATH --workspace-prefix PATH --boost-prefix PATH --fftw-prefix PATH --libusb-prefix PATH --portaudio-prefix PATH --fortran-prefix PATH --gcc-lib PATH [--fortran-original-prefix PATH] [--homebrew-prefix PATH]
+USAGE
+}
+
+ASSETS=""
+STAGE=""
+WORKSPACE_PREFIX="${GITHUB_WORKSPACE:-}"
+BOOST_PREFIX=""
+FFTW_PREFIX=""
+LIBUSB_PREFIX=""
+PORTAUDIO_PREFIX=""
+FORTRAN_PREFIX=""
+FORTRAN_ORIGINAL_PREFIX=""
+GCC_LIB=""
+HOMEBREW_PREFIX="${HOMEBREW_PREFIX:-}"
+
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ --assets) ASSETS="$2"; shift 2 ;;
+ --stage) STAGE="$2"; shift 2 ;;
+ --workspace-prefix) WORKSPACE_PREFIX="$2"; shift 2 ;;
+ --boost-prefix) BOOST_PREFIX="$2"; shift 2 ;;
+ --fftw-prefix) FFTW_PREFIX="$2"; shift 2 ;;
+ --libusb-prefix) LIBUSB_PREFIX="$2"; shift 2 ;;
+ --portaudio-prefix) PORTAUDIO_PREFIX="$2"; shift 2 ;;
+ --fortran-prefix) FORTRAN_PREFIX="$2"; shift 2 ;;
+ --fortran-original-prefix) FORTRAN_ORIGINAL_PREFIX="$2"; shift 2 ;;
+ --gcc-lib) GCC_LIB="$2"; shift 2 ;;
+ --homebrew-prefix) HOMEBREW_PREFIX="$2"; shift 2 ;;
+ --help|-h) usage; exit 0 ;;
+ *) echo "Unknown argument: $1" >&2; usage >&2; exit 2 ;;
+ esac
+done
+
+for value_name in ASSETS STAGE WORKSPACE_PREFIX BOOST_PREFIX FFTW_PREFIX LIBUSB_PREFIX PORTAUDIO_PREFIX FORTRAN_PREFIX GCC_LIB HOMEBREW_PREFIX; do
+ if [ -z "${!value_name}" ]; then
+ echo "Missing required argument or environment: ${value_name}" >&2
+ usage >&2
+ exit 2
+ fi
+done
+
+LIBDIR="${ASSETS}/lib"
+mkdir -p "${LIBDIR}"
+
+dump_cli_context() {
+ local status="$1"
+ local line="$2"
+ local command="$3"
+ echo "::error::deploy-macos-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
+ ;;
+ "$WORKSPACE_PREFIX"/*|"$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" \
+ "${WORKSPACE_PREFIX}/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" \
+ "${BOOST_PREFIX}/lib" \
+ "${FFTW_PREFIX}/lib" \
+ "${LIBUSB_PREFIX}/lib" \
+ "${PORTAUDIO_PREFIX}/lib" \
+ "${FORTRAN_PREFIX}/lib" \
+ "${GCC_LIB}" \
+ "${HOMEBREW_PREFIX}/lib"
+ do
+ [ -f "${dir}/${name}" ] && echo "${dir}/${name}" && return 0
+ done
+ fi
+ fi
+
+ 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/*|"$WORKSPACE_PREFIX"/*|"$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 "($WORKSPACE_PREFIX|$HOMEBREW_PREFIX|@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
+ "$WORKSPACE_PREFIX"/*|"$HOMEBREW_PREFIX"/*)
+ bad_rpaths+=("$rpath")
+ ;;
+ esac
+ done < <(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true)
+
+ 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
+
+ local rpaths
+ rpaths=$(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true)
+ case $'\n'"$rpaths"$'\n' in
+ *$'\n''@loader_path/lib'$'\n'*) ;;
+ *)
+ run_logged install_name_tool -add_rpath "@loader_path/lib" "$binary"
+ ;;
+ esac
+}
+
+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
diff --git a/.github/scripts/generate-quick-downloads.py b/.github/scripts/generate-quick-downloads.py
new file mode 100755
index 00000000..6706292d
--- /dev/null
+++ b/.github/scripts/generate-quick-downloads.py
@@ -0,0 +1,122 @@
+#!/usr/bin/env python3
+"""Generate the "Quick Downloads" markdown block for a WSJT-X GitHub Release.
+
+The release workflow attaches every build artifact to the Release, which makes
+the assets list long and hard for an end user to navigate (installers sit among
+standalone command-line utilities, raw binaries, and source). This emits a
+short, curated per-platform installer picker to prepend to the auto-generated
+release notes.
+
+It is *asset-driven*: platforms and architectures are derived from the asset
+filenames passed in, not hard-coded. New build variants (for example an added
+Linux architecture such as armhf) therefore appear in Quick Downloads
+automatically, with no edit to this script.
+
+The block is emitted on stdout, ending at the last platform line (no trailing
+separator); the caller joins it to the auto-generated notes.
+
+Usage:
+ generate-quick-downloads.py <owner/repo> <tag> <asset-path-or-name>...
+
+Only installer-grade assets are listed (.pkg / win64.exe / .deb / .rpm /
+.AppImage) plus the source tarball. Per-mode utility tarballs and raw
+command-line binaries are intentionally omitted; they remain in the full
+assets list below the notes.
+"""
+import os
+import re
+import sys
+
+# Architectures listed first, in this order; any others are appended sorted.
+ARCH_ORDER = ["x86_64", "aarch64", "armhf", "armv7l", "arm64", "i686"]
+
+
+def main(argv):
+ if len(argv) < 4:
+ sys.stderr.write(
+ "usage: generate-quick-downloads.py <owner/repo> <tag> <asset>...\n"
+ )
+ return 2
+
+ repo, tag = argv[1], argv[2]
+ names = sorted({os.path.basename(p) for p in argv[3:] if p.strip()})
+
+ def url(name):
+ return f"https://github.com/{repo}/releases/download/{tag}/{name}"
+
+ macos = {} # label -> filename
+ windows = {} # label -> filename
+ deb = {} # arch -> filename
+ rpm = {} # arch -> filename
+ appimage = {} # arch -> filename
+ source = None
+
+ for n in names:
+ if n.endswith("-arm64-macOS.pkg"):
+ macos["Apple Silicon"] = n
+ elif n.endswith("-x86_64-macOS.pkg"):
+ macos["Intel"] = n
+ elif re.search(r"-win\d+\.exe$", n): # installer, not raw jt9.exe
+ windows["64-bit"] = n
+ elif n.endswith("-src.tar.gz"):
+ source = n
+ elif (m := re.search(r"-linux-([A-Za-z0-9_]+)\.deb$", n)):
+ deb[m.group(1)] = n
+ elif (m := re.search(r"-linux-([A-Za-z0-9_]+)\.AppImage$", n)):
+ appimage[m.group(1)] = n
+ elif (m := re.search(r"\.([A-Za-z0-9_]+)\.rpm$", n)):
+ rpm[m.group(1)] = n
+ # Anything else (utility tarballs, raw binaries) is intentionally
+ # excluded; it stays in the full assets list.
+
+ def arches(d):
+ known = [a for a in ARCH_ORDER if a in d]
+ extra = sorted(a for a in d if a not in ARCH_ORDER)
+ return known + extra
+
+ def arch_line(label, d):
+ return f"- {label}: " + " · ".join(
+ f"[{a}]({url(d[a])})" for a in arches(d)
+ )
+
+ out = [
+ "## Quick Downloads",
+ "",
+ "Choose the installer for your platform. The full assets list below also",
+ "includes standalone command-line utilities and source code for developers.",
+ ]
+
+ if macos:
+ out += ["", "### macOS"]
+ if "Apple Silicon" in macos:
+ out.append(f"- Apple Silicon: [{macos['Apple Silicon']}]({url(macos['Apple Silicon'])})")
+ if "Intel" in macos:
+ out.append(f"- Intel: [{macos['Intel']}]({url(macos['Intel'])})")
+
+ if windows:
+ out += ["", "### Windows"]
+ out.append(f"- 64-bit: [{windows['64-bit']}]({url(windows['64-bit'])})")
+
+ if deb or rpm or appimage:
+ out += ["", "### Linux"]
+ if deb:
+ out.append(arch_line("Debian / Ubuntu (.deb)", deb))
+ if rpm:
+ out.append(arch_line("Fedora / RHEL (.rpm)", rpm))
+ if appimage:
+ out.append(arch_line("AppImage (universal)", appimage))
+
+ if source:
+ out += ["", "### Source", f"- [{source}]({url(source)})"]
+
+ # If nothing matched (no installer-grade assets), emit nothing so the
+ # caller leaves the auto-generated notes untouched.
+ if len(out) == 4:
+ return 0
+
+ sys.stdout.write("\n".join(out) + "\n")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main(sys.argv))
diff --git a/.github/scripts/ghcr_retention.py b/.github/scripts/ghcr_retention.py
new file mode 100755
index 00000000..ac0881f6
--- /dev/null
+++ b/.github/scripts/ghcr_retention.py
@@ -0,0 +1,234 @@
+#!/usr/bin/env python3
+"""Plan and apply conservative retention for WSJT-X GHCR build images."""
+
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import re
+import sys
+import urllib.error
+import urllib.parse
+import urllib.request
+from dataclasses import dataclass
+from datetime import datetime, timedelta, timezone
+from typing import Iterable
+
+
+API_VERSION = "2022-11-28"
+BUILD_TAG = re.compile(
+ r"^(?:build-\d{8}-\d+-\d+|validated-build-\d{8}-\d+-\d+|candidate-\d+-\d+)$"
+)
+
+
+@dataclass(frozen=True)
+class Version:
+ id: int
+ digest: str
+ created_at: datetime
+ tags: tuple[str, ...]
+
+
+@dataclass(frozen=True)
+class Decision:
+ version: Version
+ delete: bool
+ reason: str
+
+
+def parse_timestamp(value: object) -> datetime:
+ if not isinstance(value, str):
+ raise ValueError("created_at must be a string")
+ parsed = datetime.fromisoformat(value.replace("Z", "+00:00"))
+ if parsed.tzinfo is None:
+ raise ValueError("created_at must include a timezone")
+ return parsed.astimezone(timezone.utc)
+
+
+def parse_version(raw: object) -> Version:
+ if not isinstance(raw, dict):
+ raise ValueError("package version must be an object")
+ version_id = raw.get("id")
+ digest = raw.get("name")
+ metadata = raw.get("metadata")
+ if not isinstance(version_id, int) or not isinstance(digest, str):
+ raise ValueError("package version requires integer id and string name")
+ if not isinstance(metadata, dict) or metadata.get("package_type") != "container":
+ raise ValueError(f"package version {version_id} is not a container")
+ container = metadata.get("container")
+ tags = container.get("tags") if isinstance(container, dict) else None
+ if not isinstance(tags, list) or not all(isinstance(tag, str) for tag in tags):
+ raise ValueError(f"package version {version_id} has invalid tags")
+ return Version(
+ id=version_id,
+ digest=digest,
+ created_at=parse_timestamp(raw.get("created_at")),
+ tags=tuple(sorted(tags)),
+ )
+
+
+def is_retirable(version: Version) -> bool:
+ return bool(version.tags) and all(
+ tag == "stable" or BUILD_TAG.fullmatch(tag) for tag in version.tags
+ )
+
+
+def plan_retention(
+ versions: Iterable[Version], now: datetime, max_age_days: int, keep: int
+) -> list[Decision]:
+ ordered = sorted(versions, key=lambda item: (item.created_at, item.id), reverse=True)
+ retirable = [version for version in ordered if is_retirable(version)]
+ kept_ids = {version.id for version in retirable[:keep]}
+ cutoff = now.astimezone(timezone.utc) - timedelta(days=max_age_days)
+ decisions: list[Decision] = []
+ for version in ordered:
+ if "stable" in version.tags:
+ decisions.append(Decision(version, False, "stable"))
+ elif not is_retirable(version):
+ decisions.append(Decision(version, False, "unknown-or-untagged"))
+ elif version.id in kept_ids:
+ decisions.append(Decision(version, False, "newest-generation"))
+ elif version.created_at >= cutoff:
+ decisions.append(Decision(version, False, "within-retention-window"))
+ else:
+ decisions.append(Decision(version, True, "expired"))
+ return decisions
+
+
+class GitHubPackagesClient:
+ def __init__(self, token: str, api_url: str = "https://api.github.com") -> None:
+ self.api_url = api_url.rstrip("/")
+ self.headers = {
+ "Accept": "application/vnd.github+json",
+ "Authorization": f"Bearer {token}",
+ "X-GitHub-Api-Version": API_VERSION,
+ "User-Agent": "wsjtx-ghcr-retention",
+ }
+
+ def request(self, method: str, path: str) -> object | None:
+ request = urllib.request.Request(
+ f"{self.api_url}{path}", headers=self.headers, method=method
+ )
+ try:
+ with urllib.request.urlopen(request, timeout=30) as response:
+ if method == "DELETE":
+ if response.status != 204:
+ raise RuntimeError(f"DELETE {path} returned HTTP {response.status}")
+ return None
+ return json.load(response)
+ except urllib.error.HTTPError as error:
+ request_id = error.headers.get("x-github-request-id", "unknown")
+ raise RuntimeError(
+ f"{method} {path} failed with HTTP {error.code} "
+ f"(GitHub request {request_id})"
+ ) from error
+
+ @staticmethod
+ def package_path(owner: str, package: str) -> str:
+ encoded = urllib.parse.quote(package, safe="")
+ return f"/orgs/{owner}/packages/container/{encoded}"
+
+ def list_versions(self, owner: str, package: str) -> list[Version]:
+ base = self.package_path(owner, package)
+ versions: list[Version] = []
+ page = 1
+ while True:
+ raw = self.request(
+ "GET", f"{base}/versions?state=active&per_page=100&page={page}"
+ )
+ if not isinstance(raw, list):
+ raise RuntimeError(f"GitHub returned a non-list for package {package}")
+ versions.extend(parse_version(item) for item in raw)
+ if len(raw) < 100:
+ return versions
+ page += 1
+
+ def get_version(self, owner: str, package: str, version_id: int) -> Version:
+ raw = self.request(
+ "GET", f"{self.package_path(owner, package)}/versions/{version_id}"
+ )
+ return parse_version(raw)
+
+ def delete_version(self, owner: str, package: str, version_id: int) -> None:
+ self.request(
+ "DELETE", f"{self.package_path(owner, package)}/versions/{version_id}"
+ )
+
+
+def process_package(
+ client: GitHubPackagesClient,
+ owner: str,
+ package: str,
+ now: datetime,
+ max_age_days: int,
+ keep: int,
+ apply: bool,
+) -> int:
+ decisions = plan_retention(client.list_versions(owner, package), now, max_age_days, keep)
+ deleted = 0
+ for decision in decisions:
+ version = decision.version
+ action = "delete" if decision.delete else "keep"
+ print(
+ f"{package} id={version.id} digest={version.digest} "
+ f"created={version.created_at.isoformat()} tags={','.join(version.tags) or '-'} "
+ f"action={action} reason={decision.reason}"
+ )
+ if not apply or not decision.delete:
+ continue
+ refreshed = client.get_version(owner, package, version.id)
+ refreshed_decision = next(
+ item
+ for item in plan_retention([refreshed], now, max_age_days, 0)
+ if item.version.id == version.id
+ )
+ if not refreshed_decision.delete:
+ print(
+ f"{package} id={version.id} action=keep "
+ f"reason=changed-before-delete-{refreshed_decision.reason}"
+ )
+ continue
+ client.delete_version(owner, package, version.id)
+ deleted += 1
+ return deleted
+
+
+def parse_args() -> argparse.Namespace:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--owner", required=True)
+ parser.add_argument("--package", action="append", required=True)
+ parser.add_argument("--max-age-days", type=int, default=60)
+ parser.add_argument("--keep", type=int, default=3)
+ parser.add_argument("--apply", action="store_true")
+ return parser.parse_args()
+
+
+def main() -> int:
+ args = parse_args()
+ if args.max_age_days < 1 or args.keep < 1:
+ print("max-age-days and keep must be positive", file=sys.stderr)
+ return 2
+ token = os.environ.get("GITHUB_TOKEN")
+ if not token:
+ print("GITHUB_TOKEN is required", file=sys.stderr)
+ return 2
+ client = GitHubPackagesClient(token)
+ now = datetime.now(timezone.utc)
+ deleted = 0
+ for package in args.package:
+ deleted += process_package(
+ client,
+ args.owner,
+ package,
+ now,
+ args.max_age_days,
+ args.keep,
+ args.apply,
+ )
+ print(f"total_deleted={deleted} apply={str(args.apply).lower()}")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/.github/scripts/is-linux-ci-image-input.sh b/.github/scripts/is-linux-ci-image-input.sh
new file mode 100755
index 00000000..23a76e1b
--- /dev/null
+++ b/.github/scripts/is-linux-ci-image-input.sh
@@ -0,0 +1,127 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+. .github/scripts/linux-ci-image-inputs.sh
+
+is_linux_ci_image_input() {
+ local profile=$1
+ local path=$2
+ local input inputs
+
+ if ! inputs="$(linux_ci_image_inputs "$profile")"; then
+ return 2
+ fi
+
+ while IFS= read -r input; do
+ if [ "$path" = "$input" ]; then
+ return 0
+ fi
+ done <<< "$inputs"
+ return 1
+}
+
+linux_ci_image_set_for_inputs() {
+ local normal=false tsan=false path
+
+ for path in "$@"; do
+ if is_linux_ci_image_input normal-noble "$path" ||
+ is_linux_ci_image_input normal-bookworm "$path" ||
+ is_linux_ci_image_input armhf-cross-bookworm "$path" ||
+ is_linux_ci_image_input armhf-runtime-bookworm "$path"; then
+ normal=true
+ fi
+ if is_linux_ci_image_input tsan-noble "$path"; then
+ tsan=true
+ fi
+ done
+
+ if [ "$normal" = true ] && [ "$tsan" = true ]; then
+ echo normal-and-tsan
+ elif [ "$normal" = true ]; then
+ echo normal
+ elif [ "$tsan" = true ]; then
+ echo tsan
+ else
+ echo none
+ fi
+}
+
+expect_input() {
+ if ! is_linux_ci_image_input "$1" "$2"; then
+ echo "self-test failed: expected $1 image input: $2" >&2
+ exit 1
+ fi
+}
+
+expect_non_input() {
+ if is_linux_ci_image_input "$1" "$2"; then
+ echo "self-test failed: unexpected $1 image input: $2" >&2
+ exit 1
+ fi
+}
+
+expect_image_set() {
+ local expected=$1
+ shift
+ local actual
+ actual="$(linux_ci_image_set_for_inputs "$@")"
+ if [ "$actual" != "$expected" ]; then
+ echo "self-test failed: expected image set $expected, got $actual" >&2
+ exit 1
+ fi
+}
+
+if [ "${1:-}" = "--self-test" ]; then
+ expect_input normal-noble ".github/images/linux-ci/Dockerfile.noble"
+ expect_input tsan-noble ".github/images/linux-ci/Dockerfile.noble"
+ expect_input normal-bookworm ".github/images/linux-ci/Dockerfile.bookworm"
+ expect_input armhf-cross-bookworm ".github/images/linux-ci/Dockerfile.armhf-cross"
+ expect_input armhf-runtime-bookworm ".github/images/linux-ci/Dockerfile.armhf-runtime"
+ expect_input armhf-runtime-bookworm ".github/images/linux-ci/install-armhf-runtime-packages.sh"
+ expect_non_input normal-noble ".github/images/linux-ci/install-armhf-runtime-packages.sh"
+ expect_input armhf-cross-bookworm ".github/images/linux-ci/armhf-cross-toolchain.config"
+ expect_non_input armhf-runtime-bookworm ".github/images/linux-ci/armhf-cross-toolchain.config"
+ expect_input normal-noble ".github/scripts/build-hamlib-linux.sh"
+ expect_non_input tsan-noble ".github/scripts/build-hamlib-linux.sh"
+ expect_input tsan-noble ".github/scripts/build-qt-tsan-linux.sh"
+ expect_non_input normal-noble ".github/scripts/build-qt-tsan-linux.sh"
+ expect_input normal-noble ".github/scripts/verify-linux-ci-image.sh"
+ expect_input tsan-noble ".github/scripts/verify-linux-ci-image.sh"
+
+ expect_non_input normal-noble ".github/workflows/build-linux.yml"
+ expect_non_input tsan-noble "CMake/Sources.cmake"
+ expect_non_input normal-bookworm ".github/scripts/build-boost-macos.sh"
+ expect_image_set normal ".github/scripts/build-hamlib-linux.sh"
+ expect_image_set tsan ".github/scripts/build-qt-tsan-linux.sh"
+ expect_image_set normal-and-tsan ".github/scripts/verify-linux-ci-image.sh"
+ expect_image_set normal-and-tsan \
+ ".github/scripts/build-hamlib-linux.sh" \
+ ".github/scripts/build-qt-tsan-linux.sh"
+ expect_image_set none "CMake/Sources.cmake"
+ if is_linux_ci_image_input unsupported ".github/images/linux-ci/Dockerfile.noble" 2>/dev/null; then
+ echo "self-test failed: unsupported image profile was accepted" >&2
+ exit 1
+ elif [ "$?" -ne 2 ]; then
+ echo "self-test failed: unsupported image profile did not return status 2" >&2
+ exit 1
+ fi
+ exit 0
+fi
+
+if [ "${1:-}" = "--classify" ]; then
+ shift
+ if [ "$#" -eq 0 ]; then
+ echo "Usage: is-linux-ci-image-input.sh --classify PATH [PATH ...]" >&2
+ exit 2
+ fi
+ linux_ci_image_set_for_inputs "$@"
+ exit 0
+fi
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: is-linux-ci-image-input.sh PROFILE PATH | --classify PATH [PATH ...]" >&2
+ exit 2
+fi
+
+is_linux_ci_image_input "$1" "$2"
diff --git a/.github/scripts/linux-artifact-validation.sh b/.github/scripts/linux-artifact-validation.sh
new file mode 100644
index 00000000..01a607f6
--- /dev/null
+++ b/.github/scripts/linux-artifact-validation.sh
@@ -0,0 +1,290 @@
+#!/bin/bash
+# Shared acceptance checks for Linux build products.
+
+linux_validation_error() {
+ echo "::error::$*" >&2
+ return 1
+}
+
+validate_elf_metadata() {
+ local arch="$1"
+ local path="$2"
+ local file_output="$3"
+ local header_output="$4"
+ local program_output="$5"
+
+ case "$arch" in
+ armhf)
+ [[ "$file_output" == *"ELF 32-bit"* ]] || {
+ linux_validation_error "$path is not ELF32"
+ return 1
+ }
+ [[ "$file_output" == *"ARM, EABI5"* ]] || {
+ linux_validation_error "$path is not ARM EABI5"
+ return 1
+ }
+ [[ "$header_output" == *"Class:"*"ELF32"* ]] || {
+ linux_validation_error "$path has the wrong ELF class for armhf"
+ return 1
+ }
+ [[ "$header_output" == *"Machine:"*"ARM"* ]] || {
+ linux_validation_error "$path has the wrong ELF machine for armhf"
+ return 1
+ }
+ [[ "$header_output" == *"Version5 EABI"* ]] || {
+ linux_validation_error "$path does not use EABI5"
+ return 1
+ }
+ [[ "$header_output" == *"hard-float ABI"* ]] || {
+ linux_validation_error "$path does not use the ARM hard-float ABI"
+ return 1
+ }
+ if [[ "$file_output" == *"dynamically linked"* ]] &&
+ [[ "$program_output" != *"/lib/ld-linux-armhf.so.3"* ]]; then
+ linux_validation_error "$path does not request /lib/ld-linux-armhf.so.3"
+ return 1
+ fi
+ ;;
+ x86_64)
+ [[ "$file_output" == *"ELF 64-bit"* && "$file_output" == *"x86-64"* ]] || {
+ linux_validation_error "$path is not a 64-bit x86-64 ELF"
+ return 1
+ }
+ ;;
+ aarch64)
+ [[ "$file_output" == *"ELF 64-bit"* && "$file_output" == *"ARM aarch64"* ]] || {
+ linux_validation_error "$path is not a 64-bit AArch64 ELF"
+ return 1
+ }
+ ;;
+ *)
+ linux_validation_error "Unsupported Linux architecture: $arch"
+ return 2
+ ;;
+ esac
+}
+
+validate_elf_executable() {
+ local arch="$1"
+ local path="$2"
+ local file_output
+ local header_output
+ local program_output
+
+ if [ ! -x "$path" ]; then
+ linux_validation_error "Required executable is missing: $path"
+ return 1
+ fi
+
+ file_output=$(file -- "$path") || return
+ header_output=$(readelf -hW -- "$path") || return
+ program_output=$(readelf -lW -- "$path") || return
+ echo "$file_output"
+ validate_elf_metadata "$arch" "$path" "$file_output" "$header_output" "$program_output"
+}
+
+validate_linux_build_executables() {
+ local build_dir="$1"
+ local arch="$2"
+ local executable
+
+ for executable in wsjtx jt9 qmap/qmap map65/map65 ft8code wsprd; do
+ validate_elf_executable "$arch" "$build_dir/$executable" || return
+ done
+}
+
+linux_manifest_has_path() {
+ local manifest="$1"
+ local path="$2"
+ case $'\n'"$manifest"$'\n' in
+ *"$path"$'\n'*) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+validate_linux_package_manifest() {
+ local manifest="$1"
+ local label="$2"
+ local path
+
+ for path in \
+ /usr/bin/wsjtx \
+ /usr/bin/jt9 \
+ /usr/bin/qmap \
+ /usr/bin/map65 \
+ /usr/share/wsjtx/ALLCALL7.TXT \
+ /usr/share/wsjtx/CALL3.TXT \
+ /usr/share/wsjtx/sounds/Message.wav \
+ /usr/share/wsjtx/sounds/Testing123.wav; do
+ if ! linux_manifest_has_path "$manifest" "$path"; then
+ linux_validation_error "$label is missing expected package path: $path"
+ return 1
+ fi
+ done
+
+ case $'\n'"$manifest"$'\n' in
+ *"/usr/bin/sounds"$'\n'* | *"/usr/bin/sounds/"*)
+ linux_validation_error "$label contains unexpected package path: /usr/bin/sounds"
+ return 1
+ ;;
+ esac
+}
+
+validate_deb_package() {
+ local package="$1"
+ local manifest
+
+ manifest=$(dpkg-deb --fsys-tarfile "$package" | tar -tf -) || return
+ validate_linux_package_manifest "$manifest" "DEB $package"
+}
+
+validate_rpm_package() {
+ local package="$1"
+ local manifest
+
+ manifest=$(rpm -qpl "$package") || return
+ printf '%s\n' "$manifest" | sed -n '1,40p'
+ validate_linux_package_manifest "$manifest" "RPM $package"
+}
+
+linux_require_executable() {
+ local path="$1"
+ if [ ! -x "$path" ]; then
+ linux_validation_error "Required executable is missing: $path"
+ return 1
+ fi
+}
+
+linux_require_file() {
+ local path="$1"
+ if [ ! -f "$path" ]; then
+ linux_validation_error "Required file is missing: $path"
+ return 1
+ fi
+}
+
+validate_linux_application_layout() {
+ local root="$1"
+ local kind="$2"
+ local path
+
+ for path in wsjtx jt9 qmap map65 ft8code; do
+ linux_require_executable "$root/usr/bin/$path" || return
+ done
+ if [ "$kind" = appimage ]; then
+ linux_require_executable "$root/usr/bin/wsprd" || return
+ elif [ "$kind" != appdir ]; then
+ linux_validation_error "Unknown application tree kind: $kind"
+ return 2
+ fi
+
+ for path in \
+ usr/share/wsjtx/ALLCALL7.TXT \
+ usr/share/wsjtx/CALL3.TXT \
+ usr/share/wsjtx/sounds/Message.wav \
+ usr/share/wsjtx/sounds/Testing123.wav; do
+ linux_require_file "$root/$path" || return
+ done
+ if [ -e "$root/usr/bin/sounds" ] || [ -L "$root/usr/bin/sounds" ]; then
+ linux_validation_error "Unexpected executable-adjacent sounds path is present: $root/usr/bin/sounds"
+ return 1
+ fi
+
+ if [ "$kind" = appdir ]; then
+ linux_require_file "$root/usr/share/applications/wsjtx.desktop" || return
+ linux_require_file "$root/usr/share/pixmaps/wsjtx_icon.png" || return
+ return 0
+ fi
+
+ for path in \
+ usr/bin/qt.conf \
+ usr/plugins/platforms/libqxcb.so \
+ usr/plugins/sqldrivers/libqsqlite.so; do
+ linux_require_file "$root/$path" || return
+ done
+ if ! grep -Eq '^[[:space:]]*Plugins[[:space:]]*=[[:space:]]*plugins[[:space:]]*$' \
+ "$root/usr/bin/qt.conf"; then
+ linux_validation_error "AppImage qt.conf must set Plugins = plugins"
+ echo "AppImage qt.conf contents:"
+ cat "$root/usr/bin/qt.conf"
+ return 1
+ fi
+
+ for path in libQt5Core.so libQt5Widgets.so libQt5Multimedia.so; do
+ if [ -z "$(find "$root/usr/lib" -maxdepth 1 -name "$path*" -print -quit 2>/dev/null)" ]; then
+ linux_validation_error "Required AppImage Qt library is missing: $path"
+ return 1
+ fi
+ done
+
+ if [ -z "$(find "$root" -path '*/plugins/audio/*.so' -print -quit 2>/dev/null)" ]; then
+ linux_validation_error "No Qt audio backend plugin is bundled in the AppImage"
+ echo "AppImage plugin tree:"
+ find "$root" -path '*/plugins/*' -name '*.so' -print 2>/dev/null | sed -n '1,20p'
+ return 1
+ fi
+}
+
+validate_linux_application_tree() {
+ local root="$1"
+ local kind="$2"
+ local arch="$3"
+ local executable
+
+ validate_linux_application_layout "$root" "$kind" || return
+ for executable in wsjtx jt9 qmap map65 ft8code; do
+ validate_elf_executable "$arch" "$root/usr/bin/$executable" || return
+ done
+ if [ "$kind" = appimage ]; then
+ validate_elf_executable "$arch" "$root/usr/bin/wsprd" || return
+ echo "Qt audio plugins bundled:"
+ find "$root" -path '*/plugins/audio/*.so' -print 2>/dev/null
+ fi
+}
+
+run_packaged_appimage_startup_smoke() {
+ local appimage="$1"
+ local log="$2"
+ local status
+ local runner=()
+ if [ -n "${LINUX_APPIMAGE_RUNNER:-}" ]; then
+ runner=("$LINUX_APPIMAGE_RUNNER")
+ fi
+
+ mkdir -p "$(dirname "$log")"
+ if env \
+ -u LD_LIBRARY_PATH \
+ -u LD_PRELOAD \
+ -u LD_AUDIT \
+ -u QT_PLUGIN_PATH \
+ -u QT_QPA_PLATFORM_PLUGIN_PATH \
+ -u QML_IMPORT_PATH \
+ -u QML2_IMPORT_PATH \
+ APPIMAGE_EXTRACT_AND_RUN=1 \
+ QT_QPA_PLATFORM=xcb \
+ timeout --kill-after=5s 45s \
+ xvfb-run -a -s "-screen 0 1280x1024x24" \
+ "${runner[@]}" \
+ "$appimage" \
+ --startup-smoke-test \
+ --rig-name CI-APPIMAGE-STARTUP \
+ >"$log" 2>&1; then
+ status=0
+ else
+ status=$?
+ fi
+
+ cat "$log"
+ if [ "$status" -eq 124 ]; then
+ linux_validation_error "AppImage startup smoke test timed out after 45 seconds"
+ return 1
+ fi
+ if [ "$status" -ne 0 ]; then
+ linux_validation_error "AppImage startup smoke test exited with status $status"
+ return 1
+ fi
+ if ! grep -Fq "WSJT-X startup smoke test passed" "$log"; then
+ linux_validation_error "AppImage exited successfully without the startup-smoke success marker"
+ return 1
+ fi
+}
diff --git a/.github/scripts/linux-ccache-compiler-signature.sh b/.github/scripts/linux-ccache-compiler-signature.sh
new file mode 100755
index 00000000..02d3270b
--- /dev/null
+++ b/.github/scripts/linux-ccache-compiler-signature.sh
@@ -0,0 +1,157 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: linux-ccache-compiler-signature.sh C_COMPILER" >&2
+ exit 2
+fi
+
+c_compiler=$1
+case "$(basename "$c_compiler")" in
+ gcc)
+ cxx_compiler=g++
+ ;;
+ gcc-*)
+ cxx_compiler="g++-${c_compiler##*-}"
+ ;;
+ *-gcc)
+ cxx_compiler="${c_compiler%-gcc}-g++"
+ ;;
+ *)
+ echo "Unsupported C compiler for Linux ccache identity: $c_compiler" >&2
+ exit 2
+ ;;
+esac
+
+resolve_executable() {
+ local executable=$1 resolved
+ if [[ "$executable" == */* ]]; then
+ resolved=$executable
+ else
+ resolved="$(command -v "$executable" || true)"
+ fi
+ if [ -z "$resolved" ] || [ ! -f "$resolved" ]; then
+ echo "Compiler component not found: $executable" >&2
+ exit 1
+ fi
+ readlink -f "$resolved"
+}
+
+hash_file() {
+ sha256sum "$1" | awk '{print $1}'
+}
+
+c_path="$(resolve_executable "$(command -v "$c_compiler")")"
+cxx_path="$(resolve_executable "$(command -v "$cxx_compiler")")"
+compiler_version="$($c_compiler -dumpfullversion -dumpversion)"
+cxx_version="$($cxx_compiler -dumpfullversion -dumpversion)"
+compiler_target="$($c_compiler -dumpmachine)"
+cxx_target="$($cxx_compiler -dumpmachine)"
+
+if [ "$cxx_version" != "$compiler_version" ]; then
+ echo "C and C++ compiler version mismatch: $compiler_version != $cxx_version" >&2
+ exit 1
+fi
+if [ "$cxx_target" != "$compiler_target" ]; then
+ echo "C and C++ compiler target mismatch: $compiler_target != $cxx_target" >&2
+ exit 1
+fi
+if [[ ! "$compiler_version" =~ ^[0-9]+([.][0-9]+)*$ ]]; then
+ echo "Invalid GCC version: $compiler_version" >&2
+ exit 1
+fi
+if [[ ! "$compiler_target" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then
+ echo "Invalid GCC target: $compiler_target" >&2
+ exit 1
+fi
+
+cc1_path="$(resolve_executable "$($c_compiler -print-prog-name=cc1)")"
+cc1plus_path="$(resolve_executable "$($cxx_compiler -print-prog-name=cc1plus)")"
+lto1_path="$(resolve_executable "$($c_compiler -print-prog-name=lto1)")"
+assembler_path="$(resolve_executable "$($c_compiler -print-prog-name=as)")"
+dumpspecs_sha256="$($c_compiler -dumpspecs | sha256sum | awk '{print $1}')"
+
+if ! command -v ldd >/dev/null 2>&1; then
+ echo "ldd is required to identify compiler runtime dependencies" >&2
+ exit 1
+fi
+
+runtime_dependency_records() {
+ local role=$1 executable=$2 output dependencies name dependency
+
+ if ! output="$(LC_ALL=C ldd "$executable" 2>&1)"; then
+ case "$output" in
+ *"not a dynamic executable"*|*"statically linked"*) return 0 ;;
+ *)
+ echo "Could not inspect runtime dependencies for $executable: $output" >&2
+ return 1
+ ;;
+ esac
+ fi
+ if [[ "$output" == *"=> not found"* ]]; then
+ echo "Unresolved runtime dependency for $executable: $output" >&2
+ return 1
+ fi
+
+ dependencies="$(printf '%s\n' "$output" | awk '
+ /=> \/[^ ]+/ { print $1 "\t" $(NF - 1) }
+ $1 ~ /^\// {
+ name = $1
+ sub(/^.*\//, "", name)
+ print name "\t" $1
+ }
+ ')"
+ if [ -z "$dependencies" ]; then
+ case "$output" in
+ *"statically linked"*|*"not a dynamic executable"*) return 0 ;;
+ *)
+ echo "No runtime dependencies could be parsed for $executable: $output" >&2
+ return 1
+ ;;
+ esac
+ fi
+
+ while IFS=$'\t' read -r name dependency; do
+ dependency="$(readlink -f "$dependency")"
+ if [ ! -f "$dependency" ]; then
+ echo "Runtime dependency not found for $executable: $dependency" >&2
+ return 1
+ fi
+ printf '%s:%s:%s\n' "$role" "$name" "$(hash_file "$dependency")"
+ done <<< "$dependencies"
+}
+
+runtime_dependencies="$({
+ runtime_dependency_records c_driver "$c_path"
+ runtime_dependency_records cxx_driver "$cxx_path"
+ runtime_dependency_records cc1 "$cc1_path"
+ runtime_dependency_records cc1plus "$cc1plus_path"
+ runtime_dependency_records lto1 "$lto1_path"
+ runtime_dependency_records assembler "$assembler_path"
+} | LC_ALL=C sort)"
+
+signature_record="$({
+ printf 'format=wsjtx-linux-ccache-compiler-signature-v2\n'
+ printf 'c_driver_sha256=%s\n' "$(hash_file "$c_path")"
+ printf 'cxx_driver_sha256=%s\n' "$(hash_file "$cxx_path")"
+ printf 'cc1_sha256=%s\n' "$(hash_file "$cc1_path")"
+ printf 'cc1plus_sha256=%s\n' "$(hash_file "$cc1plus_path")"
+ printf 'lto1_sha256=%s\n' "$(hash_file "$lto1_path")"
+ printf 'assembler_sha256=%s\n' "$(hash_file "$assembler_path")"
+ printf 'target=%s\n' "$compiler_target"
+ printf 'dumpspecs_sha256=%s\n' "$dumpspecs_sha256"
+ while IFS= read -r dependency_record; do
+ if [ -n "$dependency_record" ]; then
+ printf 'runtime_dependency=%s\n' "$dependency_record"
+ fi
+ done <<< "$runtime_dependencies"
+})"
+compiler_signature_sha256="$(printf '%s\n' "$signature_record" | sha256sum | awk '{print $1}')"
+compiler_major=${compiler_version%%.*}
+
+printf '%s\t%s\t%s\t%s\t%s\n' \
+ "$compiler_version" \
+ "$compiler_target" \
+ "$(hash_file "$c_path")" \
+ "gcc${compiler_major}-v2" \
+ "$compiler_signature_sha256"
diff --git a/.github/scripts/linux-ci-image-config.sh b/.github/scripts/linux-ci-image-config.sh
new file mode 100755
index 00000000..d9742d96
--- /dev/null
+++ b/.github/scripts/linux-ci-image-config.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+# Shared dependency tuple embedded in the normal and ARM Linux CI images.
+# shellcheck disable=SC2034
+
+LINUX_CI_IMAGE_SCHEMA=1
+
+LINUX_PFUNIT_VERSION=4.14.0
+LINUX_PFUNIT_REF=v${LINUX_PFUNIT_VERSION}
+LINUX_PFUNIT_COMMIT=29ddfad16e10958bbe4a685d1fde17678296c19a
+
+LINUX_HAMLIB_REF=4.7.2
+LINUX_HAMLIB_COMMIT=40f63488fe0bd751b147f48d62fd217bf53713a0
+
+LINUX_CI_PREFIX=/opt/wsjtx
+LINUX_PFUNIT_PREFIX=${LINUX_CI_PREFIX}/pfunit
+LINUX_HAMLIB_PREFIX=${LINUX_CI_PREFIX}/hamlib
diff --git a/.github/scripts/linux-ci-image-fingerprint.sh b/.github/scripts/linux-ci-image-fingerprint.sh
new file mode 100755
index 00000000..02920299
--- /dev/null
+++ b/.github/scripts/linux-ci-image-fingerprint.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: linux-ci-image-fingerprint.sh normal-noble|normal-bookworm|tsan-noble|armhf-cross-bookworm|armhf-runtime-bookworm" >&2
+ exit 2
+fi
+
+profile=$1
+. .github/scripts/linux-ci-image-inputs.sh
+files=()
+inputs="$(linux_ci_image_inputs "$profile")"
+while IFS= read -r file; do
+ files+=("$file")
+done <<< "$inputs"
+
+sha256sum "${files[@]}" | sha256sum | awk '{print $1}'
diff --git a/.github/scripts/linux-ci-image-inputs.sh b/.github/scripts/linux-ci-image-inputs.sh
new file mode 100644
index 00000000..bc3e43af
--- /dev/null
+++ b/.github/scripts/linux-ci-image-inputs.sh
@@ -0,0 +1,75 @@
+#!/usr/bin/env bash
+
+# Prints the files whose contents define a Linux CI image profile.
+linux_ci_image_inputs() {
+ local profile=$1
+ local common=(
+ .github/images/linux-ci/install-packages.sh
+ .github/images/linux-ci/write-manifest.sh
+ .github/scripts/linux-ci-image-fingerprint.sh
+ .github/scripts/linux-ci-image-inputs.sh
+ .github/scripts/linux-ci-image-config.sh
+ .github/scripts/linux-ccache-compiler-signature.sh
+ .github/scripts/run-apt-get.sh
+ .github/scripts/verify-linux-ci-image.sh
+ )
+
+ case "$profile" in
+ normal-noble)
+ printf '%s\n' \
+ "${common[@]}" \
+ .github/images/linux-ci/Dockerfile.noble \
+ .github/scripts/build-pfunit-linux.sh \
+ .github/scripts/build-hamlib-linux.sh
+ ;;
+ normal-bookworm)
+ printf '%s\n' \
+ "${common[@]}" \
+ .github/images/linux-ci/Dockerfile.bookworm \
+ .github/scripts/build-pfunit-linux.sh \
+ .github/scripts/build-hamlib-linux.sh
+ ;;
+ armhf-cross-bookworm)
+ printf '%s\n' \
+ .github/images/linux-ci/Dockerfile.armhf-cross \
+ .github/images/linux-ci/armhf-cross-toolchain.config \
+ .github/scripts/armhf-ci-image-config.sh \
+ .github/scripts/build-armhf-toolchain-smoke.sh \
+ .github/scripts/build-hamlib-armhf-cross.sh \
+ .github/scripts/linux-ccache-compiler-signature.sh \
+ .github/scripts/linux-ci-image-config.sh \
+ .github/scripts/linux-ci-image-fingerprint.sh \
+ .github/scripts/linux-ci-image-inputs.sh \
+ .github/scripts/normalize-armhf-sysroot-symlinks.sh \
+ .github/scripts/run-apt-get.sh \
+ .github/scripts/verify-armhf-ci-image.sh \
+ .github/scripts/write-armhf-ci-manifest.sh
+ ;;
+ armhf-runtime-bookworm)
+ printf '%s\n' \
+ .github/images/linux-ci/Dockerfile.armhf-runtime \
+ .github/images/linux-ci/install-armhf-runtime-packages.sh \
+ .github/scripts/armhf-ci-image-config.sh \
+ .github/scripts/linux-ci-image-config.sh \
+ .github/scripts/linux-ci-image-fingerprint.sh \
+ .github/scripts/linux-ci-image-inputs.sh \
+ .github/scripts/run-apt-get.sh \
+ .github/scripts/verify-armhf-ci-image.sh \
+ .github/scripts/write-armhf-ci-manifest.sh
+ ;;
+ tsan-noble)
+ printf '%s\n' \
+ "${common[@]}" \
+ .github/images/linux-ci/Dockerfile.noble \
+ .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-tsan-deps-linux.sh
+ ;;
+ *)
+ echo "Unsupported Linux CI image profile: $profile" >&2
+ return 2
+ ;;
+ esac
+}
diff --git a/.github/scripts/list-release-assets.sh b/.github/scripts/list-release-assets.sh
new file mode 100755
index 00000000..28c62c95
--- /dev/null
+++ b/.github/scripts/list-release-assets.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 2 ]; then
+ echo "Usage: $0 ARTIFACTS_DIRECTORY VERSION" >&2
+ exit 2
+fi
+
+artifacts_directory="$1"
+version="$2"
+
+find "$artifacts_directory" -maxdepth 2 -type f \
+ \( -path "$artifacts_directory/wsjtx-${version}-arm64-macOS.pkg/*.pkg" \
+ -o -path "$artifacts_directory/wsjtx-${version}-x86_64-macOS.pkg/*.pkg" \
+ -o -path "$artifacts_directory/wsjtx-${version}-linux-*-AppImage/*.AppImage" \
+ -o -path "$artifacts_directory/wsjtx-${version}-linux-*-deb/*.deb" \
+ -o -path "$artifacts_directory/wsjtx-${version}-linux-*-rpm/*.rpm" \
+ -o -path "$artifacts_directory/wsjtx-${version}-windows-x86_64-installer/*.exe" \
+ -o -path "$artifacts_directory/wsjtx-${version}-src.tar.gz" \
+ \) -print | sort
diff --git a/.github/scripts/normalize-armhf-sysroot-symlinks.sh b/.github/scripts/normalize-armhf-sysroot-symlinks.sh
new file mode 100755
index 00000000..09a0403b
--- /dev/null
+++ b/.github/scripts/normalize-armhf-sysroot-symlinks.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: normalize-armhf-sysroot-symlinks.sh SYSROOT" >&2
+ exit 2
+fi
+
+sysroot=${1%/}
+if [ ! -d "$sysroot" ]; then
+ echo "ARMHF sysroot does not exist: $sysroot" >&2
+ exit 1
+fi
+
+# Debian packages may contain absolute library links. Make them relative so an
+# x86 linker cannot follow them into the builder host instead of the sysroot.
+count=0
+while IFS= read -r -d '' link; do
+ target="$(readlink -- "$link")"
+ case "$target" in
+ /*)
+ relative="$(realpath --canonicalize-missing \
+ --relative-to="$(dirname -- "$link")" "$sysroot$target")"
+ ln -sfn -- "$relative" "$link"
+ count=$((count + 1))
+ ;;
+ esac
+done < <(find "$sysroot" -type l -print0)
+
+echo "Normalized $count absolute ARMHF sysroot symlinks"
diff --git a/.github/scripts/package-linux-armhf.sh b/.github/scripts/package-linux-armhf.sh
new file mode 100755
index 00000000..abef3284
--- /dev/null
+++ b/.github/scripts/package-linux-armhf.sh
@@ -0,0 +1,137 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+VERSION="${VERSION:?missing}"
+ARCH="${ARCH:?missing}"
+if [ "$ARCH" != armhf ]; then
+ echo "package-linux-armhf.sh supports only arch=armhf" >&2
+ exit 2
+fi
+
+github_api_token="${GITHUB_TOKEN:-}"
+unset GITHUB_TOKEN
+cd /work
+# shellcheck source=.github/scripts/armhf-ci-image-config.sh
+source .github/scripts/armhf-ci-image-config.sh
+# shellcheck source=.github/scripts/linux-artifact-validation.sh
+source .github/scripts/linux-artifact-validation.sh
+export LD_LIBRARY_PATH="$ARMHF_RUNTIME_PREFIX"
+export ARMHF_QEMU_EXECUTABLE
+export LINUX_APPIMAGE_RUNNER="$ARMHF_QEMU_EXECUTABLE"
+
+echo "::group::Package .deb"
+(
+ cd wsjtx-build
+ cpack -G DEB \
+ -D "CPACK_DEBIAN_FILE_NAME=wsjtx-${VERSION}-linux-${ARCH}.deb" \
+ -D "CPACK_INSTALL_CMAKE_PROJECTS=" \
+ -D "CPACK_INSTALLED_DIRECTORIES=/work/AppDir;/"
+)
+DEB="wsjtx-build/wsjtx-${VERSION}-linux-${ARCH}.deb"
+if [ ! -f "$DEB" ]; then
+ echo "::error::cpack -G DEB produced no package at $DEB"
+ exit 1
+fi
+dpkg-deb --info "$DEB" | sed -n '1,20p'
+deb_arch="$(dpkg-deb -f "$DEB" Architecture)"
+if [ "$deb_arch" != armhf ]; then
+ echo "::error::DEB architecture is $deb_arch, expected armhf"
+ exit 1
+fi
+validate_deb_package "$DEB"
+echo "::endgroup::"
+
+echo "::group::Package RPM"
+(
+ cd wsjtx-build
+ cpack -G RPM \
+ -D "CPACK_INSTALL_CMAKE_PROJECTS=" \
+ -D "CPACK_INSTALLED_DIRECTORIES=/work/AppDir;/"
+)
+rpms=(wsjtx-build/*.rpm)
+if [ ! -f "${rpms[0]}" ]; then
+ echo "::error::cpack -G RPM produced no package"
+ exit 1
+fi
+RPM=${rpms[0]}
+rpm_arch="$(rpm -qp --qf '%{ARCH}' "$RPM")"
+case "$rpm_arch" in
+ armv7hl|armv7l) ;;
+ *) echo "::error::RPM architecture is $rpm_arch, expected armv7"; exit 1 ;;
+esac
+rpm -qpi "$RPM"
+rpm -qpR "$RPM"
+validate_rpm_package "$RPM"
+echo "::endgroup::"
+
+echo "::group::Validate AppDir"
+validate_linux_application_tree AppDir appdir "$ARCH"
+echo "::endgroup::"
+
+echo "::group::Package AppImage"
+LINUXDEPLOY_TAG=1-alpha-20251107-1
+LINUXDEPLOY_SHA256=e359161979fa4bee50b92ce7102fb510299caebf34f711d983fba7a8f4bb1c2e
+QT_PLUGIN_ASSET_NAME=linuxdeploy-plugin-qt-armhf.AppImage
+curl_flags=(--fail --show-error --silent --location --retry 5 --retry-delay 5)
+github_api_curl() {
+ local api_headers=(-H "User-Agent: wsjtx-ci")
+ if [ -n "$github_api_token" ]; then
+ api_headers+=(-H "Authorization: Bearer ${github_api_token}")
+ env GITHUB_TOKEN="$github_api_token" curl "${curl_flags[@]}" "${api_headers[@]}" "$@"
+ else
+ curl "${curl_flags[@]}" "${api_headers[@]}" "$@"
+ fi
+}
+QT_PLUGIN_ASSET_ID="$(
+ github_api_curl -H "Accept: application/vnd.github+json" \
+ "https://api.github.com/repos/linuxdeploy/linuxdeploy-plugin-qt/releases/tags/continuous" |
+ python3 -c 'import json, sys; name = sys.argv[1]; matches = [asset for asset in json.load(sys.stdin)["assets"] if asset["name"] == name]; print(matches[0]["id"]) if matches else sys.exit("asset not found: " + name)' "$QT_PLUGIN_ASSET_NAME"
+)"
+curl "${curl_flags[@]}" -o linuxdeploy.AppImage \
+ "https://github.com/linuxdeploy/linuxdeploy/releases/download/${LINUXDEPLOY_TAG}/linuxdeploy-armhf.AppImage"
+mkdir -p wsjtx-build/appimage-tools
+github_api_curl -H "Accept: application/octet-stream" \
+ -o wsjtx-build/appimage-tools/qt-plugin.AppImage \
+ "https://api.github.com/repos/linuxdeploy/linuxdeploy-plugin-qt/releases/assets/${QT_PLUGIN_ASSET_ID}"
+echo "$LINUXDEPLOY_SHA256 linuxdeploy.AppImage" | sha256sum -c -
+chmod +x linuxdeploy.AppImage wsjtx-build/appimage-tools/qt-plugin.AppImage
+# shellcheck disable=SC2016 # variables expand when the generated wrapper runs
+printf '%s\n' \
+ '#!/bin/sh' \
+ 'exec "${ARMHF_QEMU_EXECUTABLE:?}" /work/wsjtx-build/appimage-tools/qt-plugin.AppImage "$@"' \
+ > linuxdeploy-plugin-qt.AppImage
+chmod +x linuxdeploy-plugin-qt.AppImage
+# Supply linuxdeploy with the non-executing ARMHF resolver; native ldd cannot
+# safely enter the target loader from this already-emulated container.
+ln -sfn /work/.github/scripts/armhf-static-ldd.sh wsjtx-build/appimage-tools/ldd
+
+for target in AppDir/usr/bin/wsjtx AppDir/usr/bin/jt9 AppDir/usr/bin/qmap \
+ AppDir/usr/bin/map65; do
+ wsjtx-build/appimage-tools/ldd "$target"
+done
+
+export APPIMAGE_EXTRACT_AND_RUN=1
+export OUTPUT="wsjtx-${VERSION}-linux-${ARCH}.AppImage"
+env -u GITHUB_TOKEN PATH="/work/wsjtx-build/appimage-tools:$PATH" \
+ "$ARMHF_QEMU_EXECUTABLE" \
+ ./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
+file "$OUTPUT"
+echo "::endgroup::"
+
+echo "::group::Validate AppImage payload"
+"$ARMHF_QEMU_EXECUTABLE" ./"$OUTPUT" --appimage-extract >/dev/null
+validate_linux_application_tree squashfs-root appimage "$ARCH"
+rm -rf /work/squashfs-root
+echo "::endgroup::"
+
+echo "::group::AppImage startup smoke"
+run_packaged_appimage_startup_smoke \
+ "./$OUTPUT" wsjtx-build/appimage-startup-smoke.log
+echo "::endgroup::"
+
+echo "ARMHF package phase complete for version=$VERSION"
diff --git a/.github/scripts/release-policy.py b/.github/scripts/release-policy.py
new file mode 100644
index 00000000..ec7abe09
--- /dev/null
+++ b/.github/scripts/release-policy.py
@@ -0,0 +1,406 @@
+#!/usr/bin/env python3
+"""Validate release identity and installer artifact policy."""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+import json
+import re
+import sys
+import tarfile
+import zipfile
+from pathlib import Path
+
+
+VERSION_RE = re.compile(r"^(?P<numeric>\d+\.\d+\.\d+)(?:-rc(?P<rc>[1-9]\d*))?$")
+MACOS_MODES = ("validation", "distribution")
+WINDOWS_MODES = ("signpath", "unsigned")
+
+
+def classify(version: str) -> dict[str, str]:
+ match = VERSION_RE.fullmatch(version)
+ if not match:
+ raise ValueError("version must be X.Y.Z or X.Y.Z-rcN")
+ rc = match.group("rc") or ""
+ numeric = match.group("numeric")
+ major, minor, _ = numeric.split(".")
+ return {
+ "version": version,
+ "numeric": numeric,
+ "channel": "RC" if rc else "GA",
+ "rc_number": rc,
+ "release_branch": f"release/{major}.{minor}",
+ }
+
+
+def parse_state(contents: str, *, expected_revision: str | None = None) -> dict[str, str]:
+ state = {}
+ for line in contents.splitlines():
+ key, separator, value = line.partition("=")
+ if not separator or key in state:
+ raise ValueError("release-state.txt must contain unique key=value lines")
+ state[key] = value
+ required_keys = {"version", "channel", "rc", "revision"}
+ if not required_keys <= set(state) or set(state) - required_keys - {"windows_signing"}:
+ raise ValueError("release-state.txt must define version, channel, rc, revision, and optionally windows_signing")
+ state.setdefault("windows_signing", "signpath")
+ if state["windows_signing"] not in WINDOWS_MODES:
+ raise ValueError("release-state.txt windows_signing must be signpath or unsigned")
+ if state["channel"] not in {"DEVEL", "RC", "GA"}:
+ raise ValueError("release-state.txt channel must be DEVEL, RC, or GA")
+ if not re.fullmatch(r"\d+\.\d+\.\d+", state["version"]):
+ raise ValueError("release-state.txt version must be X.Y.Z")
+ if state["channel"] == "RC":
+ if not re.fullmatch(r"[1-9]\d*", state["rc"]):
+ raise ValueError("RC release state requires a positive RC number")
+ elif state["rc"]:
+ raise ValueError("DEVEL and GA release states require an empty RC number")
+ required_revision = expected_revision or "$Format:%H$"
+ if state["revision"].lower() != required_revision.lower():
+ raise ValueError(f"release-state.txt revision must be {required_revision}")
+ return state
+
+
+def read_state(root: Path, *, expected_revision: str | None = None) -> dict[str, str]:
+ return parse_state(
+ (root / "release-state.txt").read_text(encoding="utf-8"),
+ expected_revision=expected_revision,
+ )
+
+
+def validate_source(root: Path, version: str) -> dict[str, str]:
+ identity = classify(version)
+ state = read_state(root)
+ errors = []
+ if state["version"] != identity["numeric"]:
+ errors.append(f"release-state version {state['version']} does not match {identity['numeric']}")
+ if state["channel"] != identity["channel"]:
+ errors.append(f"release channel {state['channel']} does not match {identity['channel']}")
+ if state["rc"] != identity["rc_number"]:
+ errors.append(f"RC number {state['rc'] or '<empty>'} does not match {identity['rc_number'] or '<empty>'}")
+ if errors:
+ raise ValueError("; ".join(errors))
+ identity["windows_signing"] = state["windows_signing"]
+ return identity
+
+
+def validate_archive(path: Path, version: str, commit: str) -> None:
+ if not re.fullmatch(r"[0-9a-f]{40}|[0-9a-f]{64}", commit):
+ raise ValueError("archive commit must be a full lowercase Git object ID")
+ names: list[str]
+ release_state_contents: str
+ if zipfile.is_zipfile(path):
+ with zipfile.ZipFile(path) as archive:
+ names = archive.namelist()
+ matches = [name for name in names if name.count("/") == 1 and name.endswith("/release-state.txt")]
+ if len(matches) != 1:
+ raise ValueError("source archive must contain one top-level release-state.txt")
+ release_state_contents = archive.read(matches[0]).decode("utf-8")
+ else:
+ with tarfile.open(path, "r:*") as archive:
+ names = archive.getnames()
+ matches = [name for name in names if name.count("/") == 1 and name.endswith("/release-state.txt")]
+ if len(matches) != 1:
+ raise ValueError("source archive must contain one top-level release-state.txt")
+ member = archive.extractfile(matches[0])
+ if member is None:
+ raise ValueError("source archive release-state.txt is not a regular file")
+ release_state_contents = member.read().decode("utf-8")
+ if any(part == ".git" for name in names for part in Path(name).parts):
+ raise ValueError("source archive must not contain .git metadata")
+ identity = classify(version)
+ state = parse_state(release_state_contents, expected_revision=commit)
+ if state["version"] != identity["numeric"] or state["channel"] != identity["channel"] or state["rc"] != identity["rc_number"]:
+ raise ValueError("source archive release identity does not match its tag")
+
+
+def expected_assets(version: str, distribution: bool) -> list[str]:
+ mac_suffix = "macOS.pkg" if distribution else "macOS-unsigned.pkg"
+ return [
+ f"wsjtx-{version}-arm64-{mac_suffix}",
+ f"wsjtx-{version}-x86_64-{mac_suffix}",
+ f"wsjtx-{version}-linux-x86_64-AppImage",
+ f"wsjtx-{version}-linux-aarch64-AppImage",
+ f"wsjtx-{version}-linux-armhf-AppImage",
+ f"wsjtx-{version}-windows-x86_64-installer-signed" if distribution else f"wsjtx-{version}-windows-x86_64-installer",
+ ]
+
+
+def public_expected_assets(version: str, macos_mode: str, windows_mode: str = "signpath") -> list[str]:
+ if macos_mode not in MACOS_MODES:
+ raise ValueError(f"unsupported macOS release mode: {macos_mode}")
+ if windows_mode not in WINDOWS_MODES:
+ raise ValueError(f"unsupported Windows release mode: {windows_mode}")
+ mac_suffix = "macOS.pkg" if macos_mode == "distribution" else "macOS-unsigned.pkg"
+ return [
+ f"wsjtx-{version}-arm64-{mac_suffix}",
+ f"wsjtx-{version}-x86_64-{mac_suffix}",
+ f"wsjtx-{version}-linux-x86_64-AppImage",
+ f"wsjtx-{version}-linux-aarch64-AppImage",
+ f"wsjtx-{version}-linux-armhf-AppImage",
+ f"wsjtx-{version}-windows-x86_64-installer{'-signed' if windows_mode == 'signpath' else ''}",
+ ]
+
+
+def collect_asset_files(root: Path, expected: list[str]) -> list[Path]:
+ files: list[Path] = []
+ for artifact in expected:
+ directory = root / artifact
+ if not directory.is_dir():
+ raise ValueError(f"missing artifact directory: {artifact}")
+ suffix = ".pkg" if "macOS" in artifact else ".AppImage" if "linux" in artifact else ".exe"
+ matches = sorted(path for path in directory.rglob(f"*{suffix}") if path.is_file())
+ if len(matches) != 1:
+ raise ValueError(f"{artifact} must contain exactly one {suffix} file; found {len(matches)}")
+ if matches[0].stat().st_size == 0:
+ raise ValueError(f"artifact is empty: {matches[0]}")
+ files.append(matches[0])
+ return files
+
+
+def find_asset_files(root: Path, version: str, distribution: bool) -> list[Path]:
+ files = collect_asset_files(root, expected_assets(version, distribution))
+ if distribution:
+ unsigned = sorted(root.rglob("*-unsigned.pkg"))
+ if unsigned:
+ raise ValueError(f"unsigned macOS packages cannot be published: {unsigned[0]}")
+ return files
+
+
+def find_public_asset_files(
+ root: Path, version: str, macos_mode: str, windows_mode: str = "signpath"
+) -> list[Path]:
+ files = collect_asset_files(root, public_expected_assets(version, macos_mode, windows_mode))
+ if macos_mode == "distribution":
+ unsigned = sorted(root.rglob("*-unsigned.pkg"))
+ if unsigned:
+ raise ValueError(f"unsigned macOS packages cannot be published: {unsigned[0]}")
+ if windows_mode == "unsigned":
+ installer = files[-1]
+ if installer.name != f"wsjtx-{version}-win64.exe":
+ raise ValueError(f"unexpected unsigned Windows installer: {installer.name}")
+ if (root / f"wsjtx-{version}-windows-x86_64-installer-signed").exists():
+ raise ValueError("signed Windows installer cannot accompany unsigned release")
+ return files
+
+
+def release_files(
+ root: Path, version: str, macos_mode: str = "distribution", windows_mode: str = "signpath"
+) -> list[Path]:
+ files = find_public_asset_files(root, version, macos_mode, windows_mode)
+ for arch in ("x86_64", "aarch64", "armhf"):
+ for package_type, suffix in (("deb", ".deb"), ("rpm", ".rpm")):
+ directory = root / f"wsjtx-{version}-linux-{arch}-{package_type}"
+ if not directory.is_dir():
+ raise ValueError(f"missing artifact directory: {directory.name}")
+ matches = sorted(path for path in directory.rglob(f"*{suffix}") if path.is_file())
+ if len(matches) != 1 or matches[0].stat().st_size == 0:
+ raise ValueError(f"{directory.name} must contain exactly one non-empty {suffix} file")
+ files.append(matches[0])
+ source = root / f"wsjtx-{version}-src.tar.gz"
+ if not source.is_file() or source.stat().st_size == 0:
+ raise ValueError(f"missing source archive: {source.name}")
+ files.append(source)
+ names = [path.name for path in files]
+ if len(names) != len(set(names)):
+ raise ValueError("release assets must have unique filenames")
+ return sorted(files, key=lambda item: item.name)
+
+
+def hash_file(path: Path) -> str:
+ digest = hashlib.sha256()
+ with path.open("rb") as stream:
+ for chunk in iter(lambda: stream.read(1024 * 1024), b""):
+ digest.update(chunk)
+ return digest.hexdigest()
+
+
+def read_single_json(directory: Path) -> dict:
+ matches = sorted(directory.glob("*.json"))
+ if len(matches) != 1:
+ raise ValueError(f"{directory.name} must contain exactly one JSON report")
+ return json.loads(matches[0].read_text(encoding="utf-8"))
+
+
+def verify_signing_reports(
+ root: Path, version: str, commit: str, tag: str, macos_mode: str = "distribution",
+ windows_mode: str = "signpath",
+) -> None:
+ if macos_mode not in MACOS_MODES:
+ raise ValueError(f"unsupported macOS release mode: {macos_mode}")
+ if windows_mode not in WINDOWS_MODES:
+ raise ValueError(f"unsupported Windows release mode: {windows_mode}")
+ for arch in ("arm64", "x86_64"):
+ report = read_single_json(root / f"macos-signing-report-{version}-{arch}")
+ if report.get("mode") != macos_mode or report.get("git_sha") != commit:
+ raise ValueError(f"macOS {arch} report does not bind {macos_mode} packaging to {commit}")
+ if macos_mode == "distribution":
+ if report.get("notarization", {}).get("status") != "Accepted":
+ raise ValueError(f"macOS {arch} notarization was not accepted")
+ if report.get("stapled") is not True or report.get("gatekeeper_accepted") is not True:
+ raise ValueError(f"macOS {arch} trust verification is incomplete")
+ if not re.fullmatch(r"[A-Z0-9]{10}", report.get("team_id", "")):
+ raise ValueError(f"macOS {arch} report has no verified Apple Team ID")
+ for field in ("application_certificate_sha1", "installer_certificate_sha1"):
+ if not re.fullmatch(r"[0-9A-F]{40}", report.get(field, "")):
+ raise ValueError(f"macOS {arch} report has no verified {field}")
+ artifact_dir = f"wsjtx-{version}-{arch}-macOS.pkg"
+ else:
+ if any(report.get(field) is not False for field in ("signed", "notarized", "publishable")):
+ raise ValueError(f"macOS {arch} validation report does not describe an unsigned package")
+ artifact_dir = f"wsjtx-{version}-{arch}-macOS-unsigned.pkg"
+ package = root / artifact_dir / report.get("artifact", "")
+ if not package.is_file() or report.get("sha256") != hash_file(package):
+ raise ValueError(f"macOS {arch} report hash does not match its package")
+
+ if windows_mode == "unsigned":
+ for suffix in ("windows-signing-request", "windows-signing-verification"):
+ if (root / f"wsjtx-{version}-{suffix}").exists():
+ raise ValueError(f"Windows signing report cannot accompany unsigned release: {suffix}")
+ return
+
+ request = read_single_json(root / f"wsjtx-{version}-windows-signing-request")
+ verification = read_single_json(root / f"wsjtx-{version}-windows-signing-verification")
+ if request.get("policy") != "release-signing" or request.get("commit") != commit:
+ raise ValueError("Windows signing request does not match the release commit and policy")
+ if request.get("tag") != tag:
+ raise ValueError("Windows signing request does not match the release tag")
+ if verification.get("commit") != commit or verification.get("tag") != tag:
+ raise ValueError("Windows verification report does not match the release ref")
+ if verification.get("status") != "Valid" or not verification.get("timestamp_thumbprint"):
+ raise ValueError("Windows signature or timestamp is not trusted")
+ if verification.get("identity_verified") is not True:
+ raise ValueError("Windows signer identity was not verified against the release allowlist")
+ if not verification.get("signer_subject") or not verification.get("signer_thumbprint"):
+ raise ValueError("Windows signer identity is missing from the verification report")
+ installer = root / f"wsjtx-{version}-windows-x86_64-installer-signed" / verification.get("artifact", "")
+ if not installer.is_file() or verification.get("sha256") != hash_file(installer):
+ raise ValueError("Windows verification report hash does not match its installer")
+
+
+def write_manifest(args: argparse.Namespace) -> None:
+ root = Path(args.artifacts)
+ digests = {
+ "x86_64": args.linux_x86_64_digest,
+ "aarch64": args.linux_aarch64_digest,
+ "armhf_cross": args.linux_armhf_cross_digest,
+ "armhf_runtime": args.linux_armhf_digest,
+ }
+ for arch, digest in digests.items():
+ if not re.fullmatch(r"sha256:[0-9a-f]{64}", digest):
+ raise ValueError(f"Linux {arch} builder digest is not an immutable sha256 digest")
+ files = release_files(root, args.version, args.macos_mode, args.windows_mode)
+ replaceable_macos = (
+ {f"wsjtx-{args.version}-{arch}-macOS.pkg" for arch in ("arm64", "x86_64")}
+ if args.macos_mode == "validation"
+ else set()
+ )
+ entries = [
+ {"name": path.name, "sha256": hash_file(path), "size": path.stat().st_size}
+ for path in sorted(files, key=lambda item: item.name)
+ if path.name not in replaceable_macos
+ ]
+ manifest = {
+ "schema": 1,
+ "repository": args.repository,
+ "tag": f"v{args.version}",
+ "commit": args.commit,
+ "workflow_run": args.run_id,
+ "linux_builders": digests,
+ "macos_signing": {
+ "mode": "manual" if args.macos_mode == "validation" else "distribution",
+ "replaceable_assets": sorted(replaceable_macos),
+ },
+ "windows_signing": {"mode": args.windows_mode},
+ "assets": entries,
+ }
+ output = root / "release-manifest.json"
+ output.write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
+ checksums = root / "SHA256SUMS"
+ checksums.write_text(
+ "".join(f"{entry['sha256']} {entry['name']}\n" for entry in entries),
+ encoding="utf-8",
+ )
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser()
+ subparsers = parser.add_subparsers(dest="command", required=True)
+ classify_parser = subparsers.add_parser("classify")
+ classify_parser.add_argument("version")
+ state_parser = subparsers.add_parser("read-state")
+ state_parser.add_argument("--root", default=".")
+ validate_parser = subparsers.add_parser("validate-source")
+ validate_parser.add_argument("version")
+ validate_parser.add_argument("--root", default=".")
+ archive_parser = subparsers.add_parser("validate-archive")
+ archive_parser.add_argument("version")
+ archive_parser.add_argument("archive")
+ archive_parser.add_argument("--commit", required=True)
+ assets_parser = subparsers.add_parser("verify-assets")
+ assets_parser.add_argument("version")
+ assets_parser.add_argument("artifacts")
+ assets_parser.add_argument("--distribution", action="store_true")
+ assets_parser.add_argument("--macos-mode", choices=MACOS_MODES)
+ assets_parser.add_argument("--windows-mode", choices=WINDOWS_MODES, default="signpath")
+ files_parser = subparsers.add_parser("release-files")
+ files_parser.add_argument("version")
+ files_parser.add_argument("artifacts")
+ files_parser.add_argument("--macos-mode", choices=MACOS_MODES, default="distribution")
+ files_parser.add_argument("--windows-mode", choices=WINDOWS_MODES, default="signpath")
+ reports_parser = subparsers.add_parser("verify-signing-reports")
+ reports_parser.add_argument("version")
+ reports_parser.add_argument("artifacts")
+ reports_parser.add_argument("--commit", required=True)
+ reports_parser.add_argument("--tag", required=True)
+ reports_parser.add_argument("--macos-mode", choices=MACOS_MODES, default="distribution")
+ reports_parser.add_argument("--windows-mode", choices=WINDOWS_MODES, default="signpath")
+ manifest_parser = subparsers.add_parser("write-manifest")
+ manifest_parser.add_argument("version")
+ manifest_parser.add_argument("artifacts")
+ manifest_parser.add_argument("--repository", required=True)
+ manifest_parser.add_argument("--commit", required=True)
+ manifest_parser.add_argument("--run-id", required=True)
+ manifest_parser.add_argument("--linux-x86-64-digest", required=True)
+ manifest_parser.add_argument("--linux-aarch64-digest", required=True)
+ manifest_parser.add_argument("--linux-armhf-cross-digest", required=True)
+ manifest_parser.add_argument("--linux-armhf-digest", required=True)
+ manifest_parser.add_argument("--macos-mode", choices=MACOS_MODES, default="distribution")
+ manifest_parser.add_argument("--windows-mode", choices=WINDOWS_MODES, default="signpath")
+ args = parser.parse_args()
+ try:
+ if args.command == "classify":
+ print(json.dumps(classify(args.version)))
+ elif args.command == "read-state":
+ print(json.dumps(read_state(Path(args.root))))
+ elif args.command == "validate-source":
+ print(json.dumps(validate_source(Path(args.root), args.version)))
+ elif args.command == "validate-archive":
+ validate_archive(Path(args.archive), args.version, args.commit)
+ elif args.command == "verify-assets":
+ files = (
+ find_public_asset_files(Path(args.artifacts), args.version, args.macos_mode, args.windows_mode)
+ if args.macos_mode
+ else find_asset_files(Path(args.artifacts), args.version, args.distribution)
+ )
+ for path in files:
+ print(path)
+ elif args.command == "release-files":
+ for path in release_files(Path(args.artifacts), args.version, args.macos_mode, args.windows_mode):
+ print(path)
+ elif args.command == "verify-signing-reports":
+ verify_signing_reports(
+ Path(args.artifacts), args.version, args.commit, args.tag, args.macos_mode,
+ args.windows_mode,
+ )
+ else:
+ write_manifest(args)
+ except (OSError, ValueError, tarfile.TarError, zipfile.BadZipFile) as error:
+ print(f"release policy error: {error}", file=sys.stderr)
+ return 1
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/.github/scripts/resolve-linux-ci-image-tag.py b/.github/scripts/resolve-linux-ci-image-tag.py
new file mode 100755
index 00000000..8f67bc0e
--- /dev/null
+++ b/.github/scripts/resolve-linux-ci-image-tag.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python3
+"""Resolve the coherent immutable generation selected by linux-noble:stable."""
+
+from __future__ import annotations
+
+import os
+import re
+import sys
+from pathlib import Path
+
+
+sys.path.insert(0, str(Path(__file__).parent))
+from ghcr_retention import GitHubPackagesClient, Version # noqa: E402, F401
+
+
+OWNER = "WSJTX"
+NORMAL_PACKAGE = "wsjtx-internal/linux-noble"
+TSAN_PACKAGE = "wsjtx-internal/linux-tsan-noble"
+ARM64_PACKAGE = "wsjtx-internal/linux-arm64-bookworm"
+ARMHF_PACKAGE = "wsjtx-internal/linux-armv7-bookworm"
+ARMHF_CROSS_PACKAGE = "wsjtx-internal/linux-armhf-cross-bookworm"
+ROUTINE_PACKAGES = (ARM64_PACKAGE,)
+BUILD_TAG = re.compile(r"^build-\d{8}-\d+-\d+$")
+
+
+def resolve(client: GitHubPackagesClient, *, require_armhf: bool = False) -> str:
+ versions = client.list_versions(OWNER, NORMAL_PACKAGE)
+ stable = [version for version in versions if "stable" in version.tags]
+ if not stable:
+ raise RuntimeError(
+ "No promoted Linux CI image generation is available: "
+ "linux-noble:stable is missing. Bootstrap the GHCR images with "
+ "warm-dependency-caches.yml before running Linux CI."
+ )
+ if len(stable) != 1:
+ raise RuntimeError(f"expected one linux-noble:stable version, found {len(stable)}")
+ build_tags = [tag for tag in stable[0].tags if BUILD_TAG.fullmatch(tag)]
+ if len(build_tags) != 1:
+ raise RuntimeError(
+ "linux-noble:stable must share a version with exactly one immutable build tag"
+ )
+ generation = build_tags[0]
+ required_packages = ROUTINE_PACKAGES + ((ARMHF_PACKAGE,) if require_armhf else ())
+ for package in required_packages:
+ if not any(generation in version.tags for version in client.list_versions(OWNER, package)):
+ raise RuntimeError(f"{package}:{generation} does not exist")
+ return generation
+
+
+def resolve_armhf(client: GitHubPackagesClient) -> str:
+ versions = client.list_versions(OWNER, ARMHF_PACKAGE)
+ stable = [version for version in versions if "stable" in version.tags]
+ if not stable:
+ raise RuntimeError(
+ "No promoted armhf Linux CI image generation is available: "
+ "linux-armv7-bookworm:stable is missing. Publish an armhf image "
+ "with include_armhf=true before running the armhf build."
+ )
+ if len(stable) != 1:
+ raise RuntimeError(
+ "expected one linux-armv7-bookworm:stable version, "
+ f"found {len(stable)}"
+ )
+ build_tags = [tag for tag in stable[0].tags if BUILD_TAG.fullmatch(tag)]
+ if len(build_tags) != 1:
+ raise RuntimeError(
+ "linux-armv7-bookworm:stable must share a version with exactly "
+ "one immutable build tag"
+ )
+ generation = build_tags[0]
+ if not any(
+ generation in version.tags
+ for version in client.list_versions(OWNER, ARMHF_CROSS_PACKAGE)
+ ):
+ raise RuntimeError(f"{ARMHF_CROSS_PACKAGE}:{generation} does not exist")
+ return generation
+
+
+def resolve_tsan(client: GitHubPackagesClient) -> str:
+ versions = client.list_versions(OWNER, TSAN_PACKAGE)
+ stable = [version for version in versions if "stable" in version.tags]
+ if not stable:
+ raise RuntimeError(
+ "No promoted TSan Linux CI image generation is available: "
+ "linux-tsan-noble:stable is missing. Publish an image with "
+ "image_set=tsan before running the TSan workflow."
+ )
+ if len(stable) != 1:
+ raise RuntimeError(
+ "expected one linux-tsan-noble:stable version, "
+ f"found {len(stable)}"
+ )
+ build_tags = [tag for tag in stable[0].tags if BUILD_TAG.fullmatch(tag)]
+ if len(build_tags) != 1:
+ raise RuntimeError(
+ "linux-tsan-noble:stable must share a version with exactly one "
+ "immutable build tag"
+ )
+ return build_tags[0]
+
+
+def main() -> int:
+ token = os.environ.get("GITHUB_TOKEN")
+ if not token:
+ print("GITHUB_TOKEN is required", file=sys.stderr)
+ return 2
+ client = GitHubPackagesClient(token)
+ if os.environ.get("RESOLVE_ARMHF") == "true":
+ generation = resolve_armhf(client)
+ elif os.environ.get("RESOLVE_TSAN") == "true":
+ generation = resolve_tsan(client)
+ else:
+ require_armhf = os.environ.get("REQUIRE_ARMHF") == "true"
+ generation = resolve(client, require_armhf=require_armhf)
+ print(f"Resolved Linux CI image generation: {generation}")
+ output = os.environ.get("GITHUB_OUTPUT")
+ if output:
+ with open(output, "a", encoding="utf-8") as stream:
+ stream.write(f"image_tag={generation}\n")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/.github/scripts/run-apt-get.sh b/.github/scripts/run-apt-get.sh
new file mode 100755
index 00000000..0e7c363e
--- /dev/null
+++ b/.github/scripts/run-apt-get.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+set -euo pipefail
+
+if [ "$#" -eq 0 ]; then
+ echo "usage: $0 <apt-get arguments...>" >&2
+ exit 2
+fi
+
+apt_options=(
+ -o Acquire::Retries=3
+ -o Acquire::http::Timeout=30
+ -o Acquire::https::Timeout=30
+ -o DPkg::Lock::Timeout=60
+)
+
+run_privileged() {
+ if [ "$(id -u)" = "0" ]; then
+ "$@"
+ else
+ sudo "$@"
+ fi
+}
+
+run_with_timeout() {
+ local timeout_limit="$1"
+ shift
+ run_privileged timeout --signal=TERM --kill-after=30s "$timeout_limit" "$@"
+}
+
+is_timeout_status() {
+ [ "$1" -eq 124 ] || [ "$1" -eq 137 ]
+}
+
+case "$1" in
+ update)
+ timeout_limit="${APT_UPDATE_TIMEOUT:-15m}"
+ status=0
+ run_with_timeout "$timeout_limit" apt-get \
+ "${apt_options[@]}" -o APT::Update::Error-Mode=any "$@" || status=$?
+ if is_timeout_status "$status"; then
+ echo "::error::apt-get update exceeded or was killed while enforcing its ${timeout_limit} wall-clock limit"
+ fi
+ exit "$status"
+ ;;
+ install)
+ download_timeout="${APT_DOWNLOAD_TIMEOUT:-${APT_INSTALL_TIMEOUT:-20m}}"
+ download_attempts="${APT_DOWNLOAD_ATTEMPTS:-2}"
+ case "$download_attempts" in
+ ''|*[!0-9]*|0)
+ echo "::error::APT_DOWNLOAD_ATTEMPTS must be a positive integer" >&2
+ exit 2
+ ;;
+ esac
+
+ for ((attempt = 1; attempt <= download_attempts; ++attempt)); do
+ echo "::group::APT package acquisition attempt ${attempt}/${download_attempts}"
+ status=0
+ run_with_timeout "$download_timeout" apt-get \
+ "${apt_options[@]}" --download-only "$@" || status=$?
+ echo "::endgroup::"
+
+ if [ "$status" -eq 0 ]; then
+ break
+ fi
+ if ! is_timeout_status "$status"; then
+ echo "::error::apt-get install failed during package acquisition with status ${status}"
+ exit "$status"
+ fi
+ if [ "$attempt" -eq "$download_attempts" ]; then
+ echo "::error::apt-get install package acquisition exceeded or was killed while enforcing its ${download_timeout} wall-clock limit"
+ exit "$status"
+ fi
+ echo "::warning::apt-get install package acquisition exceeded its ${download_timeout} wall-clock limit; retrying with cached partial downloads"
+ done
+
+ echo "::group::APT package installation from local cache"
+ status=0
+ run_privileged apt-get "${apt_options[@]}" --no-download "$@" || status=$?
+ echo "::endgroup::"
+ if [ "$status" -ne 0 ]; then
+ echo "::error::apt-get install failed during package unpacking or configuration with status ${status}"
+ run_privileged dpkg --audit || true
+ fi
+ exit "$status"
+ ;;
+ *)
+ timeout_limit="${APT_COMMAND_TIMEOUT:-20m}"
+ status=0
+ run_with_timeout "$timeout_limit" apt-get "${apt_options[@]}" "$@" || status=$?
+ if is_timeout_status "$status"; then
+ echo "::error::apt-get $1 exceeded or was killed while enforcing its ${timeout_limit} wall-clock limit"
+ fi
+ exit "$status"
+ ;;
+esac
diff --git a/.github/scripts/select-ccache-key-suffix.sh b/.github/scripts/select-ccache-key-suffix.sh
new file mode 100755
index 00000000..f4f501ef
--- /dev/null
+++ b/.github/scripts/select-ccache-key-suffix.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# GitHub cache entries cannot be replaced. Per-attempt refresh keys let a
+# forced rebuild supersede an older archive for the same SHA through prefix
+# restoration without duplicating caches for ordinary reruns.
+cache_key_suffix() {
+ local recache=$1
+ local run_id=$2
+ local run_attempt=$3
+
+ case "$recache" in
+ false)
+ return 0
+ ;;
+ true)
+ if [ -z "$run_id" ] || [ -z "$run_attempt" ]; then
+ echo "GITHUB_RUN_ID and GITHUB_RUN_ATTEMPT are required for a ccache refresh key" >&2
+ return 2
+ fi
+ printf '%s' "-refresh-${run_id}-${run_attempt}"
+ ;;
+ *)
+ echo "RECACHE must be true or false" >&2
+ return 2
+ ;;
+ esac
+}
+
+if [ "${1:-}" = --self-test ]; then
+ test -z "$(cache_key_suffix false 123 1)"
+ test -z "$(cache_key_suffix false '' '')"
+ test "$(cache_key_suffix true 123 1)" = "-refresh-123-1"
+ test "$(cache_key_suffix true 123 2)" = "-refresh-123-2"
+ if cache_key_suffix true "" 1 >/dev/null 2>&1; then
+ echo "self-test failed: empty run ID was accepted" >&2
+ exit 1
+ fi
+ if cache_key_suffix invalid 123 1 >/dev/null 2>&1; then
+ echo "self-test failed: invalid recache value was accepted" >&2
+ exit 1
+ fi
+ echo "select-ccache-key-suffix.sh self-test passed"
+ exit 0
+fi
+
+suffix="$(cache_key_suffix \
+ "${RECACHE:-false}" \
+ "${GITHUB_RUN_ID:-}" \
+ "${GITHUB_RUN_ATTEMPT:-}")"
+
+echo "ccache key suffix: ${suffix:-<none>}"
+if [ -n "${GITHUB_OUTPUT:-}" ]; then
+ echo "suffix=$suffix" >> "$GITHUB_OUTPUT"
+fi
diff --git a/.github/scripts/select-linux-ccache-save.sh b/.github/scripts/select-linux-ccache-save.sh
new file mode 100755
index 00000000..730c3a2e
--- /dev/null
+++ b/.github/scripts/select-linux-ccache-save.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# Base-branch caches are visible to pull requests. Keep publication limited to
+# automatic develop builds and explicit maintainer requests on develop.
+should_save_linux_ccache() {
+ local event_name=$1
+ local ref=$2
+ local requested_save=$3
+ local recache=$4
+
+ if [ "$ref" != "refs/heads/develop" ]; then
+ return 1
+ fi
+
+ case "$event_name" in
+ push)
+ return 0
+ ;;
+ workflow_dispatch)
+ [ "$requested_save" = true ] || [ "$recache" = true ]
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
+expect_save() {
+ if ! should_save_linux_ccache "$@"; then
+ echo "self-test failed: expected cache save for $*" >&2
+ exit 1
+ fi
+}
+
+expect_no_save() {
+ if should_save_linux_ccache "$@"; then
+ echo "self-test failed: expected no cache save for $*" >&2
+ exit 1
+ fi
+}
+
+if [ "${1:-}" = --self-test ]; then
+ expect_save push refs/heads/develop false false
+ expect_save workflow_dispatch refs/heads/develop true false
+ expect_save workflow_dispatch refs/heads/develop false true
+ expect_save workflow_dispatch refs/heads/develop true true
+
+ expect_no_save pull_request refs/pull/421/merge true true
+ expect_no_save workflow_dispatch refs/heads/topic true false
+ expect_no_save workflow_dispatch refs/heads/develop false false
+ expect_no_save schedule refs/heads/develop true true
+
+ echo "select-linux-ccache-save.sh self-test passed"
+ exit 0
+fi
+
+save_ccache=false
+if should_save_linux_ccache \
+ "${EVENT_NAME:-}" \
+ "${GITHUB_REF:-}" \
+ "${REQUEST_SAVE_CCACHE:-false}" \
+ "${RECACHE:-false}"; then
+ save_ccache=true
+fi
+
+echo "Linux ccache save: $save_ccache"
+if [ -n "${GITHUB_OUTPUT:-}" ]; then
+ echo "save_ccache=$save_ccache" >> "$GITHUB_OUTPUT"
+fi
diff --git a/.github/scripts/select-linux-packaging.sh b/.github/scripts/select-linux-packaging.sh
new file mode 100755
index 00000000..371ea4fb
--- /dev/null
+++ b/.github/scripts/select-linux-packaging.sh
@@ -0,0 +1,97 @@
+#!/usr/bin/env bash
+# Decide whether a Linux CI build should create and upload packages.
+
+set -euo pipefail
+
+path_triggers_packaging() {
+ case "$1" in
+ CMakeLists.txt|*/CMakeLists.txt|CMake/*|cmake/*|CMakeCPackOptions.cmake.in|package_description.txt|\
+ debian/*|bundle_fixup/*|artwork/*|icons/*|sounds/*|data/*|Palettes/*|translations/*|\
+ example_log_configurations/*|contrib/Ephemeris/*|contrib/gpl-v3-logo.svg|*.desktop|\
+ ALLCALL7.TXT|CALL3.TXT|cty.dat|cty.dat_copyright.txt|grid.dat|sat.dat|eclipse.txt|\
+ COPYING|AUTHORS|THANKS|NEWS|BUGS|README.md|\
+ .github/actions/build-linux-payload/*|\
+ .github/workflows/ci.yml|.github/workflows/build-linux.yml|.github/workflows/build-selected-artifacts.yml|.github/workflows/release.yml|\
+ .github/scripts/select-linux-packaging.sh|.github/scripts/linux-artifact-validation.sh|.github/scripts/package-linux-armhf.sh|\
+ .github/scripts/validate-linux-armhf-runtime.sh|.github/scripts/build-linux-armhf-cross.sh|\
+ .github/cmake/*|.github/images/linux-ci/*)
+ return 0
+ ;;
+ *)
+ return 1
+ ;;
+ esac
+}
+
+expect_trigger() {
+ if ! path_triggers_packaging "$1"; then
+ echo "self-test failed: expected packaging for $1" >&2
+ exit 1
+ fi
+}
+
+expect_no_trigger() {
+ if path_triggers_packaging "$1"; then
+ echo "self-test failed: did not expect packaging for $1" >&2
+ exit 1
+ fi
+}
+
+if [ "${1:-}" = "--self-test" ]; then
+ expect_trigger "CMakeLists.txt"
+ expect_trigger "tests/unit/audio/CMakeLists.txt"
+ expect_trigger "CMake/Install.cmake"
+ expect_trigger "debian/postinst"
+ expect_trigger "sounds/73.wav"
+ expect_trigger "cty.dat"
+ expect_trigger "contrib/Ephemeris/JPLEPH"
+ expect_trigger "wsjtx.desktop"
+ expect_trigger ".github/actions/build-linux-payload/action.yml"
+ expect_trigger ".github/workflows/build-linux.yml"
+ expect_trigger ".github/scripts/select-linux-packaging.sh"
+ expect_trigger ".github/scripts/linux-artifact-validation.sh"
+ expect_trigger ".github/images/linux-ci/install-packages.sh"
+
+ expect_no_trigger "widgets/mainwindow.cpp"
+ expect_no_trigger "tests/unit/audio/test_tx_request.cpp"
+ expect_no_trigger ".github/workflows/build-macos.yml"
+ expect_no_trigger "doc/user_guide/en/wsjtx-main.adoc"
+
+ echo "select-linux-packaging.sh self-test passed"
+ exit 0
+fi
+
+build_packages=true
+reason="${EVENT_NAME:-unknown} event"
+
+if [ "${EVENT_NAME:-}" = "pull_request" ] && [ "${FULL_CI:-false}" != "true" ]; then
+ base="${PR_BASE_SHA:-}"
+ head="${CURRENT_SHA:-}"
+ build_packages=false
+ reason="ordinary pull request"
+
+ 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 &&
+ git cat-file -e "${head}^{commit}" 2>/dev/null; then
+ while IFS= read -r path; do
+ [ -z "$path" ] && continue
+ if path_triggers_packaging "$path"; then
+ build_packages=true
+ reason="$path"
+ break
+ fi
+ done < <(git diff --name-only "$base" "$head")
+ else
+ build_packages=true
+ reason="unreadable ${base}..${head}"
+ fi
+fi
+
+echo "Build Linux packages: $build_packages"
+echo "Packaging policy reason: $reason"
+if [ -n "${GITHUB_OUTPUT:-}" ]; then
+ echo "build_packages=$build_packages" >> "$GITHUB_OUTPUT"
+fi
diff --git a/.github/scripts/should-refresh-linux-ci-images.py b/.github/scripts/should-refresh-linux-ci-images.py
new file mode 100644
index 00000000..44026a96
--- /dev/null
+++ b/.github/scripts/should-refresh-linux-ci-images.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+"""Decide whether the promoted Linux CI image is old enough to refresh."""
+
+from __future__ import annotations
+
+import argparse
+import os
+import sys
+from datetime import datetime, timedelta, timezone
+from pathlib import Path
+
+
+sys.path.insert(0, str(Path(__file__).parent))
+from ghcr_retention import GitHubPackagesClient, Version # noqa: E402
+
+
+OWNER = "WSJTX"
+PACKAGE = "wsjtx-internal/linux-noble"
+# Stable is a promoted pointer; age-gate scheduled refreshes to avoid image churn.
+
+
+def stable_version(versions: list[Version]) -> Version:
+ stable = [version for version in versions if "stable" in version.tags]
+ if len(stable) != 1:
+ raise RuntimeError(f"expected one stable Linux CI image, found {len(stable)}")
+ return stable[0]
+
+
+def should_refresh(
+ versions: list[Version], *, now: datetime, max_age_days: int
+) -> tuple[bool, int]:
+ version = stable_version(versions)
+ age = now.astimezone(timezone.utc) - version.created_at
+ age_days = max(0, age.days)
+ return age >= timedelta(days=max_age_days), age_days
+
+
+def main() -> int:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--max-age-days", type=int, default=30)
+ args = parser.parse_args()
+ if args.max_age_days < 1:
+ parser.error("--max-age-days must be positive")
+
+ token = os.environ.get("GITHUB_TOKEN")
+ if not token:
+ print("GITHUB_TOKEN is required", file=sys.stderr)
+ return 2
+
+ client = GitHubPackagesClient(token)
+ refresh, age_days = should_refresh(
+ client.list_versions(OWNER, PACKAGE),
+ now=datetime.now(timezone.utc),
+ max_age_days=args.max_age_days,
+ )
+ decision = "refresh" if refresh else "keep"
+ print(f"Linux CI stable image age: {age_days} days; decision: {decision}")
+ return 0 if refresh else 1
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/.github/scripts/smoke-launch-windows.sh b/.github/scripts/smoke-launch-windows.sh
new file mode 100755
index 00000000..e6dda339
--- /dev/null
+++ b/.github/scripts/smoke-launch-windows.sh
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+# Launch a Windows executable with the MinGW runtime directory removed from
+# PATH and assert it does NOT fail with STATUS_DLL_NOT_FOUND (0xC0000135).
+#
+# This reproduces the failure class behind "map65.exe won't start": a missing
+# runtime DLL (libgomp-1.dll, libportaudio-2.dll, libgfortran-5.dll, ...) makes
+# the process exit at load time, before main(), with exit code 0xC0000135. A
+# build that links and packages correctly survives a launch from a clean PATH;
+# one that relies on the dev shell's /mingw64/bin does not.
+#
+# The launched command must exit on its own. A bounded timeout turns a hung
+# process or modal startup error into a test failure.
+#
+# Usage: smoke-launch-windows.sh <exe> [args...]
+set -u
+
+# 0xC0000135 as a bash exit status. Windows returns the 32-bit NTSTATUS; MSYS2
+# bash surfaces it as 3221225781 (unsigned) for processes that exit on their
+# own. The 128+signal form does not apply here — this is a real process exit.
+readonly STATUS_DLL_NOT_FOUND=3221225781
+readonly TIMEOUT_SECS=20
+
+exe="${1:?usage: smoke-launch-windows.sh <exe> [args...]}"
+shift || true
+
+if [ ! -f "$exe" ]; then
+ echo "::error::smoke-launch: executable not found: $exe"
+ exit 1
+fi
+
+# Strip the MinGW runtime dir from PATH so only DLLs the build/packaging step
+# placed beside the exe (or in still-present system dirs) can resolve.
+cleaned_path=$(echo "$PATH" | tr ':' '\n' | grep -ivE '(^|/)mingw64/bin/?$' | paste -sd: -)
+echo "smoke-launch: $exe $* (PATH cleaned of /mingw64/bin)"
+
+# timeout returns 124 when it had to kill the process.
+PATH="$cleaned_path" timeout "${TIMEOUT_SECS}s" "$exe" "$@" >launch.out 2>&1
+code=$?
+
+if [ "$code" -eq "$STATUS_DLL_NOT_FOUND" ]; then
+ echo "::error::smoke-launch: $exe exited 0xC0000135 (STATUS_DLL_NOT_FOUND) — a runtime DLL is missing from the clean-PATH launch context"
+ echo "----- output -----"; cat launch.out || true
+ exit 1
+fi
+
+if [ "$code" -eq 124 ]; then
+ echo "::error::smoke-launch: $exe did not exit within ${TIMEOUT_SECS}s"
+ echo "----- output -----"; cat launch.out || true
+ exit 1
+fi
+
+if [ "$code" -eq 0 ]; then
+ cat launch.out || true
+ echo "smoke-launch OK: $exe loaded and exited cleanly"
+ exit 0
+fi
+
+# Any other non-zero code is a real fault (a missing DLL is the thing we guard
+# against; a usage/help non-zero exit would also surface here, so print it).
+echo "::error::smoke-launch: $exe exited with code $code"
+echo "----- output -----"; cat launch.out || true
+exit 1
diff --git a/.github/scripts/test-linux-ccache-compiler-signature.sh b/.github/scripts/test-linux-ccache-compiler-signature.sh
new file mode 100755
index 00000000..0ec48b24
--- /dev/null
+++ b/.github/scripts/test-linux-ccache-compiler-signature.sh
@@ -0,0 +1,87 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+fixture="$(mktemp -d)"
+trap 'rm -rf "$fixture"' EXIT
+mkdir -p "$fixture/bin" "$fixture/libexec"
+
+for component in cc1 cc1plus lto1 as; do
+ printf '%s\n' "$component fixture contents" > "$fixture/libexec/$component"
+done
+printf '%s\n' 'fixture specs' > "$fixture/specs"
+printf '%s\n' 'x86_64-fixture-linux-gnu' > "$fixture/target"
+printf '%s\n' 'fixture runtime library' > "$fixture/libexec/libcompiler-runtime.so"
+
+cat > "$fixture/bin/gcc-99" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+root="$(cd "$(dirname "$0")/.." && pwd)"
+case "$1" in
+ -dumpfullversion) echo 99.1.0 ;;
+ -dumpmachine) cat "$root/target" ;;
+ -dumpspecs) cat "$root/specs" ;;
+ -print-prog-name=*) echo "$root/libexec/${1#*=}" ;;
+ *) exit 2 ;;
+esac
+EOF
+cp "$fixture/bin/gcc-99" "$fixture/bin/g++-99"
+cat > "$fixture/bin/ldd" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+root="$(cd "$(dirname "$0")/.." && pwd)"
+printf 'libcompiler-runtime.so => %s/libexec/libcompiler-runtime.so (0x00000000)\n' "$root"
+EOF
+chmod +x "$fixture/bin/gcc-99" "$fixture/bin/g++-99" "$fixture/bin/ldd"
+cp "$fixture/bin/gcc-99" "$fixture/bin/arm-linux-gnueabihf-gcc"
+cp "$fixture/bin/gcc-99" "$fixture/bin/arm-linux-gnueabihf-g++"
+
+signature() {
+ PATH="$fixture/bin:$PATH" \
+ .github/scripts/linux-ccache-compiler-signature.sh gcc-99
+}
+
+first="$(signature)"
+IFS=$'\t' read -r version target driver_sha compatibility_id signature_sha <<< "$first"
+test "$version" = 99.1.0
+test "$target" = x86_64-fixture-linux-gnu
+test "$compatibility_id" = gcc99-v2
+[[ "$driver_sha" =~ ^[0-9a-f]{64}$ ]]
+[[ "$signature_sha" =~ ^[0-9a-f]{64}$ ]]
+
+cross_signature="$(
+ PATH="$fixture/bin:$PATH" \
+ .github/scripts/linux-ccache-compiler-signature.sh \
+ "$fixture/bin/arm-linux-gnueabihf-gcc"
+)"
+IFS=$'\t' read -r cross_version cross_target _ cross_compatibility_id _ \
+ <<< "$cross_signature"
+test "$cross_version" = 99.1.0
+test "$cross_target" = x86_64-fixture-linux-gnu
+test "$cross_compatibility_id" = gcc99-v2
+
+touch "$fixture/bin/gcc-99" "$fixture/libexec/cc1"
+test "$(signature)" = "$first"
+
+previous=$first
+for input in \
+ "$fixture/bin/gcc-99" \
+ "$fixture/bin/g++-99" \
+ "$fixture/libexec/cc1" \
+ "$fixture/libexec/cc1plus" \
+ "$fixture/libexec/lto1" \
+ "$fixture/libexec/as" \
+ "$fixture/libexec/libcompiler-runtime.so" \
+ "$fixture/specs"; do
+ printf '%s\n' '# signature change' >> "$input"
+ current="$(signature)"
+ if [ "$current" = "$previous" ]; then
+ echo "Expected compiler signature to change after modifying $input" >&2
+ exit 1
+ fi
+ previous=$current
+done
+
+printf '%s\n' 'aarch64-fixture-linux-gnu' > "$fixture/target"
+test "$(signature)" != "$previous"
+
+echo "linux-ccache-compiler-signature.sh self-test passed"
diff --git a/.github/scripts/test-verify-linux-ci-image.sh b/.github/scripts/test-verify-linux-ci-image.sh
new file mode 100755
index 00000000..38348f5d
--- /dev/null
+++ b/.github/scripts/test-verify-linux-ci-image.sh
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+fixture="$(mktemp -d)"
+trap 'rm -rf "$fixture"' EXIT
+mkdir -p "$fixture/prefix/pfunit/cmake" "$fixture/prefix/hamlib/lib"
+touch "$fixture/prefix/pfunit/cmake/PFUNITConfig.cmake"
+touch "$fixture/prefix/hamlib/lib/libhamlib.a"
+
+# shellcheck source=.github/scripts/linux-ci-image-config.sh
+. .github/scripts/linux-ci-image-config.sh
+# shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+. .github/scripts/tsan-linux-deps-config.sh
+recipe="$(.github/scripts/linux-ci-image-fingerprint.sh normal-noble)"
+tsan_recipe="$(.github/scripts/linux-ci-image-fingerprint.sh tsan-noble)"
+manifest="$fixture/image.env"
+compiler=gcc
+compiler_path="$(readlink -f "$(command -v "$compiler")")"
+compiler_version="$($compiler -dumpfullversion -dumpversion)"
+compiler_sha256="$(sha256sum "$compiler_path" | awk '{print $1}')"
+compiler_target="$($compiler -dumpmachine)"
+if command -v dpkg-query >/dev/null 2>&1; then
+ package_sha256="$(dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort | sha256sum | awk '{print $1}')"
+ toolchain_identity="$recipe:$compiler_target:$compiler_sha256:$package_sha256"
+ toolchain_sha256="$(printf '%s' "$toolchain_identity" | sha256sum | awk '{print $1}')"
+ toolchain_id="gcc${compiler_version}-x86_64-${toolchain_sha256:0:20}"
+else
+ package_sha256=0000000000000000000000000000000000000000000000000000000000000000
+ toolchain_id=fixture
+fi
+compiler_major=${compiler_version%%.*}
+ccache_compatibility_id="gcc${compiler_major}-v2"
+compiler_signature_sha256=1111111111111111111111111111111111111111111111111111111111111111
+
+write_manifest() {
+ local hamlib_commit=${1:-$LINUX_HAMLIB_COMMIT}
+ local recipe_sha=${2:-$recipe}
+ local include_ccache_identity=${3:-true}
+ {
+ echo "schema=1"
+ echo "flavor=normal"
+ echo "architecture=x86_64"
+ echo "generation=build-20260818-1-1"
+ echo "compiler=$compiler"
+ echo "compiler_version=$compiler_version"
+ echo "compiler_sha256=$compiler_sha256"
+ echo "compiler_target=$compiler_target"
+ echo "package_sha256=$package_sha256"
+ echo "toolchain_id=$toolchain_id"
+ if [ "$include_ccache_identity" = true ]; then
+ echo "ccache_compatibility_id=$ccache_compatibility_id"
+ echo "compiler_signature_sha256=$compiler_signature_sha256"
+ fi
+ echo "hamlib_ref=$LINUX_HAMLIB_REF"
+ echo "hamlib_commit=$hamlib_commit"
+ echo "pfunit_version=$LINUX_PFUNIT_VERSION"
+ echo "pfunit_commit=$LINUX_PFUNIT_COMMIT"
+ echo "recipe_sha256=$recipe_sha"
+ } > "$manifest"
+}
+
+run_verify() {
+ local allow_stale_image=${1:-false}
+ WSJTX_CI_IMAGE_MANIFEST="$manifest" \
+ WSJTX_CI_PREFIX_OVERRIDE="$fixture/prefix" \
+ WSJTX_CI_IMAGE_SKIP_RUNTIME_CHECKS=true \
+ WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH="$allow_stale_image" \
+ .github/scripts/verify-linux-ci-image.sh normal x86_64 "$LINUX_HAMLIB_REF"
+}
+
+write_manifest
+run_verify >/dev/null
+
+output="$fixture/output"
+GITHUB_OUTPUT="$output" run_verify >/dev/null
+grep -qx 'recipe_match=true' "$output"
+grep -qx "ccache_compatibility_id=$ccache_compatibility_id" "$output"
+grep -qx "ccache_compiler_check=string:$compiler_signature_sha256" "$output"
+
+write_manifest "$LINUX_HAMLIB_COMMIT" "$recipe" false
+if run_verify >/dev/null 2>&1; then
+ echo "Expected a current image without ccache identity fields to fail" >&2
+ exit 1
+fi
+
+write_manifest
+printf '%s\n' 'compiler_signature_sha256=invalid' >> "$manifest"
+if run_verify >/dev/null 2>&1; then
+ echo "Expected an invalid compiler signature to fail" >&2
+ exit 1
+fi
+
+write_manifest 0000000000000000000000000000000000000000
+if run_verify >/dev/null 2>&1; then
+ echo "Expected a mismatched Hamlib commit to fail" >&2
+ exit 1
+fi
+
+write_manifest "$LINUX_HAMLIB_COMMIT" 0000000000000000000000000000000000000000000000000000000000000000 false
+if run_verify >/dev/null 2>&1; then
+ echo "Expected a mismatched recipe fingerprint to fail" >&2
+ exit 1
+fi
+if ! run_verify true >/dev/null 2>&1; then
+ echo "Expected stale image allowance to accept a mismatched recipe fingerprint" >&2
+ exit 1
+fi
+output="$fixture/stale-output"
+GITHUB_OUTPUT="$output" run_verify true >/dev/null 2>&1
+grep -qx 'recipe_match=false' "$output"
+grep -qx "ccache_compatibility_id=$toolchain_id" "$output"
+grep -qx 'ccache_compiler_check=mtime' "$output"
+
+tsan_config_dir="$fixture/tsan-config"
+mkdir -p "$tsan_config_dir" "$fixture/prefix/tsan/boost/cmake"
+cp .github/scripts/verify-linux-ci-image.sh \
+ .github/scripts/linux-ccache-compiler-signature.sh \
+ .github/scripts/linux-ci-image-config.sh \
+ .github/scripts/tsan-linux-deps-config.sh \
+ "$tsan_config_dir/"
+cp .github/scripts/linux-ci-image-fingerprint.sh "$tsan_config_dir/"
+cat > "$tsan_config_dir/verify-tsan-deps-linux.sh" <<'EOF'
+#!/usr/bin/env bash
+set -euo pipefail
+EOF
+chmod +x "$tsan_config_dir/verify-tsan-deps-linux.sh"
+touch "$fixture/prefix/tsan/boost/cmake/BoostConfig.cmake"
+
+tsan_manifest="$fixture/tsan-image.env"
+cat > "$tsan_manifest" <<EOF
+schema=1
+flavor=tsan
+architecture=x86_64
+generation=build-20260818-1-1
+compiler=gcc-13
+compiler_version=$TSAN_GCC_VERSION
+compiler_sha256=0000000000000000000000000000000000000000000000000000000000000000
+compiler_target=fixture
+package_sha256=0000000000000000000000000000000000000000000000000000000000000000
+toolchain_id=fixture
+ccache_compatibility_id=gcc${TSAN_GCC_VERSION%%.*}-v2
+compiler_signature_sha256=1111111111111111111111111111111111111111111111111111111111111111
+hamlib_ref=$TSAN_HAMLIB_REF
+hamlib_commit=$TSAN_HAMLIB_COMMIT
+hamlib_patch_commit=$TSAN_HAMLIB_PATCH_COMMIT
+qt_version=$TSAN_QT_VERSION
+boost_version=$TSAN_BOOST_VERSION
+recipe_sha256=$tsan_recipe
+EOF
+if ! WSJTX_CI_IMAGE_MANIFEST="$tsan_manifest" \
+ WSJTX_CI_PREFIX_OVERRIDE="$fixture/prefix" \
+ WSJTX_CI_IMAGE_SKIP_RUNTIME_CHECKS=true \
+ IMAGE_RECIPE_SHA256="$tsan_recipe" \
+ "$tsan_config_dir/verify-linux-ci-image.sh" \
+ tsan x86_64 "$TSAN_HAMLIB_REF" >/dev/null; then
+ echo "Expected TSan image verification to load its dependency configuration" >&2
+ exit 1
+fi
+
+echo "verify-linux-ci-image.sh self-test passed"
diff --git a/.github/scripts/tests/test_armhf_ci_manifest.py b/.github/scripts/tests/test_armhf_ci_manifest.py
new file mode 100644
index 00000000..c438d62d
--- /dev/null
+++ b/.github/scripts/tests/test_armhf_ci_manifest.py
@@ -0,0 +1,90 @@
+import hashlib
+import os
+import pathlib
+import subprocess
+import tempfile
+import unittest
+
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+WRITER = ROOT / ".github/scripts/write-armhf-ci-manifest.sh"
+
+
+class ArmhfCiManifestTests(unittest.TestCase):
+ def test_runtime_manifest_preserves_requested_image_identity(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ fixture = pathlib.Path(temporary)
+ config = fixture / "config"
+ output = fixture / "output"
+ runtime = fixture / "runtime"
+ fixture_bin = fixture / "bin"
+ config.mkdir()
+ output.mkdir()
+ runtime.mkdir()
+ fixture_bin.mkdir()
+
+ dpkg_query = fixture_bin / "dpkg-query"
+ dpkg_query.write_text(
+ "#!/bin/sh\nprintf '%s\\n' fixture-package=1.0\n",
+ encoding="utf-8",
+ )
+ dpkg_query.chmod(0o755)
+
+ library = runtime / "libgcc_s.so.1"
+ library.write_bytes(b"fixture GCC runtime\n")
+ library_sha = hashlib.sha256(library.read_bytes()).hexdigest()
+ runtime_records = f"libgcc_s.so.1={library_sha}\n".encode()
+ runtime_sha = hashlib.sha256(runtime_records).hexdigest()
+
+ (config / "armhf-ci-image-config.sh").write_text(
+ "ARMHF_CI_IMAGE_SCHEMA=1\n"
+ f"ARMHF_RUNTIME_PREFIX={runtime}\n"
+ "ARMHF_GCC_RUNTIME_LIBRARIES=(libgcc_s.so.1)\n"
+ "ARMHF_GLIBC_VERSION=2.36\n",
+ encoding="utf-8",
+ )
+ (config / "cross-builder.env").write_text(
+ "role=cross-builder\n"
+ "generation=build-20260901-10-1\n"
+ f"recipe_sha256={'1' * 64}\n"
+ "toolchain_id=gcc13.4.0-armhf-fixture\n"
+ f"runtime_sha256={runtime_sha}\n"
+ "hamlib_ref=4.7.2\n"
+ f"hamlib_commit={'2' * 40}\n",
+ encoding="utf-8",
+ )
+
+ environment = os.environ.copy()
+ environment.update(
+ PATH=f"{fixture_bin}:{environment['PATH']}",
+ WSJTX_ARMHF_CONFIG_DIR=str(config),
+ WSJTX_CI_MANIFEST_DIR=str(output),
+ )
+ subprocess.run(
+ [
+ str(WRITER),
+ "runtime",
+ "armhf",
+ "build-20260901-20-1",
+ "3" * 64,
+ ],
+ cwd=ROOT,
+ env=environment,
+ check=True,
+ )
+
+ fields = dict(
+ line.split("=", 1)
+ for line in (output / "image.env").read_text().splitlines()
+ )
+ self.assertEqual(fields["role"], "runtime")
+ self.assertEqual(fields["architecture"], "armhf")
+ self.assertEqual(fields["generation"], "build-20260901-20-1")
+ self.assertEqual(fields["recipe_sha256"], "3" * 64)
+ self.assertEqual(fields["cross_generation"], "build-20260901-10-1")
+ self.assertEqual(fields["cross_recipe_sha256"], "1" * 64)
+ self.assertEqual(fields["runtime_sha256"], runtime_sha)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_armhf_cross_configuration.py b/.github/scripts/tests/test_armhf_cross_configuration.py
new file mode 100644
index 00000000..0893e99a
--- /dev/null
+++ b/.github/scripts/tests/test_armhf_cross_configuration.py
@@ -0,0 +1,176 @@
+import pathlib
+import unittest
+
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+
+
+class ArmhfCrossConfigurationTests(unittest.TestCase):
+ def read(self, relative_path):
+ return (ROOT / relative_path).read_text(encoding="utf-8")
+
+ def test_cross_toolchain_pins_armv7_hard_float_and_bookworm_abi(self):
+ config = self.read(".github/images/linux-ci/armhf-cross-toolchain.config")
+ for setting in (
+ "CT_ARCH_ARM=y",
+ "CT_ARCH_ARM_MODE_THUMB=y",
+ 'CT_ARCH_ARCH="armv7-a+fp"',
+ "CT_ARCH_FLOAT_HW=y",
+ "CT_LINUX_V_6_1=y",
+ "CT_BINUTILS_V_2_40=y",
+ "CT_GLIBC_V_2_36=y",
+ 'CT_GLIBC_MIN_KERNEL_VERSION="3.2.0"',
+ "CT_GCC_V_13=y",
+ "CT_CC_GCC_LIBGOMP=y",
+ "CT_CC_LANG_CXX=y",
+ "CT_CC_LANG_FORTRAN=y",
+ "CT_PARALLEL_JOBS=1",
+ 'CT_TARGET_CFLAGS="-g0"',
+ ):
+ self.assertIn(setting, config)
+ self.assertNotIn("CT_CC_GCC_LIBQUADMATH=y", config)
+
+ image_config = self.read(".github/scripts/armhf-ci-image-config.sh")
+ self.assertIn("ARMHF_GCC_VERSION=13.4.0", image_config)
+ self.assertIn("ARMHF_GLIBC_VERSION=2.36", image_config)
+ self.assertIn("ARMHF_TARGET_TRIPLET=arm-linux-gnueabihf", image_config)
+
+ verifier = self.read(".github/scripts/verify-armhf-ci-image.sh")
+ audit = self.read(".github/scripts/audit-armhf-cross-build.sh")
+ self.assertIn("reject_quadmath_dependency", verifier)
+ self.assertIn("unexpectedly depends on libquadmath", audit)
+ self.assertIn("reject_private_glibc_dependency", verifier)
+ self.assertIn("private glibc symbol", audit)
+
+ def test_armhf_cache_identity_parsing_fails_closed(self):
+ workflow = self.read(".github/workflows/build-linux.yml")
+ self.assertIn(
+ '''ccache_compatibility_id=$(awk -F= '$1 == "cross_ccache_compatibility_id" { print $2 }' "$output_file")''',
+ workflow,
+ )
+ self.assertIn(
+ 'if [ -z "$ccache_compatibility_id" ] || '
+ '[ -z "$ccache_compiler_check" ]; then',
+ workflow,
+ )
+ self.assertNotIn('\\"cross_ccache_compatibility_id\\"', workflow)
+
+ def test_armhf_qemu_registration_uses_one_immutable_release(self):
+ expected = (
+ "image: tonistiigi/binfmt:qemu-v10.2.3-68@sha256:"
+ "400a4873b838d1b89194d982c45e5fb3cda4593fbfd7e08a02e76b03b21166f0"
+ )
+ for path in (
+ ".github/workflows/build-linux.yml",
+ ".github/workflows/publish-linux-ci-images.yml",
+ ):
+ self.assertIn(expected, self.read(path))
+
+ def test_cmake_separates_host_programs_from_target_dependencies(self):
+ toolchain = self.read(".github/cmake/armhf-toolchain.cmake")
+ self.assertIn("set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)", toolchain)
+ self.assertIn("set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)", toolchain)
+ self.assertIn("set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)", toolchain)
+ self.assertIn("set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)", toolchain)
+ self.assertIn("set(_wsjt_armhf_triplet arm-linux-gnueabihf)", toolchain)
+ self.assertIn("${_wsjt_armhf_triplet}-gfortran", toolchain)
+ self.assertIn("set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armhf", toolchain)
+ self.assertIn("set(CPACK_RPM_PACKAGE_ARCHITECTURE armv7l", toolchain)
+
+ dependencies = self.read("CMake/Dependencies.cmake")
+ self.assertIn("WSJT_QT_HOST_PATH", dependencies)
+ self.assertIn("IMPORTED_LOCATION", dependencies)
+
+ def test_builder_and_runtime_keep_distinct_native_architectures(self):
+ builder = self.read(".github/images/linux-ci/Dockerfile.armhf-cross")
+ runtime = self.read(".github/images/linux-ci/Dockerfile.armhf-runtime")
+ self.assertTrue(builder.startswith("FROM debian:bookworm\n"))
+ self.assertIn("--architectures=armhf", builder)
+ self.assertIn("qemu-user-static", builder)
+ self.assertIn("normalize-armhf-sysroot-symlinks.sh", builder)
+ self.assertIn("tail -n 300 build.log", builder)
+ self.assertIn("ARG CROSS_BUILDER_PLATFORM=linux/amd64", runtime)
+ self.assertIn(
+ "FROM --platform=${CROSS_BUILDER_PLATFORM} ${CROSS_BUILDER_IMAGE}",
+ runtime,
+ )
+ self.assertIn("FROM arm32v7/debian:bookworm", runtime)
+ self.assertIn("install-armhf-runtime-packages", runtime)
+ self.assertIn(
+ "COPY --from=cross_builder /usr/bin/qemu-arm-static", runtime
+ )
+
+ cross_build = self.read(".github/scripts/build-linux-armhf-cross.sh")
+ runtime_package = self.read(".github/scripts/package-linux-armhf.sh")
+ self.assertNotIn("qemu", cross_build.lower())
+ self.assertIn("cmake --install wsjtx-build", cross_build)
+ self.assertIn("cpack -G DEB", runtime_package)
+ self.assertIn("cpack -G RPM", runtime_package)
+ self.assertIn("CPACK_INSTALL_CMAKE_PROJECTS=", runtime_package)
+ self.assertIn("CPACK_INSTALLED_DIRECTORIES=/work/AppDir;/", runtime_package)
+ self.assertIn('"$ARMHF_QEMU_EXECUTABLE"', runtime_package)
+ self.assertIn(
+ 'LINUX_APPIMAGE_RUNNER="$ARMHF_QEMU_EXECUTABLE"', runtime_package
+ )
+ self.assertIn("armhf-static-ldd.sh", runtime_package)
+ self.assertIn('PATH="/work/wsjtx-build/appimage-tools:$PATH"', runtime_package)
+
+ def test_hybrid_is_the_only_armhf_build_implementation(self):
+ workflow = self.read(".github/workflows/build-linux.yml")
+ native_action = self.read(
+ ".github/actions/build-linux-payload/action.yml"
+ )
+ self.assertFalse(
+ (ROOT / ".github/scripts/build-linux-payload.sh").exists()
+ )
+ self.assertNotIn("build-linux-payload.sh", workflow)
+ self.assertEqual(workflow.count("build-linux-armhf-cross.sh"), 1)
+ self.assertIn("docker run --rm --platform linux/amd64", workflow)
+ self.assertNotIn("inputs.arch != 'armhf'", native_action)
+ self.assertNotIn("linuxdeploy-armhf", native_action)
+
+ def test_armhf_joins_only_the_opt_in_full_ci_matrix(self):
+ workflow = self.read(".github/workflows/ci.yml")
+ prepare = workflow.split(" prepare:\n", 1)[1].split("\n macos:\n", 1)[0]
+ armhf_job = workflow.split(" linux-armhf:\n", 1)[1].split(
+ "\n windows:\n", 1
+ )[0]
+
+ self.assertIn("RESOLVE_ARMHF=true", prepare)
+ self.assertIn("inputs.armhf_image_tag", prepare)
+ self.assertIn(
+ "contains(github.event.pull_request.labels.*.name, 'full-ci')",
+ armhf_job,
+ )
+ self.assertIn("github.event_name == 'workflow_dispatch'", armhf_job)
+ self.assertIn('arch: \"armhf\"', armhf_job)
+ self.assertIn(
+ "image_tag: ${{ needs.prepare.outputs.armhf_image_tag }}",
+ armhf_job,
+ )
+
+ def test_slow_decoder_timeouts_are_at_most_four_minutes(self):
+ jtty = self.read("tests/unit/jtty/CMakeLists.txt")
+ for test_name, timeout in (
+ ("test_jtty_adjacent_decode", 180),
+ ("test_jtty_structured_decode", 240),
+ ("test_jtty_overlap_decode", 180),
+ ("test_jtty_overlap_decode_480", 240),
+ ("test_jtty_windowed_decode", 180),
+ ("test_jtty_gap_merge", 180),
+ ("test_jtty_surface_ranges", 180),
+ ):
+ properties = jtty.split(
+ f"set_tests_properties ({test_name}", 1
+ )[1].split(")", 1)[0]
+ self.assertIn(f"TIMEOUT {timeout}", properties)
+
+ q65 = self.read("tests/unit/q65/CMakeLists.txt")
+ properties = q65.split(
+ "set_tests_properties (test_q65_decode_pipeline", 1
+ )[1].split(")", 1)[0]
+ self.assertIn("TIMEOUT 180", properties)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_armhf_static_ldd.py b/.github/scripts/tests/test_armhf_static_ldd.py
new file mode 100644
index 00000000..a1db1618
--- /dev/null
+++ b/.github/scripts/tests/test_armhf_static_ldd.py
@@ -0,0 +1,123 @@
+import os
+import pathlib
+import subprocess
+import tempfile
+import unittest
+
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+VALIDATOR = ROOT / ".github/scripts/armhf-static-ldd.sh"
+
+
+class ArmhfStaticLddTests(unittest.TestCase):
+ def run_validator(self, needed, libraries, runpath=None, transitive=None):
+ with tempfile.TemporaryDirectory() as temporary:
+ fixture = pathlib.Path(temporary)
+ fixture_bin = fixture / "bin"
+ fixture_lib = fixture / "lib"
+ fixture_bin.mkdir()
+ fixture_lib.mkdir()
+ target = fixture / "program"
+ target.write_text("target\n", encoding="utf-8")
+
+ transitive = transitive or {}
+ dynamic_output = "".join(
+ f"printf '%s\\n' ' 0x00000001 (NEEDED) Shared library: [{library}]'\n"
+ for library in needed
+ )
+ if runpath is not None:
+ dynamic_output += (
+ "printf '%s\\n' ' 0x0000001d (RUNPATH) "
+ f"Library runpath: [{runpath}]'\n"
+ )
+ transitive_cases = "".join(
+ " *" + parent + "*)\n"
+ + "".join(
+ f" printf '%s\\n' ' 0x00000001 (NEEDED) Shared library: [{library}]'\n"
+ for library in dependencies
+ )
+ + " ;;\n"
+ for parent, dependencies in transitive.items()
+ )
+ (fixture_bin / "readelf").write_text(
+ "#!/bin/sh\n"
+ "case \"$*\" in\n"
+ + transitive_cases
+ + " *)\n"
+ + "".join(f" {line}\n" for line in dynamic_output.splitlines())
+ + " ;;\n"
+ "esac\n",
+ encoding="utf-8",
+ )
+ (fixture_bin / "file").write_text(
+ "#!/bin/sh\n"
+ "case \"$*\" in\n"
+ " *libhost.so*) echo \"$*: ELF 64-bit LSB shared object, x86-64\" ;;\n"
+ " *) echo \"$*: ELF 32-bit LSB shared object, ARM, EABI5\" ;;\n"
+ "esac\n",
+ encoding="utf-8",
+ )
+ for tool in (fixture_bin / "readelf", fixture_bin / "file"):
+ tool.chmod(0o755)
+ for library in libraries:
+ library_path = fixture_lib / library
+ library_path.parent.mkdir(parents=True, exist_ok=True)
+ library_path.write_text("fixture\n", encoding="utf-8")
+
+ environment = os.environ.copy()
+ environment.update(
+ PATH=f"{fixture_bin}:{environment['PATH']}",
+ WSJT_ARMHF_RUNTIME_PREFIX=str(fixture / "empty-runtime"),
+ ARMHF_STATIC_LDD_LIBRARY_PATH=str(fixture_lib),
+ )
+ return subprocess.run(
+ ["bash", str(VALIDATOR), str(target)],
+ cwd=ROOT,
+ env=environment,
+ text=True,
+ capture_output=True,
+ check=False,
+ )
+
+ def test_resolves_armhf_dependency_without_executing_target(self):
+ result = self.run_validator(["libfixture.so.1"], ["libfixture.so.1"])
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertIn("libfixture.so.1 => ", result.stdout)
+
+ def test_rejects_missing_dependency(self):
+ result = self.run_validator(["libmissing.so.1"], [])
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("libmissing.so.1 => not found", result.stdout)
+
+ def test_rejects_quadmath_dependency(self):
+ result = self.run_validator(["libquadmath.so.0"], ["libquadmath.so.0"])
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("unavailable ARMHF runtime", result.stderr)
+
+ def test_rejects_host_library(self):
+ result = self.run_validator(["libhost.so.1"], ["libhost.so.1"])
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("non-ARMHF ELF", result.stderr)
+
+ def test_resolves_origin_relative_runpath(self):
+ result = self.run_validator(
+ ["libpulsecommon-fixture.so"],
+ ["pulseaudio/libpulsecommon-fixture.so"],
+ runpath="$ORIGIN/lib/pulseaudio",
+ )
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertIn("pulseaudio/libpulsecommon-fixture.so", result.stdout)
+
+ def test_resolves_transitive_dependency_closure(self):
+ result = self.run_validator(
+ ["libparent.so.1"],
+ ["libparent.so.1", "libchild.so.1"],
+ transitive={"libparent.so.1": ["libchild.so.1"]},
+ )
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertIn("libparent.so.1 => ", result.stdout)
+ self.assertIn("libchild.so.1 => ", result.stdout)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_armhf_sysroot_symlinks.py b/.github/scripts/tests/test_armhf_sysroot_symlinks.py
new file mode 100644
index 00000000..991971f6
--- /dev/null
+++ b/.github/scripts/tests/test_armhf_sysroot_symlinks.py
@@ -0,0 +1,42 @@
+import os
+import pathlib
+import subprocess
+import tempfile
+import unittest
+
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+NORMALIZER = ROOT / ".github/scripts/normalize-armhf-sysroot-symlinks.sh"
+
+
+class ArmhfSysrootSymlinkTests(unittest.TestCase):
+ def test_absolute_links_are_rebased_inside_sysroot(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ sysroot = pathlib.Path(temporary)
+ target = sysroot / "lib/arm-linux-gnueabihf/libm.so.6"
+ target.parent.mkdir(parents=True)
+ target.write_text("fixture\n", encoding="utf-8")
+ link = sysroot / "usr/lib/arm-linux-gnueabihf/libm.so"
+ link.parent.mkdir(parents=True)
+ link.symlink_to("/lib/arm-linux-gnueabihf/libm.so.6")
+
+ subprocess.run(["bash", str(NORMALIZER), str(sysroot)], check=True)
+
+ self.assertFalse(os.readlink(link).startswith("/"))
+ self.assertEqual(link.resolve(), target)
+
+ def test_relative_links_remain_unchanged(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ sysroot = pathlib.Path(temporary)
+ directory = sysroot / "usr/lib"
+ directory.mkdir(parents=True)
+ link = directory / "libfixture.so"
+ link.symlink_to("libfixture.so.1")
+
+ subprocess.run(["bash", str(NORMALIZER), str(sysroot)], check=True)
+
+ self.assertEqual(os.readlink(link), "libfixture.so.1")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_check_candidate_tag.py b/.github/scripts/tests/test_check_candidate_tag.py
new file mode 100644
index 00000000..cf44ccf4
--- /dev/null
+++ b/.github/scripts/tests/test_check_candidate_tag.py
@@ -0,0 +1,81 @@
+import subprocess
+import tempfile
+import unittest
+from pathlib import Path
+
+
+SCRIPT = Path(__file__).resolve().parents[1] / "check-candidate-tag.sh"
+TAG = "build/v3.2.0-rc1"
+
+
+class CheckCandidateTagTest(unittest.TestCase):
+ def setUp(self):
+ self.directory = tempfile.TemporaryDirectory()
+ self.addCleanup(self.directory.cleanup)
+ self.repo = Path(self.directory.name)
+ self.git("init", "-q")
+ self.git(
+ "-c", "user.name=Test", "-c", "user.email=test@example.com",
+ "commit", "--allow-empty", "-qm", "first",
+ )
+ self.first = self.git("rev-parse", "HEAD").stdout.strip()
+ self.git(
+ "-c", "user.name=Test", "-c", "user.email=test@example.com",
+ "commit", "--allow-empty", "-qm", "second",
+ )
+ self.second = self.git("rev-parse", "HEAD").stdout.strip()
+
+ def git(self, *args, input=None):
+ return subprocess.run(
+ ["git", *args], cwd=self.repo, input=input, text=True,
+ capture_output=True, check=True,
+ )
+
+ def check_tag(self, expected_sha=None, cwd=None):
+ return subprocess.run(
+ ["bash", SCRIPT, TAG, expected_sha or self.second],
+ cwd=cwd or self.repo, text=True, capture_output=True,
+ )
+
+ def test_missing_tag_allows_creation(self):
+ result = self.check_tag()
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertEqual(result.stdout, "exists=false\n")
+
+ def test_matching_lightweight_tag_is_idempotent(self):
+ self.git("tag", TAG, self.second)
+ result = self.check_tag()
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertEqual(result.stdout, "exists=true\n")
+
+ def test_matching_annotated_tag_is_idempotent(self):
+ self.git(
+ "-c", "user.name=Test", "-c", "user.email=test@example.com",
+ "tag", "-am", "candidate", TAG, self.second,
+ )
+ result = self.check_tag()
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertEqual(result.stdout, "exists=true\n")
+
+ def test_different_commit_is_rejected(self):
+ self.git("tag", TAG, self.first)
+ result = self.check_tag()
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("release tags are never moved", result.stderr)
+
+ def test_noncommit_tag_is_rejected(self):
+ blob = self.git("hash-object", "-w", "--stdin", input="not a commit").stdout.strip()
+ self.git("update-ref", f"refs/tags/{TAG}", blob)
+ result = self.check_tag()
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("does not identify a commit", result.stderr)
+
+ def test_git_failure_is_not_treated_as_missing_tag(self):
+ with tempfile.TemporaryDirectory() as directory:
+ result = self.check_tag(cwd=directory)
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("Could not inspect", result.stderr)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_ghcr_retention.py b/.github/scripts/tests/test_ghcr_retention.py
new file mode 100755
index 00000000..9bffad2d
--- /dev/null
+++ b/.github/scripts/tests/test_ghcr_retention.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python3
+
+import importlib.util
+import sys
+import unittest
+from datetime import datetime, timedelta, timezone
+from pathlib import Path
+
+
+SCRIPT = Path(__file__).parents[1] / "ghcr_retention.py"
+SPEC = importlib.util.spec_from_file_location("ghcr_retention", SCRIPT)
+MODULE = importlib.util.module_from_spec(SPEC)
+sys.modules[SPEC.name] = MODULE
+SPEC.loader.exec_module(MODULE)
+
+
+def version(version_id, age_days, tags, now):
+ return MODULE.Version(
+ id=version_id,
+ digest=f"sha256:{version_id:064x}",
+ created_at=now - timedelta(days=age_days),
+ tags=tuple(tags),
+ )
+
+
+class RetentionPlanTests(unittest.TestCase):
+ def setUp(self):
+ self.now = datetime(2026, 8, 18, tzinfo=timezone.utc)
+
+ def plan(self, versions, keep=3):
+ return {
+ item.version.id: item
+ for item in MODULE.plan_retention(versions, self.now, 60, keep)
+ }
+
+ def test_deletes_only_expired_recognized_versions_outside_keep_set(self):
+ versions = [
+ version(1, 90, ("build-20260101-1-1",), self.now),
+ version(2, 10, ("build-20260808-2-1",), self.now),
+ version(3, 20, ("build-20260729-3-1",), self.now),
+ version(4, 30, ("build-20260719-4-1",), self.now),
+ ]
+ plan = self.plan(versions)
+ self.assertTrue(plan[1].delete)
+ self.assertFalse(plan[2].delete)
+ self.assertFalse(plan[3].delete)
+ self.assertFalse(plan[4].delete)
+
+ def test_stable_unknown_and_untagged_versions_are_protected(self):
+ versions = [
+ version(1, 100, ("stable", "build-20260101-1-1"), self.now),
+ version(2, 100, ("debug",), self.now),
+ version(3, 100, (), self.now),
+ ]
+ plan = self.plan(versions, keep=1)
+ self.assertEqual(plan[1].reason, "stable")
+ self.assertEqual(plan[2].reason, "unknown-or-untagged")
+ self.assertEqual(plan[3].reason, "unknown-or-untagged")
+
+ def test_exact_sixty_day_boundary_is_kept(self):
+ plan = self.plan([version(1, 60, ("candidate-1-1",), self.now)], keep=1)
+ self.assertFalse(plan[1].delete)
+
+ def test_equal_timestamps_use_id_as_tiebreaker(self):
+ versions = [
+ version(1, 90, ("candidate-1-1",), self.now),
+ version(2, 90, ("candidate-2-1",), self.now),
+ ]
+ plan = self.plan(versions, keep=1)
+ self.assertTrue(plan[1].delete)
+ self.assertFalse(plan[2].delete)
+
+ def test_nested_package_name_is_encoded(self):
+ path = MODULE.GitHubPackagesClient.package_path(
+ "WSJTX", "wsjtx-internal/linux-noble"
+ )
+ self.assertEqual(
+ path,
+ "/orgs/WSJTX/packages/container/wsjtx-internal%2Flinux-noble",
+ )
+
+ def test_malformed_version_fails_closed(self):
+ with self.assertRaises(ValueError):
+ MODULE.parse_version({"id": 1, "name": "sha256:x", "metadata": {}})
+
+
+class FakeClient:
+ def __init__(self, versions, refreshed=None):
+ self.versions = versions
+ self.refreshed = refreshed or {}
+ self.deleted = []
+
+ def list_versions(self, owner, package):
+ return list(self.versions)
+
+ def get_version(self, owner, package, version_id):
+ return self.refreshed.get(
+ version_id,
+ next(item for item in self.versions if item.id == version_id),
+ )
+
+ def delete_version(self, owner, package, version_id):
+ self.deleted.append(version_id)
+
+
+class RetentionApplicationTests(unittest.TestCase):
+ def setUp(self):
+ self.now = datetime(2026, 8, 18, tzinfo=timezone.utc)
+ self.versions = [
+ version(1, 100, ("candidate-1-1",), self.now),
+ version(2, 30, ("candidate-2-1",), self.now),
+ ]
+
+ def run_process(self, client, apply):
+ return MODULE.process_package(
+ client,
+ "WSJTX",
+ "wsjtx-internal/linux-noble",
+ self.now,
+ 60,
+ 1,
+ apply,
+ )
+
+ def test_dry_run_never_deletes(self):
+ client = FakeClient(self.versions)
+ self.assertEqual(self.run_process(client, False), 0)
+ self.assertEqual(client.deleted, [])
+
+ def test_apply_deletes_planned_version(self):
+ client = FakeClient(self.versions)
+ self.assertEqual(self.run_process(client, True), 1)
+ self.assertEqual(client.deleted, [1])
+
+ def test_refetch_protects_new_stable_tag(self):
+ stable = version(1, 100, ("stable", "candidate-1-1"), self.now)
+ client = FakeClient(self.versions, {1: stable})
+ self.assertEqual(self.run_process(client, True), 0)
+ self.assertEqual(client.deleted, [])
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_linux_artifact_validation.py b/.github/scripts/tests/test_linux_artifact_validation.py
new file mode 100644
index 00000000..655d0d24
--- /dev/null
+++ b/.github/scripts/tests/test_linux_artifact_validation.py
@@ -0,0 +1,230 @@
+import os
+import subprocess
+import tempfile
+import unittest
+from pathlib import Path
+
+
+REPO_ROOT = Path(__file__).resolve().parents[3]
+HELPER = REPO_ROOT / ".github/scripts/linux-artifact-validation.sh"
+
+
+class LinuxArtifactValidationTests(unittest.TestCase):
+ def run_helper(self, command, **environment):
+ env = os.environ.copy()
+ env["VALIDATION_HELPER"] = str(HELPER)
+ env.update({name: str(value) for name, value in environment.items()})
+ return subprocess.run(
+ ["bash", "-c", f'source "$VALIDATION_HELPER"; {command}'],
+ check=False,
+ capture_output=True,
+ env=env,
+ text=True,
+ )
+
+ def make_application_tree(self, kind="appimage"):
+ temporary = tempfile.TemporaryDirectory()
+ root = Path(temporary.name)
+ executables = ["wsjtx", "jt9", "qmap", "map65", "ft8code"]
+ if kind == "appimage":
+ executables.append("wsprd")
+ for executable in executables:
+ path = root / "usr/bin" / executable
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.touch(mode=0o755)
+ for relative in (
+ "usr/share/wsjtx/ALLCALL7.TXT",
+ "usr/share/wsjtx/CALL3.TXT",
+ "usr/share/wsjtx/sounds/Message.wav",
+ "usr/share/wsjtx/sounds/Testing123.wav",
+ ):
+ path = root / relative
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.touch()
+
+ if kind == "appdir":
+ for relative in (
+ "usr/share/applications/wsjtx.desktop",
+ "usr/share/pixmaps/wsjtx_icon.png",
+ ):
+ path = root / relative
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.touch()
+ else:
+ qt_conf = root / "usr/bin/qt.conf"
+ qt_conf.write_text("[Paths]\nPlugins = plugins\n", encoding="utf-8")
+ for relative in (
+ "usr/plugins/platforms/libqxcb.so",
+ "usr/plugins/sqldrivers/libqsqlite.so",
+ "usr/plugins/audio/libqtaudio_alsa.so",
+ "usr/lib/libQt5Core.so.5",
+ "usr/lib/libQt5Widgets.so.5",
+ "usr/lib/libQt5Multimedia.so.5",
+ ):
+ path = root / relative
+ path.parent.mkdir(parents=True, exist_ok=True)
+ path.touch()
+ return temporary, root
+
+ def test_package_manifest_accepts_expected_payload(self):
+ manifest = "\n".join(
+ (
+ "/usr/bin/wsjtx",
+ "/usr/bin/jt9",
+ "/usr/bin/qmap",
+ "/usr/bin/map65",
+ "/usr/share/wsjtx/ALLCALL7.TXT",
+ "/usr/share/wsjtx/CALL3.TXT",
+ "/usr/share/wsjtx/sounds/Message.wav",
+ "/usr/share/wsjtx/sounds/Testing123.wav",
+ )
+ )
+ result = self.run_helper(
+ 'validate_linux_package_manifest "$MANIFEST" fixture', MANIFEST=manifest
+ )
+ self.assertEqual(result.returncode, 0, result.stderr)
+
+ def test_package_manifest_rejects_missing_executable_data_or_sound(self):
+ required = [
+ "/usr/bin/wsjtx",
+ "/usr/bin/jt9",
+ "/usr/bin/qmap",
+ "/usr/bin/map65",
+ "/usr/share/wsjtx/ALLCALL7.TXT",
+ "/usr/share/wsjtx/CALL3.TXT",
+ "/usr/share/wsjtx/sounds/Message.wav",
+ "/usr/share/wsjtx/sounds/Testing123.wav",
+ ]
+ for missing in (
+ "/usr/bin/map65",
+ "/usr/share/wsjtx/ALLCALL7.TXT",
+ "/usr/share/wsjtx/sounds/Message.wav",
+ ):
+ with self.subTest(missing=missing):
+ manifest = "\n".join(path for path in required if path != missing)
+ result = self.run_helper(
+ 'validate_linux_package_manifest "$MANIFEST" fixture',
+ MANIFEST=manifest,
+ )
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn(missing, result.stderr)
+
+ def test_package_manifest_rejects_executable_adjacent_sounds(self):
+ manifest = "\n".join(
+ (
+ "/usr/bin/wsjtx",
+ "/usr/bin/jt9",
+ "/usr/bin/qmap",
+ "/usr/bin/map65",
+ "/usr/bin/sounds/Message.wav",
+ "/usr/share/wsjtx/ALLCALL7.TXT",
+ "/usr/share/wsjtx/CALL3.TXT",
+ "/usr/share/wsjtx/sounds/Message.wav",
+ "/usr/share/wsjtx/sounds/Testing123.wav",
+ )
+ )
+ result = self.run_helper(
+ 'validate_linux_package_manifest "$MANIFEST" fixture', MANIFEST=manifest
+ )
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("/usr/bin/sounds", result.stderr)
+
+ def test_application_layout_rejects_missing_executable_data_or_sound(self):
+ for relative in (
+ "usr/bin/map65",
+ "usr/share/wsjtx/ALLCALL7.TXT",
+ "usr/share/wsjtx/sounds/Message.wav",
+ ):
+ with self.subTest(relative=relative):
+ temporary, root = self.make_application_tree("appdir")
+ self.addCleanup(temporary.cleanup)
+ (root / relative).unlink()
+ result = self.run_helper(
+ 'validate_linux_application_layout "$TREE" appdir', TREE=root
+ )
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn(str(root / relative), result.stderr)
+
+ def test_application_layout_rejects_executable_adjacent_sounds(self):
+ temporary, root = self.make_application_tree("appdir")
+ self.addCleanup(temporary.cleanup)
+ (root / "usr/bin/sounds").mkdir()
+ result = self.run_helper(
+ 'validate_linux_application_layout "$TREE" appdir', TREE=root
+ )
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("usr/bin/sounds", result.stderr)
+
+ def test_appimage_layout_requires_qt_runtime_payload(self):
+ for relative in (
+ "usr/bin/qt.conf",
+ "usr/plugins/platforms/libqxcb.so",
+ "usr/plugins/sqldrivers/libqsqlite.so",
+ "usr/plugins/audio/libqtaudio_alsa.so",
+ "usr/lib/libQt5Core.so.5",
+ ):
+ with self.subTest(relative=relative):
+ temporary, root = self.make_application_tree()
+ self.addCleanup(temporary.cleanup)
+ (root / relative).unlink()
+ result = self.run_helper(
+ 'validate_linux_application_layout "$TREE" appimage', TREE=root
+ )
+ self.assertNotEqual(result.returncode, 0)
+
+ def test_armhf_elf_metadata_accepts_eabi5_hard_float_loader(self):
+ result = self.run_helper(
+ 'validate_elf_metadata armhf fixture "$FILE_OUT" "$HEADER_OUT" "$PROGRAM_OUT"',
+ FILE_OUT=(
+ "fixture: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 "
+ "(SYSV), dynamically linked"
+ ),
+ HEADER_OUT=(
+ "Class: ELF32\nMachine: ARM\n"
+ "Flags: 0x5000400, Version5 EABI, hard-float ABI"
+ ),
+ PROGRAM_OUT=(
+ "INTERP 0x000174 [Requesting program interpreter: "
+ "/lib/ld-linux-armhf.so.3]"
+ ),
+ )
+ self.assertEqual(result.returncode, 0, result.stderr)
+
+ def test_armhf_elf_metadata_rejects_wrong_abi_properties(self):
+ good = {
+ "FILE_OUT": (
+ "fixture: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 "
+ "(SYSV), dynamically linked"
+ ),
+ "HEADER_OUT": (
+ "Class: ELF32\nMachine: ARM\n"
+ "Flags: 0x5000400, Version5 EABI, hard-float ABI"
+ ),
+ "PROGRAM_OUT": (
+ "INTERP 0x000174 [Requesting program interpreter: "
+ "/lib/ld-linux-armhf.so.3]"
+ ),
+ }
+ mutations = {
+ "class": {"HEADER_OUT": good["HEADER_OUT"].replace("ELF32", "ELF64")},
+ "machine": {
+ "HEADER_OUT": good["HEADER_OUT"].replace("Machine: ARM", "Machine: X86-64")
+ },
+ "eabi": {"HEADER_OUT": good["HEADER_OUT"].replace("Version5", "Version4")},
+ "hard_float": {
+ "HEADER_OUT": good["HEADER_OUT"].replace("hard-float", "soft-float")
+ },
+ "loader": {"PROGRAM_OUT": good["PROGRAM_OUT"].replace("armhf", "arm")},
+ }
+ for fault, mutation in mutations.items():
+ with self.subTest(fault=fault):
+ environment = good | mutation
+ result = self.run_helper(
+ 'validate_elf_metadata armhf fixture "$FILE_OUT" "$HEADER_OUT" "$PROGRAM_OUT"',
+ **environment,
+ )
+ self.assertNotEqual(result.returncode, 0)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_linux_ccache_policy.py b/.github/scripts/tests/test_linux_ccache_policy.py
new file mode 100644
index 00000000..42c97e01
--- /dev/null
+++ b/.github/scripts/tests/test_linux_ccache_policy.py
@@ -0,0 +1,99 @@
+import pathlib
+import unittest
+
+
+REPOSITORY = pathlib.Path(__file__).resolve().parents[3]
+
+
+class LinuxCcachePolicyTests(unittest.TestCase):
+ def read(self, relative_path):
+ return (REPOSITORY / relative_path).read_text(encoding="utf-8")
+
+ def assert_cache_tiers(self, text, prefix):
+ primary = (
+ f"{prefix}${{{{ steps.image.outputs.ccache_compatibility_id }}}}-"
+ "${{ steps.image.outputs.generation }}-${{ github.sha }}"
+ "${{ steps.ccache-key.outputs.suffix }}"
+ )
+ generation = (
+ f"{prefix}${{{{ steps.image.outputs.ccache_compatibility_id }}}}-"
+ "${{ steps.image.outputs.generation }}-"
+ )
+ compatible = (
+ f"{prefix}${{{{ steps.image.outputs.ccache_compatibility_id }}}}-"
+ )
+ self.assertIn(f"key: {primary}", text)
+ generation_index = text.index(f" {generation}")
+ compatible_index = text.index(f" {compatible}", generation_index + 1)
+ self.assertLess(generation_index, compatible_index)
+
+ def test_normal_cache_prefers_current_image_generation(self):
+ action = self.read(".github/actions/build-linux-payload/action.yml")
+ self.assert_cache_tiers(action, "ccache-linux-${{ inputs.arch }}-")
+ self.assertIn(
+ 'export CCACHE_COMPILERCHECK="${{ steps.image.outputs.ccache_compiler_check }}"',
+ action,
+ )
+ self.assertIn('if: inputs.runtime_base == \'host\'', action)
+ self.assertIn('echo "CC=gcc"', action)
+ self.assertIn('echo "CXX=g++"', action)
+ self.assertIn(
+ "if: inputs.save_ccache == 'true' && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true'",
+ action,
+ )
+
+ def test_sanitizer_cache_keeps_profile_and_generation(self):
+ action = self.read(".github/actions/build-linux-sanitizers/action.yml")
+ self.assert_cache_tiers(
+ action,
+ "ccache-linux-x86_64-${{ steps.sanitizer.outputs.cache_key }}-",
+ )
+ self.assertIn(
+ 'export CCACHE_COMPILERCHECK="${{ steps.image.outputs.ccache_compiler_check }}"',
+ action,
+ )
+ self.assertIn(
+ "if: inputs.save_ccache == 'true' && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true'",
+ action,
+ )
+
+ def test_armhf_verifies_and_forwards_cache_identity(self):
+ workflow = self.read(".github/workflows/build-linux.yml")
+ self.assert_cache_tiers(workflow, "ccache-linux-armhf-")
+ self.assertIn(
+ "verify-armhf-ci-image.sh cross-builder armhf", workflow
+ )
+ self.assertIn("verify-armhf-ci-image.sh runtime armhf", workflow)
+ self.assertIn(
+ "CROSS_BUILDER_IMAGE: ${{ needs.resolve-image.outputs.cross_image_reference }}",
+ workflow,
+ )
+ self.assertEqual(
+ workflow.count(
+ "RUNTIME_IMAGE: ${{ needs.resolve-image.outputs.image_reference }}"
+ ),
+ 2,
+ )
+ self.assertIn("build-linux-armhf-cross.sh", workflow)
+ self.assertIn("validate-linux-armhf-runtime.sh", workflow)
+ self.assertIn("HAMLIB_BRANCH: ${{ inputs.hamlib_branch }}", workflow)
+ self.assertIn("CCACHE_COMPILERCHECK: ${{ steps.image.outputs.ccache_compiler_check }}", workflow)
+ self.assertIn("-e CCACHE_COMPILERCHECK", workflow)
+ self.assertIn("-e WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH", workflow)
+ self.assertIn("cross_recipe_match", workflow)
+ self.assertIn("runtime_recipe_match", workflow)
+ self.assertIn(
+ "if: inputs.save_ccache && steps.image.outputs.recipe_match == 'true' && steps.ccache.outputs.cache-hit != 'true'",
+ workflow,
+ )
+
+ def test_release_accepts_separately_promoted_armhf_recipe(self):
+ workflow = self.read(".github/workflows/release.yml")
+ armhf_job = workflow.split(" linux-armhf:\n", 1)[1].split(
+ "\n windows:\n", 1
+ )[0]
+ self.assertIn("allow_stale_image: true", armhf_job)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_linux_image_publication_policy.py b/.github/scripts/tests/test_linux_image_publication_policy.py
new file mode 100644
index 00000000..cb88ac95
--- /dev/null
+++ b/.github/scripts/tests/test_linux_image_publication_policy.py
@@ -0,0 +1,181 @@
+import pathlib
+import re
+import unittest
+
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+PUBLISH = (ROOT / ".github/workflows/publish-linux-ci-images.yml").read_text()
+BUILD = (ROOT / ".github/workflows/build-linux.yml").read_text()
+WARM = (ROOT / ".github/workflows/warm-dependency-caches.yml").read_text()
+CLASSIFIER = (ROOT / ".github/scripts/is-linux-ci-image-input.sh").read_text()
+
+
+def job(name: str) -> str:
+ match = re.search(
+ rf"^ {re.escape(name)}:\n(?P<body>.*?)(?=^ [a-z][a-z0-9-]*:\n|\Z)",
+ PUBLISH,
+ re.MULTILINE | re.DOTALL,
+ )
+ if not match:
+ raise AssertionError(f"job not found: {name}")
+ return match.group("body")
+
+
+class LinuxImagePublicationPolicyTests(unittest.TestCase):
+ def test_public_release_publication_is_tag_scoped_and_complete(self):
+ validate = job("validate-inputs")
+ self.assertIn('[ "$REQUEST_REPOSITORY" != WSJTX/wsjtx ]', validate)
+ self.assertIn("^refs/tags/v[0-9]+\\.[0-9]+\\.[0-9]+", validate)
+ self.assertIn('[ "$PROMOTE" != false ]', validate)
+ self.assertIn('[ "$IMAGE_SET" != normal ]', validate)
+ self.assertIn('[ "$INCLUDE_ARMHF" != true ]', validate)
+
+ def test_public_release_images_use_release_tag_and_public_package_root(self):
+ metadata = job("metadata")
+ public_block = re.search(
+ r'if \[ "\$PUBLICATION_TARGET" = public-release \]; then(?P<body>.*?)else',
+ metadata,
+ re.DOTALL,
+ ).group("body")
+ self.assertIn(
+ 'release-${GITHUB_REF_NAME}-${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}',
+ public_block,
+ )
+ self.assertIn("package_root=ghcr.io/wsjtx/wsjtx", public_block)
+ self.assertNotIn(":stable", public_block)
+ self.assertIn("type=gha", public_block)
+ self.assertEqual(
+ PUBLISH.count(
+ "labels: ${{ inputs.publication_target == 'public-release' && 'org.opencontainers.image.source=https://github.com/WSJTX/wsjtx' || '' }}"
+ ),
+ 5,
+ )
+
+ def test_reusable_publisher_exports_all_release_image_digests(self):
+ self.assertIn("x86_64_digest:", PUBLISH)
+ self.assertIn("value: ${{ jobs.build-normal.outputs.digest }}", PUBLISH)
+ self.assertIn("aarch64_digest:", PUBLISH)
+ self.assertIn("value: ${{ jobs.build-arm64.outputs.digest }}", PUBLISH)
+ self.assertIn("armhf_digest:", PUBLISH)
+ self.assertIn("value: ${{ jobs.build-armhf-runtime.outputs.digest }}", PUBLISH)
+ self.assertIn("armhf_cross_digest:", PUBLISH)
+ self.assertIn("value: ${{ jobs.build-armhf-cross.outputs.digest }}", PUBLISH)
+
+ def test_public_release_builds_require_and_consume_digest_references(self):
+ self.assertIn("^sha256:[0-9a-f]{64}$", BUILD)
+ self.assertIn("public-release images require an immutable sha256 digest", BUILD)
+ self.assertIn(
+ 'image_reference=${package_root}/${package}@${IMAGE_DIGEST}', BUILD
+ )
+ self.assertIn(
+ 'cross_image_reference=${package_root}/${cross_package}@${ARMHF_CROSS_IMAGE_DIGEST}',
+ BUILD,
+ )
+ self.assertEqual(
+ BUILD.count("image: ${{ needs.resolve-image.outputs.image_reference }}"), 2
+ )
+ self.assertIn(
+ "CROSS_BUILDER_IMAGE: ${{ needs.resolve-image.outputs.cross_image_reference }}",
+ BUILD,
+ )
+ self.assertIn(
+ "RUNTIME_IMAGE: ${{ needs.resolve-image.outputs.image_reference }}", BUILD
+ )
+
+ def test_manual_target_mapping_keeps_tsan_independent(self):
+ self.assertRegex(WARM, r"linux\|linux-images\)\n\s+normal_images=true")
+ self.assertRegex(WARM, r"linux-tsan\)\n\s+tsan_images=true")
+ all_case = re.search(r"all\)\n(?P<body>.*?);;", WARM, re.DOTALL).group("body")
+ self.assertIn("enable_all", all_case)
+ self.assertNotIn("tsan_images=true", all_case)
+ self.assertIn("image_set: ${{ needs.detect.outputs.image_set }}", WARM)
+ self.assertRegex(
+ WARM,
+ r'if \[ "\$SCHEDULE" = "17 9 1 \* \*" \][\s\S]*?normal_images=true\s+tsan_images=true',
+ )
+
+ def test_push_selection_uses_tested_profile_classifier(self):
+ self.assertIn('is-linux-ci-image-input.sh --classify "$path"', WARM)
+ self.assertIn("expect_image_set normal ", CLASSIFIER)
+ self.assertIn("expect_image_set tsan ", CLASSIFIER)
+ self.assertIn("expect_image_set normal-and-tsan ", CLASSIFIER)
+ self.assertIn('expect_image_set none "CMake/Sources.cmake"', CLASSIFIER)
+ self.assertIn("armhf-cross-bookworm", CLASSIFIER)
+ self.assertIn("armhf-runtime-bookworm", CLASSIFIER)
+ self.assertIn('include_armhf: true', WARM)
+
+ def test_candidate_warm_uses_exact_tag_and_publishes_without_recache(self):
+ warm = job("warm-normal-ccache")
+ self.assertIn("- build-normal", warm)
+ self.assertIn("uses: ./.github/workflows/build-linux.yml", warm)
+ self.assertIn("image_tag: ${{ needs.metadata.outputs.build_tag }}", warm)
+ self.assertIn("allow_stale_image: false", warm)
+ self.assertIn("recache: false", warm)
+ self.assertIn("save_ccache: true", warm)
+
+ promote = job("promote")
+ self.assertIn("needs.warm-normal-ccache.result == 'success'", promote)
+ self.assertIn("- warm-normal-ccache", promote)
+
+ def test_metadata_loads_only_the_selected_image_cohort(self):
+ metadata = job("metadata")
+ self.assertIn('if [ "$IMAGE_SET" != tsan ]; then', metadata)
+ self.assertIn(". .github/scripts/linux-ci-image-config.sh", metadata)
+ self.assertIn("linux-ci-image-fingerprint.sh armhf-cross-bookworm", metadata)
+ self.assertIn("linux-ci-image-fingerprint.sh armhf-runtime-bookworm", metadata)
+ self.assertIn('if [ "$IMAGE_SET" != normal ]; then', metadata)
+ self.assertIn(". .github/scripts/tsan-linux-deps-config.sh", metadata)
+
+ def test_armhf_images_are_built_and_promoted_as_one_generation(self):
+ cross = job("build-armhf-cross")
+ runtime = job("build-armhf-runtime")
+ promote = job("promote")
+
+ self.assertIn("platforms: linux/amd64", cross)
+ self.assertIn("Dockerfile.armhf-cross", cross)
+ self.assertIn("/usr/local/lib/android /usr/share/dotnet /opt/ghc", cross)
+ self.assertNotIn("/usr/local/lib/android", job("build-normal"))
+ self.assertIn("- build-armhf-cross", runtime)
+ self.assertIn("platforms: linux/arm/v7", runtime)
+ self.assertIn("Dockerfile.armhf-runtime", runtime)
+ self.assertIn(
+ "CROSS_BUILDER_IMAGE=${{ needs.metadata.outputs.package_root }}/"
+ "linux-armhf-cross-bookworm:${{ needs.metadata.outputs.build_tag }}",
+ runtime,
+ )
+ self.assertIn("linux-armhf-cross-bookworm:${VALIDATED_TAG}", promote)
+ self.assertIn("linux-armv7-bookworm:${VALIDATED_TAG}", promote)
+ self.assertIn("linux-armhf-cross-bookworm:stable", promote)
+ self.assertIn("linux-armv7-bookworm:stable", promote)
+
+ def test_publication_mutations_require_develop(self):
+ validate = job("validate-inputs")
+ self.assertIn('[ "$MODE" = rollback ] || [ "$PROMOTE" = true ]', validate)
+ self.assertIn('[ "$REQUEST_REF" != refs/heads/develop ]', validate)
+
+ def test_tsan_only_jobs_and_tag_moves_exclude_normal_images(self):
+ validate = job("validate-inputs")
+ self.assertIn("normal|tsan|normal-and-tsan", validate)
+ self.assertIn('[ "$IMAGE_SET" = tsan ] && [ "$INCLUDE_ARMHF" = true ]', validate)
+ self.assertIn("inputs.image_set == 'tsan'", job("build-tsan"))
+ self.assertIn("inputs.image_set == 'normal'", job("build-normal"))
+ self.assertIn('if [ "$IMAGE_SET" != tsan ]; then', job("promote"))
+ self.assertIn('if [ "$IMAGE_SET" != normal ]; then', job("promote"))
+ self.assertIn('if [ "$IMAGE_SET" != tsan ]; then', job("rollback"))
+ self.assertIn('if [ "$IMAGE_SET" != normal ]; then', job("rollback"))
+
+ def test_rollback_uses_only_explicitly_selected_packages(self):
+ rollback = job("rollback")
+ self.assertNotIn("tsan_available", rollback)
+ self.assertNotIn("armhf_available", rollback)
+ self.assertIn("packages+=(linux-noble linux-arm64-bookworm)", rollback)
+ self.assertIn(
+ "packages+=(linux-armhf-cross-bookworm linux-armv7-bookworm)",
+ rollback,
+ )
+ self.assertIn("packages+=(linux-tsan-noble)", rollback)
+ self.assertIn("stable_packages+=(linux-noble)", rollback)
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_release_policy.py b/.github/scripts/tests/test_release_policy.py
new file mode 100644
index 00000000..a7929484
--- /dev/null
+++ b/.github/scripts/tests/test_release_policy.py
@@ -0,0 +1,383 @@
+import importlib.util
+import json
+import io
+import shutil
+import subprocess
+import sys
+import tarfile
+import tempfile
+import unittest
+import zipfile
+from pathlib import Path
+
+
+SCRIPT = Path(__file__).parents[1] / "release-policy.py"
+SPEC = importlib.util.spec_from_file_location("release_policy", SCRIPT)
+release_policy = importlib.util.module_from_spec(SPEC)
+assert SPEC.loader
+SPEC.loader.exec_module(release_policy)
+
+
+class ReleasePolicyTest(unittest.TestCase):
+ def test_classifies_ga_and_rc(self):
+ self.assertEqual(release_policy.classify("3.2.0")["channel"], "GA")
+ identity = release_policy.classify("3.2.0-rc2")
+ self.assertEqual(identity["channel"], "RC")
+ self.assertEqual(identity["rc_number"], "2")
+ self.assertEqual(identity["release_branch"], "release/3.2")
+
+ def test_rejects_non_release_versions(self):
+ for version in ("v3.2.0", "3.2.0-beta1", "3.2", "3.2.0-rc0"):
+ with self.subTest(version=version), self.assertRaises(ValueError):
+ release_policy.classify(version)
+
+ def test_validates_tracked_release_state(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ (root / "release-state.txt").write_text(
+ "version=3.2.0\n"
+ "channel=RC\n"
+ "rc=1\n"
+ "revision=$Format:%H$\n"
+ )
+ identity = release_policy.validate_source(root, "3.2.0-rc1")
+ self.assertEqual(identity["channel"], "RC")
+ self.assertEqual(identity["windows_signing"], "signpath")
+ with self.assertRaisesRegex(ValueError, "release channel"):
+ release_policy.validate_source(root, "3.2.0")
+ (root / "release-state.txt").write_text(
+ "version=3.2.0\nchannel=RC\nrc=1\nrevision=" + "a" * 40 + "\n"
+ )
+ with self.assertRaisesRegex(ValueError, "revision"):
+ release_policy.validate_source(root, "3.2.0-rc1")
+
+ def test_read_state_cli_accepts_single_digit_rc(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ (root / "release-state.txt").write_text(
+ "version=3.2.0\n"
+ "channel=RC\n"
+ "rc=1\n"
+ "revision=$Format:%H$\n"
+ )
+ result = subprocess.run(
+ [sys.executable, SCRIPT, "read-state", "--root", root],
+ check=True,
+ capture_output=True,
+ text=True,
+ )
+ self.assertEqual(
+ json.loads(result.stdout),
+ {
+ "version": "3.2.0",
+ "channel": "RC",
+ "rc": "1",
+ "revision": "$Format:%H$",
+ "windows_signing": "signpath",
+ },
+ )
+
+ (root / "release-state.txt").write_text(
+ "version=3.2.0\n"
+ "channel=RC\n"
+ "rc=1beta\n"
+ "revision=$Format:%H$\n"
+ )
+ result = subprocess.run(
+ [sys.executable, SCRIPT, "read-state", "--root", root],
+ capture_output=True,
+ text=True,
+ )
+ self.assertNotEqual(result.returncode, 0)
+ self.assertIn("positive RC number", result.stderr)
+
+ def test_source_pins_unsigned_mode_and_rejects_unknown_mode(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ state = (
+ "version=3.2.0\nchannel=RC\nrc=1\n"
+ "revision=$Format:%H$\nwindows_signing=unsigned\n"
+ )
+ (root / "release-state.txt").write_text(state)
+ self.assertEqual(
+ release_policy.validate_source(root, "3.2.0-rc1")["windows_signing"],
+ "unsigned",
+ )
+ archive = root / "source.zip"
+ commit = "c" * 40
+ with zipfile.ZipFile(archive, "w") as output:
+ output.writestr(
+ "wsjtx-3.2.0-rc1/release-state.txt",
+ state.replace("$Format:%H$", commit),
+ )
+ release_policy.validate_archive(archive, "3.2.0-rc1", commit)
+ with self.assertRaisesRegex(ValueError, "windows_signing"):
+ release_policy.parse_state(state.replace("unsigned", "ephemeral"))
+
+ def test_validates_exported_tar_and_zip_identity(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ commit = "b" * 40
+ state = f"version=3.2.0\nchannel=RC\nrc=1\nrevision={commit}\n".encode()
+ tar_path = root / "source.tar.gz"
+ with tarfile.open(tar_path, "w:gz") as archive:
+ info = tarfile.TarInfo("wsjtx-3.2.0-rc1/release-state.txt")
+ info.size = len(state)
+ archive.addfile(info, io.BytesIO(state))
+ zip_path = root / "source.zip"
+ with zipfile.ZipFile(zip_path, "w") as archive:
+ archive.writestr("wsjtx-3.2.0-rc1/release-state.txt", state)
+ release_policy.validate_archive(tar_path, "3.2.0-rc1", commit)
+ release_policy.validate_archive(zip_path, "3.2.0-rc1", commit)
+ with self.assertRaisesRegex(ValueError, "revision"):
+ release_policy.validate_archive(tar_path, "3.2.0-rc1", "c" * 40)
+
+ def test_distribution_gate_rejects_unsigned_package(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ version = "3.2.0-rc1"
+ for name in release_policy.expected_assets(version, True):
+ target = root / name
+ target.mkdir()
+ suffix = ".pkg" if "macOS" in name else ".AppImage" if "linux" in name else ".exe"
+ (target / f"artifact{suffix}").write_bytes(b"signed")
+ (root / "extra").mkdir()
+ (root / "extra" / "unexpected-unsigned.pkg").write_bytes(b"unsigned")
+ with self.assertRaisesRegex(ValueError, "unsigned macOS"):
+ release_policy.find_asset_files(root, version, True)
+
+ def test_manifest_binds_assets_to_tag_and_commit(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ version = "3.2.0"
+ for name in release_policy.expected_assets(version, True):
+ target = root / name
+ target.mkdir()
+ suffix = ".pkg" if "macOS" in name else ".AppImage" if "linux" in name else ".exe"
+ (target / f"{name}{suffix}" if not name.endswith(suffix) else target / name).write_bytes(name.encode())
+ for arch in ("x86_64", "aarch64", "armhf"):
+ for package_type in ("deb", "rpm"):
+ target = root / f"wsjtx-{version}-linux-{arch}-{package_type}"
+ target.mkdir()
+ (target / f"wsjtx-{arch}.{package_type}").write_bytes(arch.encode())
+ (root / f"wsjtx-{version}-src.tar.gz").write_bytes(b"source")
+ args = type("Args", (), {
+ "artifacts": str(root), "version": version, "repository": "WSJTX/wsjtx",
+ "commit": "a" * 40, "run_id": "123",
+ "linux_x86_64_digest": "sha256:" + "1" * 64,
+ "linux_aarch64_digest": "sha256:" + "2" * 64,
+ "linux_armhf_cross_digest": "sha256:" + "3" * 64,
+ "linux_armhf_digest": "sha256:" + "4" * 64,
+ "macos_mode": "distribution",
+ "windows_mode": "signpath",
+ })()
+ release_policy.write_manifest(args)
+ manifest = json.loads((root / "release-manifest.json").read_text())
+ self.assertEqual(manifest["tag"], "v3.2.0")
+ self.assertEqual(manifest["commit"], "a" * 40)
+ self.assertEqual(manifest["linux_builders"]["armhf_cross"], "sha256:" + "3" * 64)
+ self.assertEqual(manifest["linux_builders"]["armhf_runtime"], "sha256:" + "4" * 64)
+ self.assertEqual(manifest["macos_signing"]["mode"], "distribution")
+ self.assertEqual(manifest["macos_signing"]["replaceable_assets"], [])
+ self.assertEqual(manifest["windows_signing"]["mode"], "signpath")
+ self.assertEqual(len(manifest["assets"]), 13)
+
+ def test_manual_macos_assets_keep_release_names_without_immutable_hashes(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ version = "3.2.0"
+ for name in release_policy.public_expected_assets(version, "validation"):
+ target = root / name
+ target.mkdir()
+ if "macOS" in name:
+ filename = name.replace("-unsigned", "")
+ elif "linux" in name:
+ filename = f"{name}.AppImage"
+ else:
+ filename = "wsjtx-win64.exe"
+ (target / filename).write_bytes(name.encode())
+ for arch in ("x86_64", "aarch64", "armhf"):
+ for package_type in ("deb", "rpm"):
+ target = root / f"wsjtx-{version}-linux-{arch}-{package_type}"
+ target.mkdir()
+ (target / f"wsjtx-{arch}.{package_type}").write_bytes(arch.encode())
+ (root / f"wsjtx-{version}-src.tar.gz").write_bytes(b"source")
+ args = type("Args", (), {
+ "artifacts": str(root), "version": version, "repository": "WSJTX/wsjtx",
+ "commit": "a" * 40, "run_id": "123",
+ "linux_x86_64_digest": "sha256:" + "1" * 64,
+ "linux_aarch64_digest": "sha256:" + "2" * 64,
+ "linux_armhf_cross_digest": "sha256:" + "3" * 64,
+ "linux_armhf_digest": "sha256:" + "4" * 64,
+ "macos_mode": "validation",
+ "windows_mode": "signpath",
+ })()
+
+ release_policy.write_manifest(args)
+
+ manifest = json.loads((root / "release-manifest.json").read_text())
+ replaceable = {
+ f"wsjtx-{version}-arm64-macOS.pkg",
+ f"wsjtx-{version}-x86_64-macOS.pkg",
+ }
+ release_names = {path.name for path in release_policy.release_files(root, version, "validation")}
+ immutable_names = {entry["name"] for entry in manifest["assets"]}
+ checksum_names = {
+ line.split(" ", 1)[1]
+ for line in (root / "SHA256SUMS").read_text().splitlines()
+ }
+ self.assertEqual(manifest["macos_signing"]["mode"], "manual")
+ self.assertEqual(set(manifest["macos_signing"]["replaceable_assets"]), replaceable)
+ self.assertTrue(replaceable <= release_names)
+ self.assertTrue(replaceable.isdisjoint(immutable_names))
+ self.assertTrue(replaceable.isdisjoint(checksum_names))
+ self.assertIn("wsjtx-win64.exe", immutable_names)
+
+ def test_unsigned_windows_manifest_selects_and_hashes_installer(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ version = "3.2.0-rc1"
+ for name in release_policy.public_expected_assets(version, "validation", "unsigned"):
+ target = root / name
+ target.mkdir()
+ if "macOS" in name:
+ filename = name.replace("-unsigned", "")
+ elif "linux" in name:
+ filename = f"{name}.AppImage"
+ else:
+ filename = f"wsjtx-{version}-win64.exe"
+ (target / filename).write_bytes(name.encode())
+ for arch in ("x86_64", "aarch64", "armhf"):
+ for package_type in ("deb", "rpm"):
+ target = root / f"wsjtx-{version}-linux-{arch}-{package_type}"
+ target.mkdir()
+ (target / f"wsjtx-{arch}.{package_type}").write_bytes(arch.encode())
+ (root / f"wsjtx-{version}-src.tar.gz").write_bytes(b"source")
+ args = type("Args", (), {
+ "artifacts": str(root), "version": version, "repository": "WSJTX/wsjtx",
+ "commit": "a" * 40, "run_id": "123",
+ "linux_x86_64_digest": "sha256:" + "1" * 64,
+ "linux_aarch64_digest": "sha256:" + "2" * 64,
+ "linux_armhf_cross_digest": "sha256:" + "3" * 64,
+ "linux_armhf_digest": "sha256:" + "4" * 64,
+ "macos_mode": "validation", "windows_mode": "unsigned",
+ })()
+ release_policy.write_manifest(args)
+ manifest = json.loads((root / "release-manifest.json").read_text())
+ installer = f"wsjtx-{version}-win64.exe"
+ self.assertEqual(manifest["windows_signing"]["mode"], "unsigned")
+ self.assertIn(installer, {entry["name"] for entry in manifest["assets"]})
+ self.assertIn(installer, (root / "SHA256SUMS").read_text())
+ installer_path = root / f"wsjtx-{version}-windows-x86_64-installer" / installer
+ installer_path.rename(installer_path.with_name("unexpected.exe"))
+ with self.assertRaisesRegex(ValueError, "unexpected unsigned Windows installer"):
+ release_policy.find_public_asset_files(root, version, "validation", "unsigned")
+ installer_path.with_name("unexpected.exe").rename(installer_path)
+ signed_dir = root / f"wsjtx-{version}-windows-x86_64-installer-signed"
+ signed_dir.mkdir()
+ with self.assertRaisesRegex(ValueError, "signed Windows installer"):
+ release_policy.find_public_asset_files(root, version, "validation", "unsigned")
+
+ def test_signing_reports_bind_hashes_and_source(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ version = "3.2.0-rc1"
+ commit = "b" * 40
+ tag = f"v{version}"
+ for arch in ("arm64", "x86_64"):
+ package_dir = root / f"wsjtx-{version}-{arch}-macOS.pkg"
+ package_dir.mkdir()
+ package = package_dir / f"wsjtx-{version}-{arch}-macOS.pkg"
+ package.write_bytes(arch.encode())
+ report_dir = root / f"macos-signing-report-{version}-{arch}"
+ report_dir.mkdir()
+ (report_dir / "macos-signing-report.json").write_text(json.dumps({
+ "mode": "distribution", "git_sha": commit, "artifact": package.name,
+ "sha256": release_policy.hash_file(package), "notarization": {"status": "Accepted"},
+ "stapled": True, "gatekeeper_accepted": True, "team_id": "ABCDE12345",
+ "application_certificate_sha1": "A" * 40,
+ "installer_certificate_sha1": "B" * 40,
+ }))
+ installer_dir = root / f"wsjtx-{version}-windows-x86_64-installer-signed"
+ installer_dir.mkdir()
+ installer = installer_dir / "wsjtx.exe"
+ installer.write_bytes(b"windows")
+ request_dir = root / f"wsjtx-{version}-windows-signing-request"
+ request_dir.mkdir()
+ (request_dir / "request.json").write_text(json.dumps({
+ "policy": "release-signing", "commit": commit, "tag": tag,
+ }))
+ verification_dir = root / f"wsjtx-{version}-windows-signing-verification"
+ verification_dir.mkdir()
+ (verification_dir / "verification.json").write_text(json.dumps({
+ "commit": commit, "tag": tag, "artifact": installer.name,
+ "sha256": release_policy.hash_file(installer), "status": "Valid",
+ "timestamp_thumbprint": "1234", "signer_subject": "WSJT-X",
+ "signer_thumbprint": "5678", "identity_verified": True,
+ }))
+ release_policy.verify_signing_reports(root, version, commit, tag)
+ (verification_dir / "verification.json").write_text("{}")
+ with self.assertRaisesRegex(ValueError, "release ref"):
+ release_policy.verify_signing_reports(root, version, commit, tag)
+
+ def test_validation_reports_allow_unsigned_macos_with_signed_windows(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ version = "3.2.0-rc1"
+ commit = "b" * 40
+ tag = f"v{version}"
+ for arch in ("arm64", "x86_64"):
+ package_dir = root / f"wsjtx-{version}-{arch}-macOS-unsigned.pkg"
+ package_dir.mkdir()
+ package = package_dir / f"wsjtx-{version}-{arch}-macOS.pkg"
+ package.write_bytes(arch.encode())
+ report_dir = root / f"macos-signing-report-{version}-{arch}"
+ report_dir.mkdir()
+ (report_dir / "macos-signing-report.json").write_text(json.dumps({
+ "mode": "validation", "git_sha": commit, "artifact": package.name,
+ "sha256": release_policy.hash_file(package), "signed": False,
+ "notarized": False, "publishable": False,
+ }))
+ installer_dir = root / f"wsjtx-{version}-windows-x86_64-installer-signed"
+ installer_dir.mkdir()
+ installer = installer_dir / "wsjtx.exe"
+ installer.write_bytes(b"windows")
+ request_dir = root / f"wsjtx-{version}-windows-signing-request"
+ request_dir.mkdir()
+ (request_dir / "request.json").write_text(json.dumps({
+ "policy": "release-signing", "commit": commit, "tag": tag,
+ }))
+ verification_dir = root / f"wsjtx-{version}-windows-signing-verification"
+ verification_dir.mkdir()
+ (verification_dir / "verification.json").write_text(json.dumps({
+ "commit": commit, "tag": tag, "artifact": installer.name,
+ "sha256": release_policy.hash_file(installer), "status": "Valid",
+ "timestamp_thumbprint": "1234", "signer_subject": "WSJT-X",
+ "signer_thumbprint": "5678", "identity_verified": True,
+ }))
+
+ release_policy.verify_signing_reports(root, version, commit, tag, "validation")
+
+ report = json.loads(
+ (root / f"macos-signing-report-{version}-arm64" / "macos-signing-report.json").read_text()
+ )
+ report["signed"] = True
+ (root / f"macos-signing-report-{version}-arm64" / "macos-signing-report.json").write_text(
+ json.dumps(report)
+ )
+ with self.assertRaisesRegex(ValueError, "unsigned package"):
+ release_policy.verify_signing_reports(root, version, commit, tag, "validation")
+
+ report["signed"] = False
+ (root / f"macos-signing-report-{version}-arm64" / "macos-signing-report.json").write_text(
+ json.dumps(report)
+ )
+ with self.assertRaisesRegex(ValueError, "Windows signing report"):
+ release_policy.verify_signing_reports(root, version, commit, tag, "validation", "unsigned")
+ shutil.rmtree(request_dir)
+ shutil.rmtree(verification_dir)
+ release_policy.verify_signing_reports(root, version, commit, tag, "validation", "unsigned")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_resolve_linux_ci_image_tag.py b/.github/scripts/tests/test_resolve_linux_ci_image_tag.py
new file mode 100755
index 00000000..b8a3c1bd
--- /dev/null
+++ b/.github/scripts/tests/test_resolve_linux_ci_image_tag.py
@@ -0,0 +1,125 @@
+#!/usr/bin/env python3
+
+import importlib.util
+import sys
+import unittest
+from datetime import datetime, timezone
+from pathlib import Path
+
+
+SCRIPT = Path(__file__).parents[1] / "resolve-linux-ci-image-tag.py"
+SPEC = importlib.util.spec_from_file_location("resolve_linux_ci_image_tag", SCRIPT)
+MODULE = importlib.util.module_from_spec(SPEC)
+sys.modules[SPEC.name] = MODULE
+SPEC.loader.exec_module(MODULE)
+
+
+def version(version_id, tags):
+ return MODULE.Version(
+ id=version_id,
+ digest=f"sha256:{version_id:064x}",
+ created_at=datetime(2026, 8, 18, tzinfo=timezone.utc),
+ tags=tuple(tags),
+ )
+
+
+class FakeClient:
+ def __init__(self, packages):
+ self.packages = packages
+
+ def list_versions(self, owner, package):
+ return self.packages.get(package, [])
+
+
+class ResolveTests(unittest.TestCase):
+ def coherent(self):
+ tag = "build-20260818-123-1"
+ return tag, {
+ package: [
+ version(
+ index,
+ (tag, "stable")
+ if package in (MODULE.NORMAL_PACKAGE, MODULE.ARMHF_PACKAGE)
+ else (tag,),
+ )
+ ]
+ for index, package in enumerate(
+ (
+ MODULE.NORMAL_PACKAGE,
+ *MODULE.ROUTINE_PACKAGES,
+ MODULE.ARMHF_PACKAGE,
+ MODULE.ARMHF_CROSS_PACKAGE,
+ ),
+ start=1,
+ )
+ }
+
+ def test_resolves_build_tag_attached_to_stable_pointer(self):
+ tag, packages = self.coherent()
+ self.assertEqual(MODULE.resolve(FakeClient(packages)), tag)
+
+ def test_rejects_missing_generation_member(self):
+ _, packages = self.coherent()
+ packages[MODULE.ARM64_PACKAGE] = []
+ with self.assertRaisesRegex(RuntimeError, "does not exist"):
+ MODULE.resolve(FakeClient(packages))
+
+ def test_strict_resolution_rejects_missing_armhf(self):
+ _, packages = self.coherent()
+ packages[MODULE.ARMHF_PACKAGE] = []
+ with self.assertRaisesRegex(RuntimeError, "does not exist"):
+ MODULE.resolve(FakeClient(packages), require_armhf=True)
+
+ def test_routine_resolution_does_not_require_armhf(self):
+ tag, packages = self.coherent()
+ packages.pop(MODULE.ARMHF_PACKAGE)
+ self.assertEqual(MODULE.resolve(FakeClient(packages)), tag)
+
+ def test_armhf_resolution_uses_armhf_stable_pointer(self):
+ tag, packages = self.coherent()
+ self.assertEqual(MODULE.resolve_armhf(FakeClient(packages)), tag)
+
+ def test_armhf_resolution_requires_armhf_stable_pointer(self):
+ _, packages = self.coherent()
+ packages[MODULE.ARMHF_PACKAGE] = []
+ with self.assertRaisesRegex(RuntimeError, "armhf.*stable is missing"):
+ MODULE.resolve_armhf(FakeClient(packages))
+
+ def test_armhf_resolution_requires_matching_cross_builder(self):
+ _, packages = self.coherent()
+ packages[MODULE.ARMHF_CROSS_PACKAGE] = []
+ with self.assertRaisesRegex(RuntimeError, "linux-armhf-cross-bookworm"):
+ MODULE.resolve_armhf(FakeClient(packages))
+
+ def test_tsan_resolution_uses_tsan_stable_pointer(self):
+ tag, packages = self.coherent()
+ packages[MODULE.TSAN_PACKAGE] = [version(8, (tag, "stable"))]
+ self.assertEqual(MODULE.resolve_tsan(FakeClient(packages)), tag)
+
+ def test_tsan_resolution_requires_tsan_stable_pointer(self):
+ _, packages = self.coherent()
+ packages[MODULE.TSAN_PACKAGE] = []
+ with self.assertRaisesRegex(RuntimeError, "TSan.*stable is missing"):
+ MODULE.resolve_tsan(FakeClient(packages))
+
+ def test_rejects_ambiguous_stable_pointer(self):
+ _, packages = self.coherent()
+ packages[MODULE.NORMAL_PACKAGE].append(version(9, ("stable",)))
+ with self.assertRaisesRegex(RuntimeError, "expected one"):
+ MODULE.resolve(FakeClient(packages))
+
+ def test_reports_missing_promoted_generation(self):
+ _, packages = self.coherent()
+ packages[MODULE.NORMAL_PACKAGE] = []
+ with self.assertRaisesRegex(RuntimeError, "No promoted Linux CI image generation"):
+ MODULE.resolve(FakeClient(packages))
+
+ def test_rejects_stable_without_build_tag(self):
+ _, packages = self.coherent()
+ packages[MODULE.NORMAL_PACKAGE] = [version(1, ("stable", "candidate-123-1"))]
+ with self.assertRaisesRegex(RuntimeError, "exactly one"):
+ MODULE.resolve(FakeClient(packages))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tests/test_should_refresh_linux_ci_images.py b/.github/scripts/tests/test_should_refresh_linux_ci_images.py
new file mode 100644
index 00000000..0b589dac
--- /dev/null
+++ b/.github/scripts/tests/test_should_refresh_linux_ci_images.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+
+import importlib.util
+import sys
+import unittest
+from datetime import datetime, timedelta, timezone
+from pathlib import Path
+
+
+SCRIPT = Path(__file__).parents[1] / "should-refresh-linux-ci-images.py"
+SPEC = importlib.util.spec_from_file_location("should_refresh_linux_ci_images", SCRIPT)
+MODULE = importlib.util.module_from_spec(SPEC)
+sys.modules[SPEC.name] = MODULE
+SPEC.loader.exec_module(MODULE)
+
+
+def version(version_id, age_days, tags, now):
+ return MODULE.Version(
+ id=version_id,
+ digest=f"sha256:{version_id:064x}",
+ created_at=now - timedelta(days=age_days),
+ tags=tuple(tags),
+ )
+
+
+class RefreshDecisionTests(unittest.TestCase):
+ def setUp(self):
+ self.now = datetime(2026, 8, 25, tzinfo=timezone.utc)
+
+ def test_keeps_recent_stable_image(self):
+ refresh, age_days = MODULE.should_refresh(
+ [version(1, 29, ("stable", "build-20260801-1-1"), self.now)],
+ now=self.now,
+ max_age_days=30,
+ )
+ self.assertFalse(refresh)
+ self.assertEqual(age_days, 29)
+
+ def test_refreshes_old_stable_image(self):
+ refresh, age_days = MODULE.should_refresh(
+ [version(1, 30, ("stable", "build-20260726-1-1"), self.now)],
+ now=self.now,
+ max_age_days=30,
+ )
+ self.assertTrue(refresh)
+ self.assertEqual(age_days, 30)
+
+ def test_rejects_missing_or_ambiguous_stable_image(self):
+ with self.assertRaisesRegex(RuntimeError, "found 0"):
+ MODULE.should_refresh([], now=self.now, max_age_days=30)
+ with self.assertRaisesRegex(RuntimeError, "found 2"):
+ MODULE.should_refresh(
+ [
+ version(1, 1, ("stable",), self.now),
+ version(2, 2, ("stable",), self.now),
+ ],
+ now=self.now,
+ max_age_days=30,
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/scripts/tsan-linux-deps-config.sh b/.github/scripts/tsan-linux-deps-config.sh
new file mode 100755
index 00000000..0f4118f8
--- /dev/null
+++ b/.github/scripts/tsan-linux-deps-config.sh
@@ -0,0 +1,210 @@
+#!/usr/bin/env bash
+
+# Shared, pinned build tuple for Linux ThreadSanitizer dependencies.
+# shellcheck disable=SC2034
+
+TSAN_CACHE_EPOCH=1
+TSAN_RUNTIME_BASE=ubuntu24.04
+TSAN_ARCH=x86_64
+
+TSAN_GCC_SUFFIX=13
+TSAN_GCC_VERSION=13.3.0
+TSAN_CC=gcc-${TSAN_GCC_SUFFIX}
+TSAN_CXX=g++-${TSAN_GCC_SUFFIX}
+TSAN_FC=gfortran-${TSAN_GCC_SUFFIX}
+TSAN_SANITIZER_FLAGS="-fsanitize=thread -fno-omit-frame-pointer -g1 -O1"
+TSAN_LINK_FLAGS="-fsanitize=thread"
+
+TSAN_QT_VERSION=5.15.18
+TSAN_QT_SOURCE_SHA256=cea1fbabf02455f3f0e8eaa839f5d6f45cdb56b62c8a83af5c1d00ac05f912ea
+TSAN_QT_SOURCE_URL="https://download.qt.io/archive/qt/5.15/${TSAN_QT_VERSION}/single/qt-everywhere-opensource-src-${TSAN_QT_VERSION}.tar.xz"
+
+TSAN_BOOST_VERSION=1.83.0
+TSAN_BOOST_SOURCE_SHA256=6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e
+TSAN_BOOST_SOURCE_URL="https://archives.boost.io/release/${TSAN_BOOST_VERSION}/source/boost_1_83_0.tar.bz2"
+
+TSAN_HAMLIB_REF=4.7.2
+TSAN_HAMLIB_COMMIT=40f63488fe0bd751b147f48d62fd217bf53713a0
+TSAN_HAMLIB_PATCH_COMMIT=141e1b19a0e2d65571e5b0783c43ab2615c0cdf7
+
+tsan_config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+
+tsan_sha256_files() {
+ local file digest hashes=
+
+ for file in "$@"; do
+ if [ ! -f "$file" ]; then
+ echo "Cannot hash missing file: $file" >&2
+ return 1
+ fi
+ digest="$(sha256sum "$file" | awk '{print $1}')"
+ hashes+="${digest}"$'\n'
+ done
+ printf '%s' "$hashes" | sha256sum | awk '{print $1}'
+}
+
+tsan_require_toolchain() {
+ local compiler actual_version linker_path
+
+ for compiler in "$TSAN_CC" "$TSAN_CXX" "$TSAN_FC"; do
+ if ! command -v "$compiler" >/dev/null 2>&1; then
+ echo "Pinned TSan compiler not found: $compiler" >&2
+ return 1
+ fi
+ actual_version="$($compiler -dumpfullversion -dumpversion)"
+ if [ "$actual_version" != "$TSAN_GCC_VERSION" ]; then
+ echo "Pinned TSan compiler mismatch for $compiler: expected $TSAN_GCC_VERSION, got $actual_version" >&2
+ return 1
+ fi
+ done
+
+ TSAN_TARGET="$($TSAN_CC -dumpmachine)"
+ TSAN_CC_PATH="$(readlink -f "$(command -v "$TSAN_CC")")"
+ TSAN_CXX_PATH="$(readlink -f "$(command -v "$TSAN_CXX")")"
+ TSAN_FC_PATH="$(readlink -f "$(command -v "$TSAN_FC")")"
+ linker_path="$($TSAN_CC -print-prog-name=ld)"
+ if [[ "$linker_path" != */* ]]; then
+ linker_path="$(command -v "$linker_path")"
+ fi
+ TSAN_LINKER_PATH="$(readlink -f "$linker_path")"
+ TSAN_LIBTSAN_PATH="$(readlink -f "$($TSAN_CC -print-file-name=libtsan.so)")"
+ TSAN_LIBSTDCXX_PATH="$(readlink -f "$($TSAN_CXX -print-file-name=libstdc++.so)")"
+ TSAN_LIBGCC_PATH="$(readlink -f "$($TSAN_CC -print-file-name=libgcc_s.so)")"
+
+ for compiler in \
+ "$TSAN_CC_PATH" "$TSAN_CXX_PATH" "$TSAN_FC_PATH" "$TSAN_LINKER_PATH" \
+ "$TSAN_LIBTSAN_PATH" "$TSAN_LIBSTDCXX_PATH" "$TSAN_LIBGCC_PATH"; do
+ if [ ! -f "$compiler" ]; then
+ echo "Pinned TSan toolchain component not found: $compiler" >&2
+ return 1
+ fi
+ done
+
+ TSAN_GLIBC_VERSION="$(getconf GNU_LIBC_VERSION | tr ' ' '-')"
+ TSAN_COMPILER_SHA256="$(tsan_sha256_files \
+ "$TSAN_CC_PATH" "$TSAN_CXX_PATH" "$TSAN_FC_PATH" "$TSAN_LINKER_PATH")"
+ TSAN_RUNTIME_SHA256="$({
+ printf '%s\n' "$TSAN_GCC_VERSION" "$TSAN_TARGET" "$TSAN_GLIBC_VERSION"
+ sha256sum "$TSAN_LIBTSAN_PATH" "$TSAN_LIBSTDCXX_PATH" "$TSAN_LIBGCC_PATH"
+ } | sha256sum | awk '{print $1}')"
+ TSAN_TOOLCHAIN_ID="gcc${TSAN_GCC_VERSION}-${TSAN_TARGET}-${TSAN_COMPILER_SHA256:0:12}-${TSAN_RUNTIME_SHA256:0:12}"
+}
+
+tsan_dependency_recipe_hash() {
+ local dependency=$1 build_script
+
+ case "$dependency" in
+ qt) build_script=build-qt-tsan-linux.sh ;;
+ boost) build_script=build-boost-tsan-linux.sh ;;
+ hamlib) build_script=build-hamlib-tsan-linux.sh ;;
+ *)
+ echo "Unsupported TSan dependency: $dependency" >&2
+ return 2
+ ;;
+ esac
+
+ tsan_sha256_files \
+ "${tsan_config_dir}/tsan-linux-deps-config.sh" \
+ "${tsan_config_dir}/${build_script}" \
+ "${tsan_config_dir}/verify-tsan-deps-linux.sh"
+}
+
+tsan_dependency_version() {
+ case "$1" in
+ qt) printf '%s\n' "$TSAN_QT_VERSION" ;;
+ boost) printf '%s\n' "$TSAN_BOOST_VERSION" ;;
+ hamlib) printf '%s\n' "$TSAN_HAMLIB_REF" ;;
+ *) return 2 ;;
+ esac
+}
+
+tsan_dependency_source_id() {
+ case "$1" in
+ qt) printf '%s\n' "$TSAN_QT_SOURCE_SHA256" ;;
+ boost) printf '%s\n' "$TSAN_BOOST_SOURCE_SHA256" ;;
+ hamlib) printf '%s+%s\n' "$TSAN_HAMLIB_COMMIT" "$TSAN_HAMLIB_PATCH_COMMIT" ;;
+ *) return 2 ;;
+ esac
+}
+
+tsan_dependency_cache_key() {
+ local dependency=$1 version source_id recipe_hash
+
+ if [ -z "${TSAN_TOOLCHAIN_ID:-}" ]; then
+ tsan_require_toolchain
+ fi
+ version="$(tsan_dependency_version "$dependency")"
+ source_id="$(tsan_dependency_source_id "$dependency")"
+ recipe_hash="$(tsan_dependency_recipe_hash "$dependency")"
+ printf '%s\n' "${dependency}-tsan-linux-${TSAN_ARCH}-${TSAN_RUNTIME_BASE}-${TSAN_TOOLCHAIN_ID}-${version}-${source_id}-epoch${TSAN_CACHE_EPOCH}-${recipe_hash}"
+}
+
+tsan_write_dependency_manifest() {
+ local dependency=$1 prefix=$2 version source_id recipe_hash cache_key manifest
+
+ tsan_require_toolchain
+ version="$(tsan_dependency_version "$dependency")"
+ source_id="$(tsan_dependency_source_id "$dependency")"
+ recipe_hash="$(tsan_dependency_recipe_hash "$dependency")"
+ cache_key="$(tsan_dependency_cache_key "$dependency")"
+ manifest="${prefix}/.wsjtx-tsan-manifest"
+
+ {
+ printf 'schema=%s\n' "$TSAN_CACHE_EPOCH"
+ printf 'dependency=%s\n' "$dependency"
+ printf 'version=%s\n' "$version"
+ printf 'source_id=%s\n' "$source_id"
+ printf 'runtime_base=%s\n' "$TSAN_RUNTIME_BASE"
+ printf 'architecture=%s\n' "$TSAN_ARCH"
+ printf 'compiler=%s\n' "$TSAN_CC"
+ printf 'compiler_version=%s\n' "$TSAN_GCC_VERSION"
+ printf 'compiler_target=%s\n' "$TSAN_TARGET"
+ printf 'compiler_sha256=%s\n' "$TSAN_COMPILER_SHA256"
+ printf 'glibc_version=%s\n' "$TSAN_GLIBC_VERSION"
+ printf 'runtime_sha256=%s\n' "$TSAN_RUNTIME_SHA256"
+ printf 'recipe_sha256=%s\n' "$recipe_hash"
+ printf 'cache_key=%s\n' "$cache_key"
+ printf 'sanitizer_flags=%s\n' "$TSAN_SANITIZER_FLAGS"
+ printf 'link_flags=%s\n' "$TSAN_LINK_FLAGS"
+ } > "$manifest"
+}
+
+tsan_emit_github_output() {
+ if [ -z "${GITHUB_OUTPUT:-}" ]; then
+ echo "GITHUB_OUTPUT is required for --github-output" >&2
+ return 2
+ fi
+
+ tsan_require_toolchain
+ {
+ printf 'cc=%s\n' "$TSAN_CC"
+ printf 'cxx=%s\n' "$TSAN_CXX"
+ printf 'fc=%s\n' "$TSAN_FC"
+ printf 'gcc_version=%s\n' "$TSAN_GCC_VERSION"
+ printf 'toolchain_id=%s\n' "$TSAN_TOOLCHAIN_ID"
+ printf 'qt_key=%s\n' "$(tsan_dependency_cache_key qt)"
+ printf 'boost_key=%s\n' "$(tsan_dependency_cache_key boost)"
+ printf 'hamlib_key=%s\n' "$(tsan_dependency_cache_key hamlib)"
+ printf 'hamlib_ref=%s\n' "$TSAN_HAMLIB_REF"
+ } >> "$GITHUB_OUTPUT"
+}
+
+if [ "${BASH_SOURCE[0]}" = "$0" ]; then
+ set -euo pipefail
+ case "${1:-}" in
+ --github-output)
+ tsan_emit_github_output
+ ;;
+ --print)
+ tsan_require_toolchain
+ printf 'toolchain_id=%s\n' "$TSAN_TOOLCHAIN_ID"
+ printf 'qt_key=%s\n' "$(tsan_dependency_cache_key qt)"
+ printf 'boost_key=%s\n' "$(tsan_dependency_cache_key boost)"
+ printf 'hamlib_key=%s\n' "$(tsan_dependency_cache_key hamlib)"
+ ;;
+ *)
+ echo "Usage: $0 --github-output|--print" >&2
+ exit 2
+ ;;
+ esac
+fi
diff --git a/.github/scripts/validate-ci-inputs.sh b/.github/scripts/validate-ci-inputs.sh
new file mode 100755
index 00000000..e801a6eb
--- /dev/null
+++ b/.github/scripts/validate-ci-inputs.sh
@@ -0,0 +1,177 @@
+#!/usr/bin/env bash
+# Validate CI string inputs passed through environment variables.
+#
+# GitHub Actions expands ${{ }} expressions before the shell parses a
+# `run:` script. Quoting in YAML does not stop command substitution or
+# quote-breaking payloads in those expansions. Callers must pass
+# workflow inputs through `env:` (which is not shell-parsed) and invoke
+# this script before any later step interpolates the same values.
+#
+# Only variables that are set are checked, so each workflow can pass
+# the subset it uses. Empty values are rejected except for
+# WSJT_RC_NUMBER, which is optional.
+#
+# Usage:
+# WSJTX_VERSION=... HAMLIB_BRANCH=... .github/scripts/validate-ci-inputs.sh
+# .github/scripts/validate-ci-inputs.sh --self-test
+
+set -euo pipefail
+
+fail() {
+ echo "::error::$*" >&2
+ exit 1
+}
+
+# POSIX case patterns keep this working on bash 3.2 (macOS) and MSYS2.
+require_nonempty() {
+ if [ -z "$2" ]; then
+ fail "Invalid $1: value must not be empty"
+ fi
+}
+
+require_boolean() {
+ case "$2" in
+ true|false) ;;
+ *) fail "Invalid $1 '$2': use true or false" ;;
+ esac
+}
+
+validate_inputs() {
+ if [ -n "${WSJTX_VERSION+x}" ]; then
+ require_nonempty "version" "$WSJTX_VERSION"
+ case "$WSJTX_VERSION" in
+ *[!A-Za-z0-9._+-]*)
+ fail "Invalid version '${WSJTX_VERSION}': use only letters, numbers, '.', '_', '+', and '-'"
+ ;;
+ esac
+ fi
+
+ if [ -n "${HAMLIB_BRANCH+x}" ]; then
+ require_nonempty "hamlib_branch" "$HAMLIB_BRANCH"
+ case "$HAMLIB_BRANCH" in
+ *[!A-Za-z0-9._/-]*)
+ fail "Invalid hamlib_branch '${HAMLIB_BRANCH}': use only letters, numbers, '.', '_', '/', and '-'"
+ ;;
+ esac
+ fi
+
+ if [ -n "${WSJT_RELEASE_CHANNEL+x}" ]; then
+ case "$WSJT_RELEASE_CHANNEL" in
+ DEVEL|RC|GA) ;;
+ *)
+ fail "Invalid release_channel '${WSJT_RELEASE_CHANNEL}': use DEVEL, RC, or GA"
+ ;;
+ esac
+ fi
+
+ if [ -n "${WSJT_RC_NUMBER+x}" ]; then
+ case "$WSJT_RC_NUMBER" in
+ ''|*[!0-9]*)
+ if [ -n "$WSJT_RC_NUMBER" ]; then
+ fail "Invalid rc_number '${WSJT_RC_NUMBER}': use digits only"
+ fi
+ ;;
+ esac
+ fi
+
+ if [ -n "${ARCH+x}" ]; then
+ case "$ARCH" in
+ x86_64|aarch64|armhf|arm64) ;;
+ *)
+ fail "Invalid arch '${ARCH}': use x86_64, aarch64, armhf, or arm64"
+ ;;
+ esac
+ fi
+
+ if [ -n "${VALIDATE_FORTRAN_FALLBACK+x}" ]; then
+ require_boolean "validate_fortran_fallback" "$VALIDATE_FORTRAN_FALLBACK"
+ fi
+
+ if [ -n "${IMAGE_TAG+x}" ]; then
+ require_nonempty "image_tag" "$IMAGE_TAG"
+ if [ "${#IMAGE_TAG}" -gt 128 ]; then
+ fail "Invalid image_tag: value exceeds the 128-character container tag limit"
+ fi
+ case "$IMAGE_TAG" in
+ *[!A-Za-z0-9._-]*)
+ fail "Invalid image_tag '${IMAGE_TAG}': use a letter or number followed by letters, numbers, '.', '_', or '-'"
+ ;;
+ esac
+ case "$IMAGE_TAG" in
+ [A-Za-z0-9]*) ;;
+ *) fail "Invalid image_tag '${IMAGE_TAG}': the first character must be a letter or number" ;;
+ esac
+ fi
+
+ if [ -n "${DEPLOYMENT_TARGET+x}" ]; then
+ case "$DEPLOYMENT_TARGET" in
+ ''|*[!0-9.]*)
+ fail "Invalid deployment_target '${DEPLOYMENT_TARGET}': use a dotted numeric version such as 10.13 or 11.0"
+ ;;
+ esac
+ fi
+
+ if [ -n "${RUNNER+x}" ]; then
+ require_nonempty "runner" "$RUNNER"
+ case "$RUNNER" in
+ *[!A-Za-z0-9._-]*)
+ fail "Invalid runner '${RUNNER}': use only letters, numbers, '.', '_', and '-'"
+ ;;
+ esac
+ fi
+}
+
+run_isolated() {
+ env -u WSJTX_VERSION -u HAMLIB_BRANCH -u WSJT_RELEASE_CHANNEL \
+ -u WSJT_RC_NUMBER -u ARCH -u IMAGE_TAG -u DEPLOYMENT_TARGET -u RUNNER \
+ -u VALIDATE_FORTRAN_FALLBACK \
+ "$@" "$0"
+}
+
+expect_failure() {
+ local label="$1"
+ shift
+ if run_isolated env "$@" >/dev/null 2>&1; then
+ echo "self-test failed: expected rejection of ${label}" >&2
+ exit 1
+ fi
+}
+
+if [ "${1:-}" = "--self-test" ]; then
+ run_isolated \
+ env WSJTX_VERSION="3.2.0-devel" HAMLIB_BRANCH="4.7.2" \
+ WSJT_RELEASE_CHANNEL="DEVEL" WSJT_RC_NUMBER="" \
+ >/dev/null
+ run_isolated \
+ env WSJTX_VERSION="3.0.1-rc1" HAMLIB_BRANCH="4.7.2" \
+ WSJT_RELEASE_CHANNEL="RC" WSJT_RC_NUMBER="1" \
+ ARCH="x86_64" DEPLOYMENT_TARGET="10.13" RUNNER="macos-15-intel" \
+ IMAGE_TAG="candidate-123-1" \
+ VALIDATE_FORTRAN_FALLBACK="true" \
+ >/dev/null
+ run_isolated env HAMLIB_BRANCH="integration/4.7" VALIDATE_FORTRAN_FALLBACK="false" >/dev/null
+
+ expect_failure 'command substitution in version' WSJTX_VERSION='3.1.0$(id)'
+ expect_failure 'backticks in version' WSJTX_VERSION='3.1.0`id`'
+ expect_failure 'quote break in version' WSJTX_VERSION='3.1.0"; echo pwned #'
+ expect_failure 'command substitution in hamlib_branch' HAMLIB_BRANCH='4.7.2$(touch /tmp/x)'
+ expect_failure 'shell metacharacters in hamlib_branch' HAMLIB_BRANCH='4.7.2; id'
+ expect_failure 'invalid channel' WSJT_RELEASE_CHANNEL='dev'
+ expect_failure 'non-numeric rc' WSJT_RC_NUMBER='1a'
+ expect_failure 'empty version' WSJTX_VERSION=''
+ expect_failure 'invalid arch' ARCH='x86_64; id'
+ expect_failure 'slash in image tag' IMAGE_TAG='candidate/unsafe'
+ expect_failure 'leading punctuation in image tag' IMAGE_TAG='-candidate'
+ expect_failure 'empty image tag' IMAGE_TAG=''
+ expect_failure 'overlong image tag' IMAGE_TAG="$(printf 'a%.0s' {1..129})"
+ expect_failure 'command substitution in deployment_target' DEPLOYMENT_TARGET='11.0$(id)'
+ expect_failure 'empty fallback boolean' VALIDATE_FORTRAN_FALLBACK=''
+ expect_failure 'uppercase fallback boolean' VALIDATE_FORTRAN_FALLBACK='TRUE'
+ expect_failure 'numeric fallback boolean' VALIDATE_FORTRAN_FALLBACK='1'
+ expect_failure 'shell payload in fallback boolean' VALIDATE_FORTRAN_FALLBACK='true$(id)'
+
+ echo "validate-ci-inputs.sh self-test passed"
+ exit 0
+fi
+
+validate_inputs
diff --git a/.github/scripts/validate-linux-armhf-runtime.sh b/.github/scripts/validate-linux-armhf-runtime.sh
new file mode 100755
index 00000000..0909d512
--- /dev/null
+++ b/.github/scripts/validate-linux-armhf-runtime.sh
@@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+VERSION="${VERSION:?missing}"
+ARCH="${ARCH:?missing}"
+HAMLIB_BRANCH="${HAMLIB_BRANCH:?missing}"
+phase=${ARMHF_RUNTIME_PHASE:-all}
+if [ "$ARCH" != armhf ]; then
+ echo "validate-linux-armhf-runtime.sh supports only arch=armhf" >&2
+ exit 2
+fi
+case "$phase" in
+ all|test|package) ;;
+ *) echo "Unsupported ARMHF runtime phase: $phase" >&2; exit 2 ;;
+esac
+
+github_api_token="${GITHUB_TOKEN:-}"
+unset GITHUB_TOKEN
+cd /work
+# shellcheck source=.github/scripts/armhf-ci-image-config.sh
+source .github/scripts/armhf-ci-image-config.sh
+.github/scripts/verify-armhf-ci-image.sh runtime "$ARCH" "$HAMLIB_BRANCH"
+
+if [ "$phase" = all ] || [ "$phase" = test ]; then
+ echo "::group::ARMHF CTest under QEMU"
+ started="$(date +%s)"
+ set +e
+ (
+ cd wsjtx-build
+ LD_LIBRARY_PATH="$ARMHF_RUNTIME_PREFIX" \
+ QT_QPA_PLATFORM=xcb \
+ xvfb-run -a -s "-screen 0 1280x1024x24" \
+ ctest --output-on-failure --output-junit ctest-results.xml
+ ) 2>&1 | tee wsjtx-build/ctest-armhf.log
+ status=${PIPESTATUS[0]}
+ set -e
+ ended="$(date +%s)"
+ {
+ printf 'started_epoch=%s\n' "$started"
+ printf 'ended_epoch=%s\n' "$ended"
+ printf 'duration_seconds=%s\n' "$((ended - started))"
+ printf 'status=%s\n' "$status"
+ } > wsjtx-build/armhf-ctest-timing.env
+ echo "::endgroup::"
+ if [ "$status" -ne 0 ]; then
+ exit "$status"
+ fi
+fi
+
+if [ "$phase" = all ] || [ "$phase" = package ]; then
+ started="$(date +%s)"
+ set +e
+ GITHUB_TOKEN="$github_api_token" .github/scripts/package-linux-armhf.sh
+ status=$?
+ set -e
+ ended="$(date +%s)"
+ {
+ printf 'started_epoch=%s\n' "$started"
+ printf 'ended_epoch=%s\n' "$ended"
+ printf 'duration_seconds=%s\n' "$((ended - started))"
+ printf 'status=%s\n' "$status"
+ } > wsjtx-build/armhf-package-timing.env
+ if [ "$status" -ne 0 ]; then
+ exit "$status"
+ fi
+fi
diff --git a/.github/scripts/validate-workflow-timeouts.py b/.github/scripts/validate-workflow-timeouts.py
new file mode 100755
index 00000000..256f5782
--- /dev/null
+++ b/.github/scripts/validate-workflow-timeouts.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python3
+
+import re
+import sys
+from pathlib import Path
+
+
+JOB_PATTERN = re.compile(
+ r"^ (?P<quote>[\"']?)(?P<name>[A-Za-z_][A-Za-z0-9_-]*)(?P=quote):"
+ r"(?:\s+&[A-Za-z_][A-Za-z0-9_-]*)?(?:\s*#.*)?$"
+)
+
+
+def unbounded_jobs(path: Path) -> list[str]:
+ failures: list[str] = []
+ in_jobs = False
+ job_name: str | None = None
+ job_line = 0
+ has_runner = False
+ has_timeout = False
+
+ def finish_job() -> None:
+ if job_name is not None and has_runner and not has_timeout:
+ failures.append(f"{path}:{job_line}: job '{job_name}' has runs-on but no timeout-minutes")
+
+ for line_number, line in enumerate(path.read_text().splitlines(), start=1):
+ if line == "jobs:":
+ in_jobs = True
+ continue
+ if not in_jobs:
+ continue
+ if line and not line[0].isspace() and not line.startswith("#"):
+ finish_job()
+ break
+
+ match = JOB_PATTERN.match(line)
+ if match:
+ finish_job()
+ job_name = match.group("name")
+ job_line = line_number
+ has_runner = False
+ has_timeout = False
+ elif (
+ line.startswith(" ")
+ and not line.startswith(" ")
+ and line.strip()
+ and not line.lstrip().startswith("#")
+ ):
+ finish_job()
+ failures.append(f"{path}:{line_number}: unsupported job declaration; timeout cannot be verified")
+ job_name = None
+ has_runner = False
+ has_timeout = False
+ elif job_name is not None:
+ has_runner = has_runner or line.startswith(" runs-on:")
+ has_timeout = has_timeout or line.startswith(" timeout-minutes:")
+ else:
+ finish_job()
+
+ return failures
+
+
+def main() -> int:
+ workflow_dir = Path(".github/workflows")
+ workflows = sorted((*workflow_dir.glob("*.yml"), *workflow_dir.glob("*.yaml")))
+ failures = [failure for path in workflows for failure in unbounded_jobs(path)]
+ if failures:
+ print("Every runner-backed GitHub Actions job must define timeout-minutes:", file=sys.stderr)
+ print("\n".join(failures), file=sys.stderr)
+ return 1
+ print(f"Validated explicit timeouts for runner-backed jobs in {len(workflows)} workflows")
+ return 0
+
+
+if __name__ == "__main__":
+ raise SystemExit(main())
diff --git a/.github/scripts/verify-armhf-ci-image.sh b/.github/scripts/verify-armhf-ci-image.sh
new file mode 100755
index 00000000..b6746269
--- /dev/null
+++ b/.github/scripts/verify-armhf-ci-image.sh
@@ -0,0 +1,253 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 3 ]; then
+ echo "Usage: verify-armhf-ci-image.sh ROLE ARCH HAMLIB_REF" >&2
+ exit 2
+fi
+
+expected_role=$1
+expected_arch=$2
+expected_hamlib_ref=$3
+manifest=${WSJTX_CI_IMAGE_MANIFEST:-/opt/wsjtx-ci/image.env}
+config_dir=/usr/local/share/wsjtx-ci
+if [ ! -f "$config_dir/armhf-ci-image-config.sh" ]; then
+ config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+fi
+# shellcheck source=.github/scripts/armhf-ci-image-config.sh
+. "$config_dir/armhf-ci-image-config.sh"
+
+if [ ! -f "$manifest" ]; then
+ echo "ARMHF CI image manifest not found: $manifest" >&2
+ exit 1
+fi
+declare schema='' role='' architecture='' generation='' recipe_sha256=''
+declare compiler_version='' compiler_target='' compiler_sha256=''
+declare compiler_signature_sha256='' ccache_compatibility_id='' toolchain_id=''
+declare host_dpkg_arch='' package_sha256='' sysroot_package_sha256='' runtime_sha256=''
+declare hamlib_ref='' hamlib_commit='' hamlib_sha256='' glibc_version=''
+declare binutils_version='' linux_headers_version='' minimum_kernel_version=''
+declare quadmath_runtime='' cross_generation='' cross_recipe_sha256='' cross_toolchain_id=''
+# shellcheck disable=SC1090
+. "$manifest"
+
+require_equal() {
+ local field=$1 expected=$2 actual=$3
+ if [ "$actual" != "$expected" ]; then
+ echo "ARMHF CI image $field mismatch: expected $expected, got $actual" >&2
+ exit 1
+ fi
+}
+
+require_sha256() {
+ local field=$1 value=$2
+ if [[ ! "$value" =~ ^[0-9a-f]{64}$ ]]; then
+ echo "ARMHF CI image $field is not a SHA-256 value: ${value:-missing}" >&2
+ exit 1
+ fi
+}
+
+hash_package_set() {
+ dpkg-query -W -f='${binary:Package}=${Version}\n' |
+ LC_ALL=C sort |
+ sha256sum |
+ awk '{print $1}'
+}
+
+hash_runtime_set() {
+ local library records=""
+ for library in "${ARMHF_GCC_RUNTIME_LIBRARIES[@]}"; do
+ test -f "$ARMHF_RUNTIME_PREFIX/$library"
+ records+="$library=$(sha256sum "$ARMHF_RUNTIME_PREFIX/$library" | awk '{print $1}')"$'\n'
+ done
+ printf '%s' "$records" | sha256sum | awk '{print $1}'
+}
+
+require_armhf_elf() {
+ local path=$1 metadata headers attributes
+ metadata="$(file -L "$path")"
+ headers="$(readelf -hW "$path")"
+ attributes="$(readelf -AW "$path")"
+ case "$metadata:$headers:$attributes" in
+ *"ELF 32-bit"*"ARM, EABI5"*"hard-float ABI"*"Tag_ABI_VFP_args: VFP registers"*) ;;
+ *)
+ echo "Expected ARM EABI5 hard-float ELF: $path" >&2
+ echo "$metadata" >&2
+ exit 1
+ ;;
+ esac
+}
+
+verify_glibc_ceiling() {
+ local path=$1 versions maximum
+ versions="$(readelf --version-info -W "$path")"
+ maximum="$(
+ awk '
+ {
+ remaining = $0
+ while (match(remaining, /GLIBC_[0-9]+\.[0-9]+/)) {
+ version = substr(remaining, RSTART + 6, RLENGTH - 6)
+ split(version, parts, ".")
+ if (parts[1] > major || (parts[1] == major && parts[2] > minor)) {
+ major = parts[1]
+ minor = parts[2]
+ }
+ remaining = substr(remaining, RSTART + RLENGTH)
+ }
+ }
+ END { printf "%d.%d\n", major, minor }
+ ' <<< "$versions"
+ )"
+ if dpkg --compare-versions "$maximum" gt "$ARMHF_GLIBC_VERSION"; then
+ echo "$path requires GLIBC_$maximum, newer than Bookworm GLIBC_$ARMHF_GLIBC_VERSION" >&2
+ exit 1
+ fi
+}
+
+reject_quadmath_dependency() {
+ local path=$1 dynamic
+ dynamic="$(readelf -dW "$path")"
+ if [[ "$dynamic" == *"Shared library: [libquadmath.so"* ]]; then
+ echo "$path unexpectedly depends on libquadmath" >&2
+ exit 1
+ fi
+}
+
+reject_private_glibc_dependency() {
+ local path=$1 versions
+ versions="$(readelf --version-info -W "$path")"
+ if [[ "$versions" == *"GLIBC_PRIVATE"* ]]; then
+ echo "$path unexpectedly depends on a private glibc symbol" >&2
+ exit 1
+ fi
+}
+
+require_equal schema "$ARMHF_CI_IMAGE_SCHEMA" "${schema:-}"
+require_equal role "$expected_role" "${role:-}"
+require_equal architecture "$expected_arch" "${architecture:-}"
+require_equal hamlib_ref "$expected_hamlib_ref" "${hamlib_ref:-}"
+require_equal glibc_version "$ARMHF_GLIBC_VERSION" "${glibc_version:-}"
+require_equal quadmath_runtime unavailable-on-arm "${quadmath_runtime:-}"
+require_sha256 recipe_sha256 "${recipe_sha256:-}"
+require_sha256 package_sha256 "${package_sha256:-}"
+require_sha256 runtime_sha256 "${runtime_sha256:-}"
+
+profile=armhf-cross-bookworm
+if [ "$expected_role" = runtime ]; then
+ profile=armhf-runtime-bookworm
+fi
+if [ -n "${IMAGE_RECIPE_SHA256:-}" ]; then
+ expected_recipe=$IMAGE_RECIPE_SHA256
+else
+ expected_recipe="$(.github/scripts/linux-ci-image-fingerprint.sh "$profile")"
+fi
+recipe_match=true
+if [ "${WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH:-false}" = true ] &&
+ [ "$recipe_sha256" != "$expected_recipe" ]; then
+ echo "::warning::ARMHF $expected_role image recipe differs from this checkout; using its retained immutable generation" >&2
+ recipe_match=false
+else
+ require_equal recipe_sha256 "$expected_recipe" "$recipe_sha256"
+fi
+
+actual_package_sha256="$(hash_package_set)"
+require_equal package_sha256 "$package_sha256" "$actual_package_sha256"
+require_equal runtime_sha256 "$runtime_sha256" "$(hash_runtime_set)"
+for library in "${ARMHF_GCC_RUNTIME_LIBRARIES[@]}"; do
+ require_armhf_elf "$ARMHF_RUNTIME_PREFIX/$library"
+ verify_glibc_ceiling "$ARMHF_RUNTIME_PREFIX/$library"
+ reject_quadmath_dependency "$ARMHF_RUNTIME_PREFIX/$library"
+ reject_private_glibc_dependency "$ARMHF_RUNTIME_PREFIX/$library"
+done
+
+case "$expected_role" in
+ cross-builder)
+ compiler="$ARMHF_TOOLCHAIN_PREFIX/bin/$ARMHF_TARGET_TRIPLET-gcc"
+ require_equal host_dpkg_arch amd64 "${host_dpkg_arch:-}"
+ require_equal compiler_version "$ARMHF_GCC_VERSION" "${compiler_version:-}"
+ require_equal compiler_target "$ARMHF_TARGET_TRIPLET" "${compiler_target:-}"
+ require_equal binutils_version "$ARMHF_BINUTILS_VERSION" "${binutils_version:-}"
+ require_equal linux_headers_version "$ARMHF_LINUX_HEADERS_VERSION" "${linux_headers_version:-}"
+ require_equal minimum_kernel_version "$ARMHF_MIN_KERNEL_VERSION" "${minimum_kernel_version:-}"
+ require_equal compiler_version "$compiler_version" "$($compiler -dumpfullversion -dumpversion)"
+ require_equal compiler_target "$compiler_target" "$($compiler -dumpmachine)"
+ compiler_metadata="$(file -L "$compiler")"
+ case "$compiler_metadata" in
+ *"ELF 64-bit"*"x86-64"*) ;;
+ *) echo "Cross compiler is not a native x86-64 executable: $compiler_metadata" >&2; exit 1 ;;
+ esac
+ signature_helper="$config_dir/linux-ccache-compiler-signature.sh"
+ IFS=$'\t' read -r actual_version actual_target actual_sha256 \
+ actual_ccache_id actual_signature < <("$signature_helper" "$compiler")
+ require_equal compiler_version "$compiler_version" "$actual_version"
+ require_equal compiler_target "$compiler_target" "$actual_target"
+ require_equal compiler_sha256 "$compiler_sha256" "$actual_sha256"
+ require_equal ccache_compatibility_id "$ccache_compatibility_id" "$actual_ccache_id"
+ require_equal compiler_signature_sha256 "$compiler_signature_sha256" "$actual_signature"
+ require_equal sysroot_package_sha256 "$sysroot_package_sha256" \
+ "$(sha256sum /opt/wsjtx-ci/armhf-sysroot-packages.txt | awk '{print $1}')"
+ require_equal hamlib_commit "$LINUX_HAMLIB_COMMIT" "${hamlib_commit:-}"
+ require_equal hamlib_sha256 "$hamlib_sha256" \
+ "$(sha256sum "$ARMHF_SYSROOT/usr/lib/libhamlib.a" | awk '{print $1}')"
+ for target_file in \
+ "$ARMHF_SYSROOT/usr/bin/rigctl" \
+ "$ARMHF_SYSROOT/usr/bin/rigctld" \
+ "$ARMHF_SYSROOT/usr/bin/rigctlcom" \
+ "$ARMHF_SYSROOT/usr/lib/$ARMHF_TARGET_TRIPLET/libQt5Core.so.5" \
+ "$ARMHF_SYSROOT/usr/lib/$ARMHF_TARGET_TRIPLET/qt5/plugins/platforms/libqxcb.so"; do
+ require_armhf_elf "$target_file"
+ reject_quadmath_dependency "$target_file"
+ reject_private_glibc_dependency "$target_file"
+ done
+ for smoke in /opt/wsjtx-ci/toolchain-smoke/*-smoke; do
+ require_armhf_elf "$smoke"
+ reject_quadmath_dependency "$smoke"
+ reject_private_glibc_dependency "$smoke"
+ done
+ ;;
+ runtime)
+ require_equal host_dpkg_arch armhf "$(dpkg --print-architecture)"
+ require_equal cross_generation "$generation" "${cross_generation:-}"
+ require_sha256 cross_recipe_sha256 "${cross_recipe_sha256:-}"
+ if [ -e /opt/wsjtx/hamlib ]; then
+ echo "ARMHF runtime image must not provide the build-image Hamlib prefix" >&2
+ exit 1
+ fi
+ qemu_metadata="$(file -L "$ARMHF_QEMU_EXECUTABLE")"
+ case "$qemu_metadata" in
+ *"ELF 64-bit"*"x86-64"*) ;;
+ *) echo "ARMHF AppImage QEMU helper is not x86-64: $qemu_metadata" >&2; exit 1 ;;
+ esac
+ for plugin in \
+ /usr/lib/arm-linux-gnueabihf/qt5/plugins/platforms/libqxcb.so \
+ /usr/lib/arm-linux-gnueabihf/qt5/plugins/sqldrivers/libqsqlite.so; do
+ require_armhf_elf "$plugin"
+ done
+ for smoke in /opt/wsjtx-ci/toolchain-smoke/*-smoke; do
+ require_armhf_elf "$smoke"
+ reject_quadmath_dependency "$smoke"
+ reject_private_glibc_dependency "$smoke"
+ LD_LIBRARY_PATH="$ARMHF_RUNTIME_PREFIX" OMP_NUM_THREADS=2 "$smoke"
+ done
+ ;;
+ *)
+ echo "Unsupported ARMHF image role: $expected_role" >&2
+ exit 2
+ ;;
+esac
+
+echo "ARMHF CI image: $role ${generation:-unknown} (${toolchain_id:-${cross_toolchain_id:-unknown}})"
+if [ -n "${GITHUB_OUTPUT:-}" ]; then
+ output_prefix=${WSJTX_CI_OUTPUT_PREFIX:-}
+ {
+ printf '%sgeneration=%s\n' "$output_prefix" "$generation"
+ printf '%srecipe_match=%s\n' "$output_prefix" "$recipe_match"
+ if [ "$expected_role" = cross-builder ]; then
+ printf '%stoolchain_id=%s\n' "$output_prefix" "$toolchain_id"
+ printf '%sccache_compatibility_id=%s\n' "$output_prefix" "$ccache_compatibility_id"
+ printf '%sccache_compiler_check=string:%s\n' "$output_prefix" "$compiler_signature_sha256"
+ else
+ printf '%stoolchain_id=%s\n' "$output_prefix" "$cross_toolchain_id"
+ fi
+ } >> "$GITHUB_OUTPUT"
+fi
diff --git a/.github/scripts/verify-linux-ci-image.sh b/.github/scripts/verify-linux-ci-image.sh
new file mode 100755
index 00000000..dc03dbe4
--- /dev/null
+++ b/.github/scripts/verify-linux-ci-image.sh
@@ -0,0 +1,268 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 3 ]; then
+ echo "Usage: verify-linux-ci-image.sh FLAVOR ARCH HAMLIB_REF" >&2
+ exit 2
+fi
+
+expected_flavor=$1
+expected_arch=$2
+expected_hamlib_ref=$3
+manifest=${WSJTX_CI_IMAGE_MANIFEST:-/opt/wsjtx-ci/image.env}
+image_prefix=${WSJTX_CI_PREFIX_OVERRIDE:-/opt/wsjtx}
+
+config_dir=/usr/local/share/wsjtx-ci
+if [ ! -f "$config_dir/linux-ci-image-config.sh" ]; then
+ config_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+fi
+# shellcheck source=.github/scripts/linux-ci-image-config.sh
+. "$config_dir/linux-ci-image-config.sh"
+if [ "$expected_flavor" = tsan ]; then
+ # shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+ . "$config_dir/tsan-linux-deps-config.sh"
+fi
+
+if [ ! -f "$manifest" ]; then
+ echo "Linux CI image manifest not found: $manifest" >&2
+ exit 1
+fi
+
+# shellcheck disable=SC1090
+. "$manifest"
+
+require_equal() {
+ local field=$1 expected=$2 actual=$3
+ if [ "$actual" != "$expected" ]; then
+ echo "Linux CI image $field mismatch: expected $expected, got $actual" >&2
+ exit 1
+ fi
+}
+
+require_sha256() {
+ local field=$1 value=$2
+ if [[ ! "$value" =~ ^[0-9a-f]{64}$ ]]; then
+ echo "Linux CI image $field is not a SHA-256 value: ${value:-missing}" >&2
+ exit 1
+ fi
+}
+
+require_key_component() {
+ local field=$1 value=$2
+ if [[ ! "$value" =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ ]]; then
+ echo "Linux CI image $field is not a safe cache-key component: ${value:-missing}" >&2
+ exit 1
+ fi
+}
+
+require_equal schema 1 "${schema:-}"
+require_equal flavor "$expected_flavor" "${flavor:-}"
+require_equal architecture "$expected_arch" "${architecture:-}"
+require_equal hamlib_ref "$expected_hamlib_ref" "${hamlib_ref:-}"
+require_key_component generation "${generation:-}"
+
+case "$expected_flavor" in
+ normal)
+ expected_compiler=gcc
+ require_equal hamlib_commit "$LINUX_HAMLIB_COMMIT" "${hamlib_commit:-}"
+ require_equal pfunit_version "$LINUX_PFUNIT_VERSION" "${pfunit_version:-}"
+ require_equal pfunit_commit "$LINUX_PFUNIT_COMMIT" "${pfunit_commit:-}"
+ profile=normal-noble
+ if [ "$expected_arch" != x86_64 ]; then
+ profile=normal-bookworm
+ fi
+ pfunit_config="$(find "$image_prefix/pfunit" -name PFUNITConfig.cmake -print -quit)"
+ if [ -z "$pfunit_config" ]; then
+ echo "PFUNITConfig.cmake not found in the Linux CI image" >&2
+ exit 1
+ fi
+ test -f "$image_prefix/hamlib/lib/libhamlib.a"
+ if [ "${WSJTX_CI_IMAGE_SKIP_RUNTIME_CHECKS:-false}" != true ]; then
+ qt_core_config="$(find /usr -path '*/cmake/Qt5Core/Qt5CoreConfig.cmake' -print -quit)"
+ qt_multimedia_config="$(find /usr -path '*/cmake/Qt5Multimedia/Qt5MultimediaConfig.cmake' -print -quit)"
+ qt_plugin="$(find /usr -path '*/plugins/platforms/*' -type f -print -quit)"
+ test -n "$qt_core_config"
+ test -n "$qt_multimedia_config"
+ test -n "$qt_plugin"
+ fi
+ pfunit_dir="$(dirname "$pfunit_config")"
+ hamlib_prefix=$image_prefix/hamlib
+ ;;
+ tsan)
+ expected_compiler=gcc-13
+ profile=tsan-noble
+ hamlib_prefix=$image_prefix/tsan/hamlib
+ require_equal hamlib_commit "$TSAN_HAMLIB_COMMIT" "${hamlib_commit:-}"
+ require_equal hamlib_patch_commit "$TSAN_HAMLIB_PATCH_COMMIT" "${hamlib_patch_commit:-}"
+ require_equal qt_version "$TSAN_QT_VERSION" "${qt_version:-}"
+ require_equal boost_version "$TSAN_BOOST_VERSION" "${boost_version:-}"
+ "$config_dir/verify-tsan-deps-linux.sh" \
+ "$image_prefix/tsan/qt" "$image_prefix/tsan/boost" "$image_prefix/tsan/hamlib"
+ boost_config="$(find "$image_prefix/tsan/boost" -name BoostConfig.cmake -print -quit)"
+ test -n "$boost_config"
+ if [ "${WSJTX_CI_IMAGE_SKIP_RUNTIME_CHECKS:-false}" != true ]; then
+ test -d "$image_prefix/tsan/qt/plugins"
+ test -n "$(find "$image_prefix/tsan/qt/plugins" -type f -print -quit)"
+ fi
+ ;;
+ *)
+ echo "Unsupported Linux CI image flavor: $expected_flavor" >&2
+ exit 2
+ ;;
+esac
+
+if [ -n "${IMAGE_RECIPE_SHA256:-}" ]; then
+ expected_recipe=$IMAGE_RECIPE_SHA256
+else
+ expected_recipe="$(.github/scripts/linux-ci-image-fingerprint.sh "$profile")"
+fi
+toolchain_recipe=$expected_recipe
+recipe_match=true
+if [ "${WSJTX_CI_IMAGE_ALLOW_RECIPE_MISMATCH:-false}" = true ] &&
+ [ "${recipe_sha256:-}" != "$expected_recipe" ]; then
+ echo "::warning::Linux CI image recipe fingerprint differs from this checkout; using the last known-good image generation" >&2
+ if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
+ {
+ echo "### Linux CI image fallback"
+ echo
+ echo "This job used a previously promoted image while the dependency refresh was in progress."
+ echo
+ echo "- Image recipe in the image: \`${recipe_sha256:-missing}\`"
+ echo "- Recipe in this checkout: \`$expected_recipe\`"
+ } >> "$GITHUB_STEP_SUMMARY"
+ fi
+ toolchain_recipe=${recipe_sha256:-}
+ recipe_match=false
+else
+ require_equal recipe_sha256 "$expected_recipe" "${recipe_sha256:-}"
+fi
+require_equal compiler "$expected_compiler" "${compiler:-}"
+test -n "${compiler:-}"
+test -n "${compiler_version:-}"
+test -n "${compiler_sha256:-}"
+test -n "${compiler_target:-}"
+test -n "${package_sha256:-}"
+require_key_component toolchain_id "${toolchain_id:-}"
+if [[ ! "${compiler_version:-}" =~ ^[0-9]+([.][0-9]+)*$ ]]; then
+ echo "Linux CI image compiler_version is invalid: ${compiler_version:-missing}" >&2
+ exit 1
+fi
+require_key_component compiler_target "${compiler_target:-}"
+require_sha256 compiler_sha256 "${compiler_sha256:-}"
+require_sha256 package_sha256 "${package_sha256:-}"
+require_sha256 recipe_sha256 "${recipe_sha256:-}"
+
+if [ "$recipe_match" = true ]; then
+ compiler_major=${compiler_version%%.*}
+ require_equal ccache_compatibility_id \
+ "gcc${compiler_major}-v2" "${ccache_compatibility_id:-}"
+ require_key_component ccache_compatibility_id "$ccache_compatibility_id"
+ require_sha256 compiler_signature_sha256 "${compiler_signature_sha256:-}"
+ verified_ccache_compatibility_id=$ccache_compatibility_id
+ verified_ccache_compiler_check="string:$compiler_signature_sha256"
+else
+ verified_ccache_compatibility_id=$toolchain_id
+ verified_ccache_compiler_check=mtime
+fi
+
+if [ "${WSJTX_CI_IMAGE_SKIP_RUNTIME_CHECKS:-false}" != true ]; then
+ compiler_path="$(readlink -f "$(command -v "$compiler")")"
+ require_equal dpkg_arch "$(dpkg --print-architecture)" "${dpkg_arch:-}"
+ require_equal compiler_version "$compiler_version" "$($compiler -dumpfullversion -dumpversion)"
+ require_equal compiler_target "$compiler_target" "$($compiler -dumpmachine)"
+ require_equal compiler_sha256 "$compiler_sha256" "$(sha256sum "$compiler_path" | awk '{print $1}')"
+ actual_package_sha256="$(dpkg-query -W -f='${binary:Package}=${Version}\n' | LC_ALL=C sort | sha256sum | awk '{print $1}')"
+ require_equal package_sha256 "$package_sha256" "$actual_package_sha256"
+ toolchain_identity="$toolchain_recipe:$compiler_target:$compiler_sha256:$package_sha256"
+ toolchain_sha256="$(printf '%s' "$toolchain_identity" | sha256sum | awk '{print $1}')"
+ require_equal toolchain_id "$toolchain_id" "gcc${compiler_version}-${expected_arch}-${toolchain_sha256:0:20}"
+
+ if [ "$recipe_match" = true ]; then
+ signature_helper="$config_dir/linux-ccache-compiler-signature.sh"
+ if [ ! -x "$signature_helper" ]; then
+ echo "Linux ccache compiler signature helper not found: $signature_helper" >&2
+ exit 1
+ fi
+ IFS=$'\t' read -r actual_compiler_version actual_compiler_target \
+ actual_compiler_sha256 actual_ccache_compatibility_id \
+ actual_compiler_signature_sha256 \
+ < <("$signature_helper" "$compiler")
+ require_equal compiler_version "$compiler_version" "$actual_compiler_version"
+ require_equal compiler_target "$compiler_target" "$actual_compiler_target"
+ require_equal compiler_sha256 "$compiler_sha256" "$actual_compiler_sha256"
+ require_equal ccache_compatibility_id "$ccache_compatibility_id" \
+ "$actual_ccache_compatibility_id"
+ require_equal compiler_signature_sha256 "$compiler_signature_sha256" \
+ "$actual_compiler_signature_sha256"
+ fi
+fi
+
+if [ "${WSJTX_CI_IMAGE_SKIP_RUNTIME_CHECKS:-false}" != true ]; then
+ smoke_dir="$(mktemp -d)"
+ cat > "$smoke_dir/CMakeLists.txt" <<'EOF'
+cmake_minimum_required(VERSION 3.16)
+project(wsjt_ci_image_smoke LANGUAGES CXX)
+
+find_package(Qt5 REQUIRED COMPONENTS Core)
+find_package(Boost REQUIRED COMPONENTS log_setup log)
+find_package(PkgConfig REQUIRED)
+set(PKG_CONFIG_USE_STATIC_LIBS TRUE)
+pkg_check_modules(HAMLIB REQUIRED IMPORTED_TARGET hamlib)
+
+add_executable(wsjt_ci_image_smoke main.cpp)
+target_include_directories(wsjt_ci_image_smoke PRIVATE "${WSJTX_HAMLIB_PREFIX}/include")
+target_link_libraries(wsjt_ci_image_smoke PRIVATE Qt5::Core Boost::log_setup Boost::log PkgConfig::HAMLIB)
+EOF
+ cat > "$smoke_dir/main.cpp" <<'EOF'
+#include <QCoreApplication>
+#include <boost/log/trivial.hpp>
+#include <hamlib/rig.h>
+
+int main(int argc, char **argv)
+{
+ QCoreApplication application(argc, argv);
+ BOOST_LOG_TRIVIAL(info) << "WSJT-X CI image smoke test";
+ return 0;
+}
+EOF
+
+ cmake_args=(
+ -S "$smoke_dir"
+ -B "$smoke_dir/build"
+ -DCMAKE_BUILD_TYPE=Release
+ "-DWSJTX_HAMLIB_PREFIX=$hamlib_prefix"
+ )
+ if [ "$expected_flavor" = tsan ]; then
+ cmake_args+=(
+ "-DCMAKE_PREFIX_PATH=$image_prefix/tsan/qt;$image_prefix/tsan/boost;$image_prefix/tsan/hamlib"
+ "-DBOOST_ROOT=$image_prefix/tsan/boost"
+ -DBoost_NO_SYSTEM_PATHS=ON
+ -DCMAKE_CXX_FLAGS=-fsanitize=thread
+ -DCMAKE_EXE_LINKER_FLAGS=-fsanitize=thread
+ )
+ fi
+ export PKG_CONFIG_PATH="$hamlib_prefix/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
+ cmake "${cmake_args[@]}"
+ cmake --build "$smoke_dir/build" --parallel "$(nproc)"
+ rm -rf "$smoke_dir"
+fi
+
+echo "Linux CI image: ${generation:-unknown} (${toolchain_id:-unknown}; ccache ${verified_ccache_compatibility_id:-unknown})"
+
+if [ -n "${GITHUB_OUTPUT:-}" ]; then
+ {
+ printf 'generation=%s\n' "$generation"
+ printf 'toolchain_id=%s\n' "$toolchain_id"
+ printf 'ccache_compatibility_id=%s\n' "$verified_ccache_compatibility_id"
+ printf 'ccache_compiler_check=%s\n' "$verified_ccache_compiler_check"
+ printf 'recipe_match=%s\n' "$recipe_match"
+ if [ "$expected_flavor" = normal ]; then
+ printf 'pfunit_dir=%s\n' "$pfunit_dir"
+ printf 'hamlib_prefix=%s\n' "$hamlib_prefix"
+ else
+ printf 'qt_prefix=%s\n' "$image_prefix/tsan/qt"
+ printf 'boost_prefix=%s\n' "$image_prefix/tsan/boost"
+ printf 'hamlib_prefix=%s\n' "$image_prefix/tsan/hamlib"
+ fi
+ } >> "$GITHUB_OUTPUT"
+fi
diff --git a/.github/scripts/verify-macos-artifacts.sh b/.github/scripts/verify-macos-artifacts.sh
index 954c54e9..981e60d6 100755
--- a/.github/scripts/verify-macos-artifacts.sh
+++ b/.github/scripts/verify-macos-artifacts.sh
@@ -88,7 +88,9 @@ version_gt() {
is_macho() {
local file="$1"
- file "$file" 2>/dev/null | grep -Eq 'Mach-O|universal binary'
+ local file_type
+ file_type=$(file "$file" 2>/dev/null || true)
+ [[ "$file_type" == *"Mach-O"* || "$file_type" == *"universal binary"* ]]
}
is_allowed_reference() {
@@ -124,10 +126,13 @@ check_file() {
echo "::error file=${file}::Could not determine Mach-O architecture"
return 1
fi
- if ! printf '%s\n' "$archs" | tr ' ' '\n' | grep -qx "$arch"; then
+ case " ${archs} " in
+ *" ${arch} "*) ;;
+ *)
echo "::error file=${file}::Expected architecture ${arch}, found: ${archs}"
return 1
- fi
+ ;;
+ esac
minos=$(otool -arch "$arch" -l "$file" 2>/dev/null | awk '
/LC_BUILD_VERSION/ { in_build = 1; next }
diff --git a/.github/scripts/verify-macos-static-archives.sh b/.github/scripts/verify-macos-static-archives.sh
index 2c20875e..419e0674 100755
--- a/.github/scripts/verify-macos-static-archives.sh
+++ b/.github/scripts/verify-macos-static-archives.sh
@@ -116,9 +116,14 @@ check_archive() {
fi
archs=$(lipo -archs "$archive" 2>/dev/null || true)
- if [ -n "$archs" ] && ! printf '%s\n' "$archs" | tr ' ' '\n' | grep -qx "$arch"; then
- echo "::error file=${archive}::Expected architecture ${arch}, found: ${archs}"
- structural_fail=1
+ if [ -n "$archs" ]; then
+ case " ${archs} " in
+ *" ${arch} "*) ;;
+ *)
+ echo "::error file=${archive}::Expected architecture ${arch}, found: ${archs}"
+ structural_fail=1
+ ;;
+ esac
fi
while IFS= read -r line; do
diff --git a/.github/scripts/verify-sanitizer-instrumentation.py b/.github/scripts/verify-sanitizer-instrumentation.py
new file mode 100755
index 00000000..6f5279b9
--- /dev/null
+++ b/.github/scripts/verify-sanitizer-instrumentation.py
@@ -0,0 +1,136 @@
+#!/usr/bin/env python3
+
+import argparse
+import json
+import subprocess
+from pathlib import Path
+
+
+SANITIZERS = {
+ "asan-ubsan": {
+ "flag": "-fsanitize=address,undefined",
+ "symbols": ("__asan_", "__ubsan_"),
+ "runtimes": ("libasan.so", "libubsan.so"),
+ },
+ "tsan": {
+ "flag": "-fsanitize=thread",
+ "symbols": ("__tsan_",),
+ "runtimes": ("libtsan.so",),
+ },
+}
+LANGUAGE_SUFFIXES = {
+ "C": {".c"},
+ "C++": {".cc", ".cpp", ".cxx"},
+ "Fortran": {".f", ".f03", ".f08", ".f90", ".f95", ".for", ".ftn"},
+}
+
+
+def fail(message):
+ raise SystemExit(f"ERROR: {message}")
+
+
+def command_text(entry):
+ if "command" in entry:
+ return entry["command"]
+ return " ".join(entry.get("arguments", []))
+
+
+def require_file(path):
+ if not path.is_file():
+ fail(f"expected build artifact is missing: {path}")
+
+
+def tool_output(*arguments):
+ result = subprocess.run(
+ arguments,
+ check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ text=True,
+ )
+ return result.stdout
+
+
+def verify_compile_commands(build_dir, sanitizer_flag):
+ commands_path = build_dir / "compile_commands.json"
+ require_file(commands_path)
+ commands = json.loads(commands_path.read_text(encoding="utf-8"))
+
+ language_counts = {language: 0 for language in LANGUAGE_SUFFIXES}
+ uninstrumented = []
+ for entry in commands:
+ suffix = Path(entry.get("file", "")).suffix.lower()
+ for language, suffixes in LANGUAGE_SUFFIXES.items():
+ if suffix not in suffixes:
+ continue
+ language_counts[language] += 1
+ if sanitizer_flag not in command_text(entry):
+ uninstrumented.append(entry.get("file", "<unknown>"))
+
+ missing_languages = [
+ language for language, count in language_counts.items() if count == 0
+ ]
+ if missing_languages:
+ fail(
+ "no compile commands were found for: " + ", ".join(missing_languages)
+ )
+ if uninstrumented:
+ examples = ", ".join(uninstrumented[:10])
+ suffix = "" if len(uninstrumented) <= 10 else ", ..."
+ fail(f"compile commands without sanitizer instrumentation: {examples}{suffix}")
+ return language_counts
+
+
+def verify_archive(path, symbol):
+ require_file(path)
+ symbols = tool_output("nm", "-A", "--undefined-only", str(path))
+ if symbol not in symbols:
+ fail(f"{path.name} has no reference to {symbol}")
+
+
+def verify_link(build_dir, target, sanitizer_flag, runtimes):
+ link_command_path = build_dir / "CMakeFiles" / f"{target}.dir" / "link.txt"
+ executable_path = build_dir / target
+ require_file(link_command_path)
+ require_file(executable_path)
+
+ if sanitizer_flag not in link_command_path.read_text(encoding="utf-8"):
+ fail(f"{target} final link command does not contain {sanitizer_flag}")
+
+ dynamic_section = tool_output("readelf", "-d", str(executable_path))
+ for runtime in runtimes:
+ if runtime not in dynamic_section:
+ fail(f"{target} does not declare a dependency on {runtime}")
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("build_dir", type=Path)
+ parser.add_argument(
+ "--sanitizer", choices=SANITIZERS, default="asan-ubsan"
+ )
+ args = parser.parse_args()
+
+ build_dir = args.build_dir.resolve()
+ if not build_dir.is_dir():
+ fail(f"build directory does not exist: {build_dir}")
+
+ sanitizer = SANITIZERS[args.sanitizer]
+ language_counts = verify_compile_commands(build_dir, sanitizer["flag"])
+ for symbol in sanitizer["symbols"]:
+ verify_archive(build_dir / "libwsjt_cxx.a", symbol)
+ verify_archive(build_dir / "libwsjt_fort_omp.a", symbol)
+ verify_link(build_dir, "jt9", sanitizer["flag"], sanitizer["runtimes"])
+ verify_link(build_dir, "wsjtx", sanitizer["flag"], sanitizer["runtimes"])
+
+ print("Sanitizer instrumentation verified")
+ compile_summary = ", ".join(
+ f"{language}={count}" for language, count in language_counts.items()
+ )
+ print(f" compile commands: {compile_summary}")
+ print(" static archives: libwsjt_cxx.a, libwsjt_fort_omp.a")
+ print(" final executables: jt9, wsjtx")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/.github/scripts/verify-tsan-deps-linux.sh b/.github/scripts/verify-tsan-deps-linux.sh
new file mode 100755
index 00000000..54e2ed2f
--- /dev/null
+++ b/.github/scripts/verify-tsan-deps-linux.sh
@@ -0,0 +1,138 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+usage() {
+ echo "Usage: verify-tsan-deps-linux.sh QT_PREFIX BOOST_PREFIX HAMLIB_PREFIX [CMAKE_CACHE [BINARY]]" >&2
+}
+
+if [ "$#" -lt 3 ] || [ "$#" -gt 5 ]; then
+ usage
+ exit 2
+fi
+
+script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+# shellcheck source=.github/scripts/tsan-linux-deps-config.sh
+. "${script_dir}/tsan-linux-deps-config.sh"
+
+qt_prefix=$1
+boost_prefix=$2
+hamlib_prefix=$3
+cmake_cache=${4:-}
+binary=${5:-}
+
+manifest_value() {
+ local manifest=$1 key=$2
+ awk -F= -v key="$key" '$1 == key {sub(/^[^=]*=/, ""); print; exit}' "$manifest"
+}
+
+cmake_cache_value() {
+ local cache=$1 key=$2
+ awk -F= -v key="$key" '$1 ~ ("^" key ":[^=]+$") {sub(/^[^=]*=/, ""); print; exit}' "$cache"
+}
+
+verify_cmake_cache_prefix() {
+ local cache=$1 key=$2 prefix=$3 value
+ value="$(cmake_cache_value "$cache" "$key")"
+ if [[ "$value" != "$prefix"/* ]]; then
+ echo "CMake resolved $key outside $prefix: ${value:-<unset>}" >&2
+ return 1
+ fi
+}
+
+verify_manifest() {
+ local dependency=$1 prefix=$2 manifest expected_key actual_key
+ manifest="${prefix}/.wsjtx-tsan-manifest"
+ if [ ! -f "$manifest" ]; then
+ echo "Missing $dependency TSan manifest: $manifest" >&2
+ return 1
+ fi
+ if [ "$(manifest_value "$manifest" dependency)" != "$dependency" ]; then
+ echo "Unexpected dependency identity in $manifest" >&2
+ return 1
+ fi
+ expected_key="$(tsan_dependency_cache_key "$dependency")"
+ actual_key="$(manifest_value "$manifest" cache_key)"
+ if [ "$actual_key" != "$expected_key" ]; then
+ echo "$dependency TSan cache manifest mismatch" >&2
+ echo "Expected: $expected_key" >&2
+ echo "Actual: $actual_key" >&2
+ return 1
+ fi
+}
+
+verify_dynamic_tsan_symbols() {
+ local label=$1 library=$2
+ if [ ! -f "$library" ]; then
+ echo "Missing $label library: $library" >&2
+ return 1
+ fi
+ if ! nm -D "$library" | awk '$0 ~ /__tsan_/ {found=1} END {exit !found}'; then
+ echo "$label does not reference the TSan runtime: $library" >&2
+ return 1
+ fi
+}
+
+verify_manifest qt "$qt_prefix"
+verify_manifest boost "$boost_prefix"
+verify_manifest hamlib "$hamlib_prefix"
+
+qt_core="${qt_prefix}/lib/libQt5Core.so.5"
+boost_candidates=("${boost_prefix}"/lib/libboost_log.so*)
+boost_log=${boost_candidates[0]}
+hamlib_archive="${hamlib_prefix}/lib/libhamlib.a"
+
+verify_dynamic_tsan_symbols Qt5Core "$qt_core"
+verify_dynamic_tsan_symbols Boost.Log "$boost_log"
+
+if [ ! -f "$hamlib_archive" ]; then
+ echo "Missing Hamlib archive: $hamlib_archive" >&2
+ exit 1
+fi
+if ! nm -A "$hamlib_archive" | awk '$0 ~ /__tsan_/ {found=1} END {exit !found}'; then
+ echo "Hamlib does not reference the TSan runtime: $hamlib_archive" >&2
+ exit 1
+fi
+
+for required in \
+ "${qt_prefix}/lib/cmake/Qt5Core/Qt5CoreConfig.cmake" \
+ "${qt_prefix}/lib/cmake/Qt5Test/Qt5TestConfig.cmake" \
+ "${qt_prefix}/lib/cmake/Qt5Multimedia/Qt5MultimediaConfig.cmake" \
+ "${qt_prefix}/lib/cmake/Qt5SerialPort/Qt5SerialPortConfig.cmake" \
+ "${qt_prefix}/lib/cmake/Qt5WebSockets/Qt5WebSocketsConfig.cmake" \
+ "${boost_prefix}/include/boost/log/core.hpp"; do
+ if [ ! -e "$required" ]; then
+ echo "Missing cached TSan dependency file: $required" >&2
+ exit 1
+ fi
+done
+
+if [ -n "$cmake_cache" ]; then
+ if [ ! -f "$cmake_cache" ]; then
+ echo "CMake cache not found: $cmake_cache" >&2
+ exit 1
+ fi
+ verify_cmake_cache_prefix "$cmake_cache" Qt5Core_DIR "$qt_prefix"
+ verify_cmake_cache_prefix "$cmake_cache" Boost_INCLUDE_DIR "$boost_prefix"
+ verify_cmake_cache_prefix "$cmake_cache" Boost_LOG_LIBRARY_RELEASE "$boost_prefix"
+ verify_cmake_cache_prefix "$cmake_cache" Boost_LOG_SETUP_LIBRARY_RELEASE "$boost_prefix"
+ verify_cmake_cache_prefix "$cmake_cache" Hamlib_INCLUDE_DIR "$hamlib_prefix"
+ verify_cmake_cache_prefix "$cmake_cache" Hamlib_LIBRARY "$hamlib_prefix"
+fi
+
+if [ -n "$binary" ]; then
+ if [ ! -x "$binary" ]; then
+ echo "TSan binary not found or not executable: $binary" >&2
+ exit 1
+ fi
+ linked="$(ldd "$binary")"
+ if ! printf '%s\n' "$linked" | awk -v prefix="$qt_prefix" '$0 ~ /libQt5Core/ && index($0, prefix) {found=1} END {exit !found}'; then
+ echo "Binary is not using cached TSan Qt: $binary" >&2
+ exit 1
+ fi
+ if ! printf '%s\n' "$linked" | awk -v prefix="$boost_prefix" '$0 ~ /libboost_log/ && index($0, prefix) {found=1} END {exit !found}'; then
+ echo "Binary is not using cached TSan Boost.Log: $binary" >&2
+ exit 1
+ fi
+fi
+
+echo "Verified pinned TSan Qt, Boost, and Hamlib prefixes"
diff --git a/.github/scripts/write-armhf-ci-manifest.sh b/.github/scripts/write-armhf-ci-manifest.sh
new file mode 100755
index 00000000..93ea9e77
--- /dev/null
+++ b/.github/scripts/write-armhf-ci-manifest.sh
@@ -0,0 +1,121 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if [ "$#" -ne 4 ]; then
+ echo "Usage: write-armhf-ci-manifest.sh ROLE ARCH GENERATION RECIPE_SHA256" >&2
+ exit 2
+fi
+
+requested_role=$1
+requested_arch=$2
+requested_generation=$3
+requested_recipe_sha256=$4
+role=$requested_role
+arch=$requested_arch
+generation=$requested_generation
+recipe_sha256=$requested_recipe_sha256
+config_dir=${WSJTX_ARMHF_CONFIG_DIR:-/usr/local/share/wsjtx-ci}
+manifest_dir=${WSJTX_CI_MANIFEST_DIR:-/opt/wsjtx-ci}
+declare toolchain_id='' runtime_sha256='' hamlib_ref='' hamlib_commit=''
+
+# shellcheck source=.github/scripts/armhf-ci-image-config.sh
+. "$config_dir/armhf-ci-image-config.sh"
+
+hash_package_set() {
+ dpkg-query -W -f='${binary:Package}=${Version}\n' |
+ LC_ALL=C sort |
+ sha256sum |
+ awk '{print $1}'
+}
+
+hash_runtime_set() {
+ local library records=""
+ for library in "${ARMHF_GCC_RUNTIME_LIBRARIES[@]}"; do
+ records+="$library=$(sha256sum "$ARMHF_RUNTIME_PREFIX/$library" | awk '{print $1}')"$'\n'
+ done
+ printf '%s' "$records" | sha256sum | awk '{print $1}'
+}
+
+mkdir -p "$manifest_dir"
+case "$role" in
+ cross-builder)
+ compiler="$ARMHF_TOOLCHAIN_PREFIX/bin/$ARMHF_TARGET_TRIPLET-gcc"
+ signature_helper="$config_dir/linux-ccache-compiler-signature.sh"
+ IFS=$'\t' read -r compiler_version compiler_target compiler_sha256 \
+ ccache_compatibility_id compiler_signature_sha256 \
+ < <("$signature_helper" "$compiler")
+ sysroot_package_sha256="$(sha256sum "$manifest_dir/armhf-sysroot-packages.txt" | awk '{print $1}')"
+ runtime_sha256="$(hash_runtime_set)"
+ hamlib_sha256="$(sha256sum "$ARMHF_SYSROOT/usr/lib/libhamlib.a" | awk '{print $1}')"
+ package_sha256="$(hash_package_set)"
+ identity="$recipe_sha256:$compiler_target:$compiler_sha256:$sysroot_package_sha256:$runtime_sha256:$hamlib_sha256"
+ identity_sha256="$(printf '%s' "$identity" | sha256sum | awk '{print $1}')"
+ toolchain_id="gcc${compiler_version}-${arch}-${identity_sha256:0:20}"
+ {
+ printf 'schema=%s\n' "$ARMHF_CI_IMAGE_SCHEMA"
+ printf 'role=%s\n' "$role"
+ printf 'architecture=%s\n' "$arch"
+ printf 'generation=%s\n' "$generation"
+ printf 'recipe_sha256=%s\n' "$recipe_sha256"
+ printf 'compiler_version=%s\n' "$compiler_version"
+ printf 'compiler_target=%s\n' "$compiler_target"
+ printf 'compiler_sha256=%s\n' "$compiler_sha256"
+ printf 'compiler_signature_sha256=%s\n' "$compiler_signature_sha256"
+ printf 'ccache_compatibility_id=%s\n' "$ccache_compatibility_id"
+ printf 'toolchain_id=%s\n' "$toolchain_id"
+ printf 'host_dpkg_arch=%s\n' "$(dpkg --print-architecture)"
+ printf 'package_sha256=%s\n' "$package_sha256"
+ printf 'sysroot_package_sha256=%s\n' "$sysroot_package_sha256"
+ printf 'runtime_sha256=%s\n' "$runtime_sha256"
+ printf 'hamlib_ref=%s\n' "$LINUX_HAMLIB_REF"
+ printf 'hamlib_commit=%s\n' "$LINUX_HAMLIB_COMMIT"
+ printf 'hamlib_sha256=%s\n' "$hamlib_sha256"
+ printf 'glibc_version=%s\n' "$ARMHF_GLIBC_VERSION"
+ printf 'binutils_version=%s\n' "$ARMHF_BINUTILS_VERSION"
+ printf 'linux_headers_version=%s\n' "$ARMHF_LINUX_HEADERS_VERSION"
+ printf 'minimum_kernel_version=%s\n' "$ARMHF_MIN_KERNEL_VERSION"
+ printf 'quadmath_runtime=%s\n' unavailable-on-arm
+ } > "$manifest_dir/image.env"
+ ;;
+ runtime)
+ cross_manifest="$config_dir/cross-builder.env"
+ if [ ! -f "$cross_manifest" ]; then
+ echo "Cross-builder manifest is missing: $cross_manifest" >&2
+ exit 1
+ fi
+ # shellcheck disable=SC1090
+ . "$cross_manifest"
+ cross_generation=$generation
+ cross_recipe_sha256=$recipe_sha256
+ cross_toolchain_id=$toolchain_id
+ cross_runtime_sha256=$runtime_sha256
+ cross_hamlib_ref=$hamlib_ref
+ cross_hamlib_commit=$hamlib_commit
+ runtime_package_sha256="$(hash_package_set)"
+ runtime_sha256="$(hash_runtime_set)"
+ if [ "$runtime_sha256" != "$cross_runtime_sha256" ]; then
+ echo "Runtime GCC library set differs from the cross-builder" >&2
+ exit 1
+ fi
+ {
+ printf 'schema=%s\n' "$ARMHF_CI_IMAGE_SCHEMA"
+ printf 'role=%s\n' "$requested_role"
+ printf 'architecture=%s\n' "$requested_arch"
+ printf 'generation=%s\n' "$requested_generation"
+ printf 'recipe_sha256=%s\n' "$requested_recipe_sha256"
+ printf 'cross_generation=%s\n' "$cross_generation"
+ printf 'cross_recipe_sha256=%s\n' "$cross_recipe_sha256"
+ printf 'cross_toolchain_id=%s\n' "$cross_toolchain_id"
+ printf 'runtime_sha256=%s\n' "$runtime_sha256"
+ printf 'package_sha256=%s\n' "$runtime_package_sha256"
+ printf 'hamlib_ref=%s\n' "$cross_hamlib_ref"
+ printf 'hamlib_commit=%s\n' "$cross_hamlib_commit"
+ printf 'glibc_version=%s\n' "$ARMHF_GLIBC_VERSION"
+ printf 'quadmath_runtime=%s\n' unavailable-on-arm
+ } > "$manifest_dir/image.env"
+ ;;
+ *)
+ echo "Unsupported ARMHF image role: $role" >&2
+ exit 2
+ ;;
+esac