diff options
| author | tony mancill <tmancill@debian.org> | 2026-05-04 20:56:26 -0700 |
|---|---|---|
| committer | tony mancill <tmancill@debian.org> | 2026-05-04 20:56:26 -0700 |
| commit | 968f87a8adf2eadd3a7f4b5000dac88ab0f7dc57 (patch) | |
| tree | f824c17c62d6d03f9348b51a3ae85256492a8814 /.github | |
| parent | c23b939ac13a16e4fa8861a5d2e3053b4d90b512 (diff) | |
| parent | 35a0b17a46923a56ca7f6dc649868609815c70b1 (diff) | |
Merge branch 'debian/latest' into debian/trixie-backports
Diffstat (limited to '.github')
| -rw-r--r-- | .github/dependabot.yml | 14 | ||||
| -rw-r--r-- | .github/scripts/publish-ctest-summary.py | 74 | ||||
| -rw-r--r-- | .github/workflows/build-linux.yml | 297 | ||||
| -rw-r--r-- | .github/workflows/build-macos.yml | 579 | ||||
| -rw-r--r-- | .github/workflows/build-windows.yml | 272 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 77 | ||||
| -rw-r--r-- | .github/workflows/hamlib-upstream-check.yml | 107 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 313 |
8 files changed, 1733 insertions, 0 deletions
diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..cc6090ef --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + labels: + - dependencies + - github-actions + commit-message: + prefix: "ci" + include: scope diff --git a/.github/scripts/publish-ctest-summary.py b/.github/scripts/publish-ctest-summary.py new file mode 100644 index 00000000..26afe98a --- /dev/null +++ b/.github/scripts/publish-ctest-summary.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +"""Render ctest-results.xml (JUnit) as a GitHub Actions step summary. + +Usage: publish-ctest-summary.py <label> [path-to-xml] + +Output goes to stdout; callers redirect into $GITHUB_STEP_SUMMARY. +Missing or malformed XML produces a legible notice rather than a hard fail +so the summary step stays non-blocking (the ctest step is the fail gate). +""" +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + + +def main() -> int: + label = sys.argv[1] if len(sys.argv) > 1 else "" + xml_path = Path(sys.argv[2]) if len(sys.argv) > 2 else Path("ctest-results.xml") + + if not xml_path.exists(): + print(f"## Test Results — {label}") + print() + print(f"No `{xml_path.name}` produced (ctest step did not run or was skipped).") + return 0 + + try: + root = ET.parse(xml_path).getroot() + except ET.ParseError as exc: + print(f"## Test Results — {label}") + print() + print(f"Malformed `{xml_path.name}`: {exc}") + return 0 + + suite = root if root.tag == "testsuite" else root.find("testsuite") + if suite is None: + print(f"## Test Results — {label}") + print() + print("Malformed ctest-results.xml (no `testsuite` element).") + return 0 + + total = int(suite.get("tests", "0")) + failures = int(suite.get("failures", "0")) + errors = int(suite.get("errors", "0")) + skipped = int(suite.get("skipped", "0")) + passed = max(0, total - failures - errors - skipped) + verdict = "PASS" if failures == 0 and errors == 0 else "FAIL" + + print(f"## Test Results — {label} — {verdict}") + print() + print(f"**{passed}/{total} passed** ({failures} failed, {errors} errors, {skipped} skipped)") + print() + print("| Result | Test | Time (s) |") + print("|--------|------|----------|") + for case in suite.findall("testcase"): + name = case.get("name", "?") + raw_time = case.get("time", "") + try: + display_time = f"{float(raw_time):.2f}" + except ValueError: + display_time = raw_time + if case.find("failure") is not None: + result = "FAIL" + elif case.find("error") is not None: + result = "ERROR" + elif case.find("skipped") is not None: + result = "SKIP" + else: + result = "PASS" + print(f"| {result} | `{name}` | {display_time} |") + + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 00000000..38b55845 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,297 @@ +name: Build Linux + +on: + workflow_call: + inputs: + version: + description: "WSJT-X version string" + required: true + type: string + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.0" + arch: + description: "Linux target architecture: x86_64 or aarch64" + required: false + type: string + default: "x86_64" + +jobs: + build: + runs-on: ${{ inputs.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} + steps: + - uses: actions/checkout@v6 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential cmake gfortran \ + libfftw3-dev libboost-all-dev \ + qtbase5-dev qttools5-dev qtmultimedia5-dev libqt5serialport5-dev \ + libqt5sql5-sqlite libqt5websockets5-dev \ + libqt5multimedia5-plugins \ + libusb-1.0-0-dev libudev-dev libreadline-dev \ + autoconf automake libtool pkg-config \ + texinfo \ + dpkg-dev fakeroot \ + asciidoctor \ + rpm + + - name: Cache pFUnit + id: pfunit-cache + uses: actions/cache@v5 + with: + path: pfunit-prefix + key: pfunit-linux-${{ inputs.arch }}-v4.9.0-${{ hashFiles('.github/workflows/build-linux.yml') }} + + - name: Build pFUnit + if: steps.pfunit-cache.outputs.cache-hit != 'true' + run: | + git clone --depth 1 --branch v4.9.0 --recursive \ + https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src + cmake -S pfunit-src -B pfunit-build \ + -DSKIP_MPI=YES \ + -DSKIP_OPENMP=YES \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/pfunit-prefix" + cmake --build pfunit-build -j$(nproc) + cmake --install pfunit-build + + - name: Locate pFUnit config + id: pfunit + run: | + CONFIG=$(find "${GITHUB_WORKSPACE}/pfunit-prefix" -name PFUNITConfig.cmake | head -1) + if [ -z "$CONFIG" ]; then + echo "ERROR: PFUNITConfig.cmake not found under pfunit-prefix" + find "${GITHUB_WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d + exit 1 + fi + PFUNIT_DIR="$(dirname "$CONFIG")" + echo "Found PFUNITConfig.cmake at: $CONFIG" + echo "dir=${PFUNIT_DIR}" >> "$GITHUB_OUTPUT" + + - name: Cache Hamlib + id: hamlib-cache + uses: actions/cache@v5 + with: + path: hamlib-prefix + key: hamlib-linux-${{ inputs.arch }}-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-linux.yml') }} + + - name: Build Hamlib + if: steps.hamlib-cache.outputs.cache-hit != 'true' + run: | + git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ + https://github.com/Hamlib/Hamlib.git hamlib-src + cd hamlib-src + ./bootstrap + ./configure \ + --prefix="${GITHUB_WORKSPACE}/hamlib-prefix" \ + --disable-shared --enable-static \ + --without-cxx-binding \ + CFLAGS="-g -O2 -fPIC -fdata-sections -ffunction-sections" \ + LDFLAGS="-Wl,--gc-sections" + make -j$(nproc) + make install + + - name: Configure + run: | + cmake -S . -B wsjtx-build \ + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/hamlib-prefix;${GITHUB_WORKSPACE}/pfunit-prefix" \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DWSJT_SKIP_MANPAGES=ON \ + -DWSJT_BUILD_TESTS=ON \ + -DPFUNIT_DIR="${{ steps.pfunit.outputs.dir }}" \ + -Wno-dev + + - name: Build + run: cmake --build wsjtx-build -j$(nproc) + + - name: Run tests + id: ctest + run: ctest --output-on-failure --output-junit ctest-results.xml + working-directory: wsjtx-build + env: + QT_QPA_PLATFORM: offscreen + + - name: Publish test summary + if: always() && steps.ctest.conclusion != 'skipped' + working-directory: wsjtx-build + run: python3 ../.github/scripts/publish-ctest-summary.py "Linux ${{ inputs.arch }}" >> "$GITHUB_STEP_SUMMARY" + + - name: Upload test results + if: always() && steps.ctest.conclusion != 'skipped' + uses: actions/upload-artifact@v7 + with: + name: ctest-results-linux-${{ inputs.arch }} + path: wsjtx-build/ctest-results.xml + if-no-files-found: ignore + + - name: Verify binary + run: | + file wsjtx-build/jt9 + file wsjtx-build/jt9 | grep -q "ELF 64-bit" + + # CMakeLists.txt:1989-2012 enables CPack's DEB generator when + # dpkg-buildpackage is on the path (provided by dpkg-dev, installed + # above). The DEB generator ignores CPACK_PACKAGE_FILE_NAME and + # uses its own CPACK_DEBIAN_FILE_NAME (default <pkg>_<ver>_<arch>.deb + # → wsjtx_3.0.1_amd64.deb regardless). Override that variable to + # align the filename with the AppImage/installer naming used by + # the rest of the pipeline. + - name: Package .deb + env: + VERSION: ${{ inputs.version }} + ARCH: ${{ inputs.arch }} + run: | + cd wsjtx-build + cpack -G DEB \ + -D "CPACK_DEBIAN_FILE_NAME=wsjtx-${VERSION}-linux-${ARCH}.deb" + DEB="wsjtx-${VERSION}-linux-${ARCH}.deb" + if [ ! -f "$DEB" ]; then + echo "::error::cpack -G DEB produced no .deb at expected path: $DEB" + ls -la *.deb 2>/dev/null || true + exit 1 + fi + ls -lh "$DEB" + file "$DEB" + dpkg-deb --info "$DEB" | head -20 + + - name: Upload .deb + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}-deb + path: wsjtx-build/wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}.deb + if-no-files-found: error + + # RPM builds via the same CPack scaffolding the .deb step above + # uses. CMakeLists.txt:2014-2026 already auto-detects rpmbuild and + # sets the Fedora-style dependency list (qt5-qtbase >= 5.9, fftw- + # libs-single, boost-log, etc.); only the workflow side was + # missing. `-G RPM` is explicit so this step doesn't accidentally + # rebuild the .deb already produced above. + - name: Package RPM + working-directory: wsjtx-build + run: | + cpack -G RPM + ls -lh *.rpm + + - name: Smoke-test RPM + working-directory: wsjtx-build + run: | + RPM=$(ls *.rpm | head -1) + echo "Querying $RPM" + rpm -qpi "$RPM" + rpm -qpR "$RPM" + rpm -qpl "$RPM" | head -40 + # Confirm the core binaries are in the package. + rpm -qpl "$RPM" | grep -qE '/bin/wsjtx$' + rpm -qpl "$RPM" | grep -qE '/bin/jt9$' + + - name: Upload RPM + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}-rpm + path: wsjtx-build/*.rpm + if-no-files-found: error + + - name: Install to AppDir + run: | + cmake --install wsjtx-build --prefix "${GITHUB_WORKSPACE}/AppDir/usr" + # linuxdeploy's desktop/icon integration needs these exact paths. + test -x AppDir/usr/bin/wsjtx + test -x AppDir/usr/bin/jt9 + test -x AppDir/usr/bin/ft8code + test -f AppDir/usr/share/applications/wsjtx.desktop + test -f AppDir/usr/share/pixmaps/wsjtx_icon.png + + - name: Package AppImage + env: + VERSION: ${{ inputs.version }} + ARCH: ${{ inputs.arch }} + # Core linuxdeploy is pinned to a dated release + SHA256 verify + # so an undetected upstream change fails the build instead of + # shipping. The Qt5 plugin stays on the rolling "continuous" + # channel because upstream has not cut a dated release since + # 1-alpha-20250213-1, which carries a filesystem_error bug on + # ubuntu-24.04 / Qt5.15 (missing qt5/plugins/mediaservice dir). + # When upstream publishes a newer dated plugin release, pin + + # verify it here too. + LINUXDEPLOY_TAG: "1-alpha-20251107-1" + run: | + case "$ARCH" in + x86_64) LINUXDEPLOY_SHA256="c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d" ;; + aarch64) LINUXDEPLOY_SHA256="620095110d693282b8ebeb244a95b5e911cf8f65f76c88b4b47d16ae6346fcff" ;; + *) echo "::error::Unknown linuxdeploy arch: $ARCH"; exit 1 ;; + esac + curl -fsSL -o linuxdeploy.AppImage \ + "https://github.com/linuxdeploy/linuxdeploy/releases/download/${LINUXDEPLOY_TAG}/linuxdeploy-${ARCH}.AppImage" + curl -fsSL -o linuxdeploy-plugin-qt.AppImage \ + "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${ARCH}.AppImage" + echo "${LINUXDEPLOY_SHA256} linuxdeploy.AppImage" | sha256sum -c - + chmod +x linuxdeploy.AppImage linuxdeploy-plugin-qt.AppImage + + # --appimage-extract-and-run avoids FUSE on the hosted runner. + export OUTPUT="wsjtx-${VERSION}-linux-${ARCH}.AppImage" + ./linuxdeploy.AppImage --appimage-extract-and-run \ + --appdir AppDir \ + --plugin qt \ + --output appimage \ + --desktop-file AppDir/usr/share/applications/wsjtx.desktop \ + --icon-file AppDir/usr/share/pixmaps/wsjtx_icon.png + + ls -lh "$OUTPUT" + file "$OUTPUT" + + - name: Smoke-test AppImage payload + env: + VERSION: ${{ inputs.version }} + ARCH: ${{ inputs.arch }} + run: | + APPIMAGE="wsjtx-${VERSION}-linux-${ARCH}.AppImage" + ./"$APPIMAGE" --appimage-extract >/dev/null + test -x squashfs-root/usr/bin/wsjtx + test -x squashfs-root/usr/bin/jt9 + test -x squashfs-root/usr/bin/ft8code + test -x squashfs-root/usr/bin/wsprd + file squashfs-root/usr/bin/wsjtx | grep -q "ELF 64-bit" + # Qt5 libs should have been bundled by linuxdeploy-plugin-qt. + ls squashfs-root/usr/lib/ | grep -q "^libQt5Core\.so" + ls squashfs-root/usr/lib/ | grep -q "^libQt5Widgets\.so" + ls squashfs-root/usr/lib/ | grep -q "^libQt5Multimedia\.so" + # Verify Qt audio backend plugins were bundled. Without them, + # QAudioDeviceInfo::availableDevices() returns empty at runtime + # and the user sees "no audio devices" — observed in v3.0.1 on + # Linux Lite. linuxdeploy-plugin-qt only WARNS when these are + # absent on the build host, it doesn't fail. + # Linux shared objects are conventionally `lib*.so` so the + # bundled plugins are libqtaudio_alsa.so and libqtmedia_pulse.so. + audio_plugins=$(find squashfs-root -path '*/plugins/audio/*.so' 2>/dev/null) + if [ -z "$audio_plugins" ]; then + echo "::error::No Qt audio backend plugins (qtaudio_alsa/qtaudio_pulse) bundled in AppImage." + echo "::error::Install libqt5multimedia5-plugins on the build host so linuxdeploy-plugin-qt can find them." + echo "AppImage plugin tree:" + find squashfs-root -path '*/plugins/*' -name '*.so' 2>/dev/null | head -20 + exit 1 + fi + echo "Qt audio plugins bundled:" + echo "$audio_plugins" + rm -rf squashfs-root + + - name: Upload AppImage + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}-AppImage + path: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }}.AppImage + if-no-files-found: error + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-linux-${{ inputs.arch }} + path: | + wsjtx-build/jt9 + wsjtx-build/wsprd + wsjtx-build/wsjtx diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 00000000..657af14e --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,579 @@ +name: Build macOS + +on: + workflow_call: + inputs: + version: + description: "WSJT-X version string" + required: true + type: string + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.0" + arch: + description: "Target architecture (arm64 or x86_64)" + required: true + type: string + runner: + description: "GitHub Actions runner label" + required: true + type: string + deployment_target: + description: "macOS deployment target version" + required: true + type: string + +jobs: + build: + runs-on: ${{ inputs.runner }} + steps: + - uses: actions/checkout@v6 + + - name: Check signing secrets + id: check_secrets + env: + APP_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} + run: | + if [ -n "$APP_P12" ]; then + echo "signing_enabled=true" >> "$GITHUB_OUTPUT" + else + echo "signing_enabled=false" >> "$GITHUB_OUTPUT" + echo "::notice::macOS signing skipped — secrets unavailable (Dependabot or fork PR context). Compile + tests + dylib bundling still validated." + fi + + - name: Set Homebrew prefix + run: echo "HOMEBREW_PREFIX=$(brew --prefix)" >> "$GITHUB_ENV" + + - name: Install dependencies + run: brew install cmake gcc fftw boost qt@5 libusb dylibbundler autoconf automake libtool asciidoctor + + - name: Locate gfortran + id: fc + run: | + FC="$(brew --prefix gcc)/bin/gfortran" + [ -f "$FC" ] || FC="$(ls $HOMEBREW_PREFIX/bin/gfortran-* 2>/dev/null | sort -V | tail -1)" + echo "Found gfortran: $FC" + echo "path=$FC" >> "$GITHUB_OUTPUT" + + - name: Fix Qt5 keg-only paths + run: | + QT5_PREFIX="$(brew --prefix qt@5)" + [ -e $HOMEBREW_PREFIX/mkspecs ] || sudo ln -s "${QT5_PREFIX}/mkspecs" $HOMEBREW_PREFIX/mkspecs + [ -e $HOMEBREW_PREFIX/plugins ] || sudo ln -s "${QT5_PREFIX}/plugins" $HOMEBREW_PREFIX/plugins + + - name: Cache pFUnit + id: pfunit-cache + uses: actions/cache@v5 + with: + path: pfunit-prefix + key: pfunit-macos-${{ inputs.arch }}-v4.9.0-${{ hashFiles('.github/workflows/build-macos.yml') }} + + - name: Build pFUnit + if: steps.pfunit-cache.outputs.cache-hit != 'true' + run: | + git clone --depth 1 --branch v4.9.0 --recursive \ + https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src + cmake -S pfunit-src -B pfunit-build \ + -DSKIP_MPI=YES \ + -DSKIP_OPENMP=YES \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_Fortran_COMPILER="${{ steps.fc.outputs.path }}" \ + -DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/pfunit-prefix" + cmake --build pfunit-build -j$(sysctl -n hw.ncpu) + cmake --install pfunit-build + + - name: Locate pFUnit config + id: pfunit + run: | + CONFIG=$(find "${GITHUB_WORKSPACE}/pfunit-prefix" -name PFUNITConfig.cmake | head -1) + if [ -z "$CONFIG" ]; then + echo "ERROR: PFUNITConfig.cmake not found under pfunit-prefix" + find "${GITHUB_WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d + exit 1 + fi + PFUNIT_DIR="$(dirname "$CONFIG")" + echo "Found PFUNITConfig.cmake at: $CONFIG" + echo "dir=${PFUNIT_DIR}" >> "$GITHUB_OUTPUT" + + - name: Cache Hamlib + id: hamlib-cache + uses: actions/cache@v5 + with: + path: hamlib-prefix + key: hamlib-macos-${{ inputs.arch }}-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-macos.yml') }} + + - name: Build Hamlib + if: steps.hamlib-cache.outputs.cache-hit != 'true' + run: | + git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ + https://github.com/Hamlib/Hamlib.git hamlib-src + cd hamlib-src + ./bootstrap + ./configure \ + --prefix="${GITHUB_WORKSPACE}/hamlib-prefix" \ + --disable-shared --enable-static \ + --without-cxx-binding + make -j$(sysctl -n hw.ncpu) + make install + + - name: Configure + run: | + cmake -S . -B wsjtx-build \ + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/hamlib-prefix;${GITHUB_WORKSPACE}/pfunit-prefix;$(brew --prefix qt@5);$(brew --prefix libusb);$(brew --prefix fftw);$(brew --prefix boost)" \ + -DCMAKE_Fortran_COMPILER="${{ steps.fc.outputs.path }}" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ inputs.deployment_target }} \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DWSJT_SKIP_MANPAGES=ON \ + -DWSJT_BUILD_TESTS=ON \ + -DPFUNIT_DIR="${{ steps.pfunit.outputs.dir }}" \ + -Wno-dev + + - name: Build + run: cmake --build wsjtx-build -j$(sysctl -n hw.ncpu) + + - name: Run tests + id: ctest + run: ctest --output-on-failure --output-junit ctest-results.xml + working-directory: wsjtx-build + + - name: Publish test summary + if: always() && steps.ctest.conclusion != 'skipped' + working-directory: wsjtx-build + run: python3 ../.github/scripts/publish-ctest-summary.py "macOS ${{ inputs.arch }}" >> "$GITHUB_STEP_SUMMARY" + + - name: Upload test results + if: always() && steps.ctest.conclusion != 'skipped' + uses: actions/upload-artifact@v7 + with: + name: ctest-results-macos-${{ inputs.arch }} + path: wsjtx-build/ctest-results.xml + if-no-files-found: ignore + + - name: Verify architecture + run: | + file wsjtx-build/jt9 + lipo -archs wsjtx-build/jt9 | grep -q ${{ inputs.arch }} + + - name: Collect binaries + id: collect + run: | + BUILD=wsjtx-build + STAGE=stage/wsjtx-${{ inputs.version }}-${{ inputs.arch }} + ASSETS=assets + + mkdir -p "${STAGE}" "${ASSETS}" + + cp -R "${BUILD}/wsjtx.app" "${STAGE}/" + + for bin in jt9 wsprd; do + [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${STAGE}/wsjtx.app/Contents/MacOS/" + done + + for bin in jt9 wsprd wsprcode jt65code jt4code ft8code q65code encode77 fcal hash22calc; do + [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${STAGE}/" && cp "${BUILD}/${bin}" "${ASSETS}/" + done + + for bin in ft4sim jt4sim jt65sim cwsim sfoxsim echosim EchoCallSim; do + [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${STAGE}/" && cp "${BUILD}/${bin}" "${ASSETS}/" + done + + echo "stage_dir=${STAGE}" >> "$GITHUB_OUTPUT" + echo "assets_dir=${ASSETS}" >> "$GITHUB_OUTPUT" + + - name: Bundle dylibs into app + run: | + STAGE="${{ steps.collect.outputs.stage_dir }}" + APP="${STAGE}/wsjtx.app" + FRAMEWORKS="${APP}/Contents/Frameworks" + GCC_LIB="$(brew --prefix gcc)/lib/gcc/current" + mkdir -p "${FRAMEWORKS}" + + "$(brew --prefix qt@5)/bin/macdeployqt" "${APP}" -verbose=1 + + resolve_lib() { + local lib="$1" + if [[ "$lib" == $HOMEBREW_PREFIX/* ]]; then + echo "$lib" + elif [[ "$lib" == @rpath/* ]]; then + local name="${lib#@rpath/}" + for dir in "$GCC_LIB" "$HOMEBREW_PREFIX/lib"; do + [ -f "$dir/$name" ] && echo "$dir/$name" && return + done + fi + } + + bundle_dylib() { + local binary="$1" + for lib in $(otool -L "$binary" | awk '{print $1}' | grep -E "($HOMEBREW_PREFIX|@rpath)" | grep -v Qt); do + local resolved + resolved=$(resolve_lib "$lib") + [ -z "$resolved" ] && continue + local libname=$(basename "$resolved") + if [ ! -f "${FRAMEWORKS}/${libname}" ]; then + echo " Bundling: $resolved -> ${FRAMEWORKS}/${libname}" + cp "$resolved" "${FRAMEWORKS}/${libname}" + chmod 644 "${FRAMEWORKS}/${libname}" + install_name_tool -id "@executable_path/../Frameworks/${libname}" "${FRAMEWORKS}/${libname}" + bundle_dylib "${FRAMEWORKS}/${libname}" + fi + install_name_tool -change "$lib" "@executable_path/../Frameworks/${libname}" "$binary" 2>/dev/null || true + done + } + + for exe in "${APP}/Contents/MacOS/"*; do + [ -f "$exe" ] && [ -x "$exe" ] && { + bundle_dylib "$exe" + for fw in $(otool -L "$exe" | awk '{print $1}' | grep '\.framework/'); do + fwname=$(basename "$fw") + bundled=$(find "${FRAMEWORKS}" -name "${fwname}" -path "*.framework/*" 2>/dev/null | head -1) + if [ -n "$bundled" ]; then + fwrel="${bundled#${APP}/Contents/}" + install_name_tool -change "$fw" "@executable_path/../${fwrel}" "$exe" 2>/dev/null || true + fi + done + } + done + + for fw in "${FRAMEWORKS}"/*.dylib; do + [ -f "$fw" ] && bundle_dylib "$fw" + done + + echo "Checking for remaining external references..." + REMAINING=$(find "${APP}/Contents/MacOS" -type f -perm +111 -exec otool -L {} \; 2>/dev/null | grep "$HOMEBREW_PREFIX" || true) + if [ -n "$REMAINING" ]; then + echo "WARNING: External paths still present:" + echo "$REMAINING" + else + echo "All dylibs bundled successfully" + fi + + - name: Bundle dylibs into CLI tools + run: | + ASSETS="${{ steps.collect.outputs.assets_dir }}" + STAGE="${{ steps.collect.outputs.stage_dir }}" + LIBDIR="${ASSETS}/lib" + mkdir -p "${LIBDIR}" + + BUNDLE_ARGS="" + for bin in "${ASSETS}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] && { + BUNDLE_ARGS="$BUNDLE_ARGS -x $bin" + } + done + dylibbundler -od -b $BUNDLE_ARGS -d "${LIBDIR}/" -p @loader_path/lib/ + + QT5="$(brew --prefix qt@5)/lib" + for bin in "${ASSETS}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] || continue + for fw in $(otool -L "$bin" | awk '{print $1}' | grep '\.framework/'); do + fwname=$(basename "$fw") + if [ ! -f "${LIBDIR}/${fwname}" ]; then + echo " Bundling framework: ${fwname}" + cp "$fw" "${LIBDIR}/${fwname}" + chmod 644 "${LIBDIR}/${fwname}" + install_name_tool -id "@loader_path/lib/${fwname}" "${LIBDIR}/${fwname}" + dylibbundler -b -x "${LIBDIR}/${fwname}" -d "${LIBDIR}/" -p @loader_path/ 2>/dev/null || true + fi + install_name_tool -change "$fw" "@loader_path/lib/${fwname}" "$bin" + codesign --force --sign - "$bin" + done + done + + for lib in "${LIBDIR}"/*; do + [ -f "$lib" ] || continue + for dep in $(otool -L "$lib" | awk '{print $1}' | grep '@loader_path/lib/'); do + depname=$(basename "$dep") + install_name_tool -change "$dep" "@loader_path/${depname}" "$lib" 2>/dev/null || true + done + RPATHS=$(otool -l "$lib" | grep -A2 LC_RPATH | grep "path " | awk '{print $2}' | sort | uniq -d) + for rp in $RPATHS; do + install_name_tool -delete_rpath "$rp" "$lib" 2>/dev/null || true + install_name_tool -add_rpath "$rp" "$lib" 2>/dev/null || true + done + codesign --force --sign - "$lib" + done + + echo "Verifying CLI tools..." + for bin in "${ASSETS}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] && { + BAD=$(otool -L "$bin" | grep "$HOMEBREW_PREFIX" || true) + if [ -n "$BAD" ]; then + echo "ERROR: $(basename "$bin") still has Homebrew refs:" + echo "$BAD" + exit 1 + fi + } + done + echo "All CLI tools are self-contained" + + cp -R "${LIBDIR}" "${STAGE}/lib" + for bin in "${ASSETS}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] && { + cp "$bin" "${STAGE}/$(basename "$bin")" + } + done + + - name: Import signing certificates + if: steps.check_secrets.outputs.signing_enabled == 'true' + env: + APP_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} + APP_P12_PW: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }} + INST_P12: ${{ secrets.DEVELOPER_ID_INSTALLER_P12 }} + INST_P12_PW: ${{ secrets.DEVELOPER_ID_INSTALLER_PASSWORD }} + run: | + KEYCHAIN_PATH="$RUNNER_TEMP/signing.keychain-db" + KEYCHAIN_PASSWORD="$(openssl rand -hex 16)" + + security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" + security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + + echo "$APP_P12" | base64 --decode > "$RUNNER_TEMP/app.p12" + security import "$RUNNER_TEMP/app.p12" -P "$APP_P12_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" + + echo "$INST_P12" | base64 --decode > "$RUNNER_TEMP/installer.p12" + security import "$RUNNER_TEMP/installer.p12" -P "$INST_P12_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" + + security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain-db + + APP_IDENTITY=$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep "Developer ID Application" | head -1 | awk -F'"' '{print $2}') + INST_IDENTITY=$(security find-identity -v "$KEYCHAIN_PATH" | grep "Developer ID Installer" | head -1 | awk -F'"' '{print $2}') + echo "App identity: $APP_IDENTITY" + echo "Installer identity: $INST_IDENTITY" + echo "identity=$APP_IDENTITY" >> "$GITHUB_OUTPUT" + echo "installer_identity=$INST_IDENTITY" >> "$GITHUB_OUTPUT" + id: keychain + + # ALWAYS runs. Real Developer ID when secrets are present, ad-hoc + # signing (-) otherwise. Mirrors the Windows self-signed-sandbox + # pattern in build-windows.yml: prove the signing step is wired, + # rely on a real cert in production. Ad-hoc signing produces a + # structurally-valid signature with no Apple trust chain — pkg + # will not pass Gatekeeper without right-click→Open, but is + # well-formed and the all-platforms-ready gate in release.yml + # finds the artifact at the expected path. + - name: Code sign binaries + run: | + STAGE="${{ steps.collect.outputs.stage_dir }}" + ASSETS="${{ steps.collect.outputs.assets_dir }}" + APP="${STAGE}/wsjtx.app" + ENTITLEMENTS="${GITHUB_WORKSPACE}/entitlements.plist" + + if [ "${{ steps.check_secrets.outputs.signing_enabled }}" = "true" ]; then + IDENTITY="${{ steps.keychain.outputs.identity }}" + TS="--timestamp" + echo "Code signing mode: Developer ID (real)" + else + IDENTITY="-" + TS="" + echo "Code signing mode: ad-hoc (no Apple trust chain; pkg will be unsigned)" + fi + + # entitlements.plist declares com.apple.security.cs.disable- + # library-validation, which is required for any app bundling + # its own non-system frameworks (Qt, etc.) under hardened + # runtime — otherwise dyld refuses to load them. Applied on + # both signing paths: the real-cert path needs it for + # notarization-friendly distribution; the ad-hoc path needs + # it because each ad-hoc signature has its own pseudo-Team-ID + # so the main binary and bundled frameworks never match. + # (The plist is non-empty, so macos-15-intel's codesign now + # parses it cleanly — no need for the conditional that PR #23 + # introduced as a workaround for the empty-plist parser bug.) + find "${APP}/Contents/Frameworks" -type f \( -name "*.dylib" -o -perm +111 \) \ + -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; + find "${APP}/Contents/Frameworks" -name "*.framework" -type d | while read fw; do + codesign --force --options runtime $TS --sign "$IDENTITY" "$fw" + done + find "${APP}/Contents/PlugIns" -type f -name "*.dylib" \ + -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; 2>/dev/null || true + + find "${APP}/Contents/MacOS" -type f -perm +111 \ + -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" {} \; + # Bundle-level codesign re-signs the main executable. --force + # without --entitlements would WIPE the entitlements applied + # in the previous step (PR #27 missed this — rc1 shipped with + # an unentitled wsjtx binary, so disable-library-validation + # never took effect and the dyld load of QtSerialPort still + # failed with mismatched Team IDs). + codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" "${APP}" + codesign --verify --deep --strict --verbose=2 "${APP}" + + # Defensive: confirm the entitlement actually made it onto + # the main binary. `codesign --verify` doesn't check + # entitlement presence — it only validates the signature + # itself — so a re-sign that wipes entitlements would still + # pass verify (that's how rc1 shipped broken). + MAIN_BIN="${APP}/Contents/MacOS/wsjtx" + if ! codesign -d --entitlements - "$MAIN_BIN" 2>/dev/null | grep -q "disable-library-validation"; then + echo "::error::wsjtx binary is missing com.apple.security.cs.disable-library-validation entitlement." + echo "::error::Bundled Qt frameworks will fail to load under hardened runtime." + codesign -d --entitlements - "$MAIN_BIN" || true + exit 1 + fi + echo "Confirmed disable-library-validation entitlement on $MAIN_BIN" + + for dir in "${STAGE}" "${ASSETS}"; do + find "${dir}" -maxdepth 1 -type f -perm +111 \ + -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" {} \; + done + + for dir in "${STAGE}/lib" "${ASSETS}/lib"; do + [ -d "$dir" ] && find "$dir" -type f \ + -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; + done + + # ALWAYS runs. productbuild signs with the Developer ID Installer + # cert when secrets are present; produces an unsigned .pkg + # otherwise. Either way the artifact is named identically and + # satisfies the all-platforms-ready gate in release.yml. + - name: Build installer pkg + run: | + STAGE="${{ steps.collect.outputs.stage_dir }}" + PKG_ID="org.k1jt.wsjtx.${{ inputs.arch }}" + PKG_VERSION="${{ inputs.version }}" + + PAYLOAD="$RUNNER_TEMP/pkg-payload" + SCRIPTS="$RUNNER_TEMP/pkg-scripts" + mkdir -p "${PAYLOAD}/Applications" "${PAYLOAD}/Library/LaunchDaemons" "${SCRIPTS}" + + cp -R "${STAGE}/wsjtx.app" "${PAYLOAD}/Applications/" + + mkdir -p "${PAYLOAD}/usr/local/wsjtx/lib" + for bin in "${STAGE}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] && cp "$bin" "${PAYLOAD}/usr/local/wsjtx/" + done + [ -d "${STAGE}/lib" ] && cp -R "${STAGE}/lib/"* "${PAYLOAD}/usr/local/wsjtx/lib/" + + cp "Darwin/com.wsjtx.sysctl.plist" "${PAYLOAD}/Library/LaunchDaemons/" + + cat > "${SCRIPTS}/postinstall" << 'SCRIPT' + #!/bin/bash + /bin/launchctl load /Library/LaunchDaemons/com.wsjtx.sysctl.plist 2>/dev/null || true + /usr/sbin/sysctl kern.sysv.shmmax=52428800 kern.sysv.shmall=25600 2>/dev/null || true + mkdir -p /usr/local/bin + for bin in /usr/local/wsjtx/*; do + [ -f "$bin" ] && [ -x "$bin" ] && ln -sf "$bin" "/usr/local/bin/$(basename "$bin")" + done + SCRIPT + chmod +x "${SCRIPTS}/postinstall" + + pkgbuild --analyze --root "${PAYLOAD}" "$RUNNER_TEMP/components.plist" + /usr/libexec/PlistBuddy -c "Set :0:BundleIsRelocatable false" "$RUNNER_TEMP/components.plist" 2>/dev/null || true + + pkgbuild \ + --root "${PAYLOAD}" \ + --scripts "${SCRIPTS}" \ + --component-plist "$RUNNER_TEMP/components.plist" \ + --identifier "${PKG_ID}" \ + --version "${PKG_VERSION}" \ + --install-location / \ + "$RUNNER_TEMP/wsjtx-component.pkg" + + PKG_OUT="wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg" + if [ "${{ steps.check_secrets.outputs.signing_enabled }}" = "true" ]; then + INST_IDENTITY="${{ steps.keychain.outputs.installer_identity }}" + productbuild \ + --package "$RUNNER_TEMP/wsjtx-component.pkg" \ + --sign "$INST_IDENTITY" \ + "$PKG_OUT" + else + productbuild \ + --package "$RUNNER_TEMP/wsjtx-component.pkg" \ + "$PKG_OUT" + fi + + - name: Notarize pkg + if: steps.check_secrets.outputs.signing_enabled == 'true' + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + run: | + notarize_and_staple() { + local file="$1" + echo "Notarizing: $file" + xcrun notarytool submit "$file" \ + --apple-id "$APPLE_ID" \ + --password "$APPLE_ID_PASSWORD" \ + --team-id "$APPLE_TEAM_ID" \ + --wait 2>&1 | tee notarize.log + + if grep -q "status: Invalid" notarize.log; then + SUBMISSION_ID=$(grep "id:" notarize.log | head -1 | awk '{print $2}') + xcrun notarytool log "$SUBMISSION_ID" \ + --apple-id "$APPLE_ID" \ + --password "$APPLE_ID_PASSWORD" \ + --team-id "$APPLE_TEAM_ID" || true + exit 1 + fi + + xcrun stapler staple "$file" + } + + notarize_and_staple "wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg" + + - name: Notarize CLI tools + if: steps.check_secrets.outputs.signing_enabled == 'true' + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + run: | + ASSETS="${{ steps.collect.outputs.assets_dir }}" + zip -r cli-tools.zip "${ASSETS}"/ + xcrun notarytool submit cli-tools.zip \ + --apple-id "$APPLE_ID" \ + --password "$APPLE_ID_PASSWORD" \ + --team-id "$APPLE_TEAM_ID" \ + --wait 2>&1 | tee notarize-cli.log + + if grep -q "status: Invalid" notarize-cli.log; then + SUBMISSION_ID=$(grep "id:" notarize-cli.log | head -1 | awk '{print $2}') + xcrun notarytool log "$SUBMISSION_ID" \ + --apple-id "$APPLE_ID" \ + --password "$APPLE_ID_PASSWORD" \ + --team-id "$APPLE_TEAM_ID" || true + exit 1 + fi + rm cli-tools.zip + + - name: Clean up keychain + if: always() && steps.check_secrets.outputs.signing_enabled == 'true' + run: security delete-keychain "$RUNNER_TEMP/signing.keychain-db" 2>/dev/null || true + + - name: Upload pkg + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg + path: wsjtx-${{ inputs.version }}-${{ inputs.arch }}-macOS.pkg + + - name: Package individual binaries + run: | + # Tarball and inner-dir names include the arch suffix so arm64 + # and x86_64 per-binary artifacts can coexist in a single + # GitHub Release without ReleaseAsset.name collisions (#24). + ASSETS="${{ steps.collect.outputs.assets_dir }}" + ARCH="${{ inputs.arch }}" + PKGS=packages + mkdir -p "${PKGS}" + for bin in "${ASSETS}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] || continue + name=$(basename "$bin") + arch_name="${name}-${ARCH}" + dir="${PKGS}/${arch_name}" + mkdir -p "${dir}" + cp "$bin" "${dir}/" + [ -d "${ASSETS}/lib" ] && cp -R "${ASSETS}/lib" "${dir}/lib" + tar -czf "${PKGS}/${arch_name}.tar.gz" -C "${PKGS}" "${arch_name}" + rm -rf "${dir}" + done + + - name: Upload individual binaries + uses: actions/upload-artifact@v7 + with: + name: individual-binaries-macos-${{ inputs.arch }} + path: packages/*.tar.gz diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..fd0f14a5 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,272 @@ +name: Build Windows x86_64 + +on: + workflow_call: + inputs: + version: + description: "WSJT-X version string" + required: true + type: string + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.0" + +jobs: + build: + runs-on: windows-latest + defaults: + run: + shell: msys2 {0} + steps: + # windows-latest's git defaults to core.autocrlf=true, which converts + # text-file line endings during checkout. The converted working tree + # then differs from the index, so cmake/getsvn.cmake's git_local_changes + # reports DIRTY and the resulting binary's About tab shows + # "wsjtx-<ver>-<sha>-dirty". Disable autocrlf before checkout so the + # working tree matches the index exactly. (No-op on macOS/Linux runners, + # which already default to autocrlf=false; this fix is Windows-only.) + - name: Disable core.autocrlf before checkout + shell: pwsh + run: git config --global core.autocrlf false + + - uses: actions/checkout@v6 + + - uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + cache: true + install: >- + git make tar + mingw-w64-x86_64-gcc + mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-cmake + mingw-w64-x86_64-qt5-base + mingw-w64-x86_64-qt5-multimedia + mingw-w64-x86_64-qt5-serialport + mingw-w64-x86_64-qt5-svg + mingw-w64-x86_64-qt5-tools + mingw-w64-x86_64-qt5-websockets + mingw-w64-x86_64-qt5-activeqt + mingw-w64-x86_64-fftw + mingw-w64-x86_64-boost + mingw-w64-x86_64-libusb + mingw-w64-x86_64-portaudio + mingw-w64-x86_64-pkg-config + mingw-w64-x86_64-nsis + mingw-w64-x86_64-osslsigncode + mingw-w64-x86_64-ruby + autoconf automake libtool + + # asciidoctor is a Ruby gem (no native MSYS2 package) — needed by + # doc/CMakeLists.txt to build the WSJT-X user guide HTML referenced + # by Help → Local User Guide. + - name: Install asciidoctor (Ruby gem) + run: gem install asciidoctor --no-document + + - name: Cache pFUnit + id: pfunit-cache + uses: actions/cache@v5 + with: + path: pfunit-prefix + key: pfunit-windows-v4.9.0-${{ hashFiles('.github/workflows/build-windows.yml') }} + + - name: Build pFUnit + if: steps.pfunit-cache.outputs.cache-hit != 'true' + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + git config --global core.longpaths true + git clone --depth 1 --branch v4.9.0 --recursive \ + https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src + cmake -S pfunit-src -B pfunit-build -G "MSYS Makefiles" \ + -DSKIP_MPI=YES \ + -DSKIP_OPENMP=YES \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/pfunit-prefix" + cmake --build pfunit-build -j$(nproc) + cmake --install pfunit-build + + - name: Locate pFUnit config + id: pfunit + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + # Locate each sub-package's config directly — MSYS2 pkg-config + # interacts badly with multi-entry CMAKE_PREFIX_PATH, so we pass + # explicit <pkg>_DIR hints instead. + for pkg in PFUNIT GFTL GFTL_SHARED FARGPARSE; do + CONFIG=$(find "${WORKSPACE}/pfunit-prefix" -name ${pkg}Config.cmake | head -1) + if [ -z "$CONFIG" ]; then + echo "ERROR: ${pkg}Config.cmake not found under pfunit-prefix" + find "${WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d + exit 1 + fi + DIR="$(dirname "$CONFIG")" + echo "Found ${pkg}Config.cmake at: $CONFIG" + echo "$(echo $pkg | tr '[:upper:]' '[:lower:]')_dir=${DIR}" >> "$GITHUB_OUTPUT" + done + + - name: Cache Hamlib + id: hamlib-cache + uses: actions/cache@v5 + with: + path: hamlib-prefix + key: hamlib-windows-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-windows.yml') }} + + - name: Build Hamlib + if: steps.hamlib-cache.outputs.cache-hit != 'true' + env: + MSYS2_PATH_TYPE: inherit + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ + https://github.com/Hamlib/Hamlib.git hamlib-src + cd hamlib-src + ./bootstrap + ./configure \ + --prefix="${WORKSPACE}/hamlib-prefix" \ + --enable-shared --disable-static \ + --without-cxx-binding \ + --without-readline \ + CFLAGS="-DNDEBUG -g -O2 -fdata-sections -ffunction-sections" \ + LDFLAGS="-Wl,--gc-sections" + make -j$(nproc) + make install-strip + + - name: Install OmniRig + shell: pwsh + run: | + # Download OmniRig (provides type library embedded in OmniRig.exe for dumpcpp) + Invoke-WebRequest -Uri "https://www.dxatlas.com/OmniRig/Files/OmniRig.zip" -OutFile OmniRig.zip + Expand-Archive -Path OmniRig.zip -DestinationPath omnirig-extract + # Run the installer silently (InnoSetup) + $setup = Get-ChildItem -Path omnirig-extract -Filter "*.exe" -Recurse | Select-Object -First 1 + if (-not $setup) { throw "No installer found in OmniRig.zip" } + Start-Process -FilePath $setup.FullName -ArgumentList '/VERYSILENT','/NORESTART' -Wait + # Locate the installed OmniRig.exe (embeds the COM type library) + $omnirig = Get-ChildItem -Path "C:\Program Files*\Afreet\OmniRig" -Filter "OmniRig.exe" -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 + if (-not $omnirig) { throw "OmniRig install failed — OmniRig.exe not found" } + echo "OMNIRIG_PATH=$($omnirig.FullName)" >> $env:GITHUB_ENV + + - name: Fix dumpcpp name (MSYS2 ships dumpcpp-qt5, CMake expects dumpcpp) + run: | + ln -sf /mingw64/bin/dumpcpp-qt5.exe /mingw64/bin/dumpcpp.exe + + - name: Configure + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + OMNIRIG=$(cygpath "${OMNIRIG_PATH}") + cmake -G "MSYS Makefiles" -S . -B wsjtx-build \ + -DCMAKE_PREFIX_PATH="${WORKSPACE}/hamlib-prefix" \ + -DOMNIRIG_TYPE_LIB="${OMNIRIG}" \ + -DWSJT_SKIP_MAP65=ON \ + -DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch -std=legacy" \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DWSJT_SKIP_MANPAGES=ON \ + -DWSJT_BUILD_TESTS=ON \ + -DPFUNIT_DIR="${{ steps.pfunit.outputs.pfunit_dir }}" \ + -DGFTL_DIR="${{ steps.pfunit.outputs.gftl_dir }}" \ + -DGFTL_SHARED_DIR="${{ steps.pfunit.outputs.gftl_shared_dir }}" \ + -DFARGPARSE_DIR="${{ steps.pfunit.outputs.fargparse_dir }}" \ + -Wno-dev + + - name: Build + run: cmake --build wsjtx-build -j$(nproc) + + - name: Run tests + id: ctest + run: ctest --output-on-failure --output-junit ctest-results.xml + working-directory: wsjtx-build + + - name: Publish test summary + if: always() && steps.ctest.conclusion != 'skipped' + working-directory: wsjtx-build + run: python3 ../.github/scripts/publish-ctest-summary.py "Windows x86_64" >> "$GITHUB_STEP_SUMMARY" + + - name: Upload test results + if: always() && steps.ctest.conclusion != 'skipped' + uses: actions/upload-artifact@v7 + with: + name: ctest-results-windows + path: wsjtx-build/ctest-results.xml + if-no-files-found: ignore + + - name: Verify binary + run: | + file wsjtx-build/jt9.exe + + # Emit an NSIS installer containing the full CLI tool set + # (wsjtx.exe, jt9, wsprd, fmtave, fcal, fmeasure + WSJT_BUILD_UTILS + # ft8code/jt65code/... + rigctl wrappers + Qt runtime via bundle_fixup). + # CMakeLists.txt:1989-1990 sets CPACK_GENERATOR=NSIS on WIN32 and + # CPACK_MONOLITHIC_INSTALL=1 packages every install() target. + - name: Package NSIS installer + run: | + cd wsjtx-build + # Override CPACK_PACKAGE_VERSION and + # CPACK_PACKAGE_FILE_NAME so the NSIS installer filename + # matches the tag-derived version exactly, including any + # pre-release suffix (-rc1, -beta1, etc.). CMakeLists.txt + # VERSION is numeric-only (CMake won't accept suffixes), so + # without this override cpack produces wsjtx-<numeric>-win64.exe + # while the sign step and upload-artifact paths below expect + # wsjtx-<inputs.version>-win64.exe. release.yml's prepare job + # enforces numeric-base parity; this override covers the + # suffix gap. + cpack -G NSIS -V \ + -D CPACK_PACKAGE_VERSION="${{ inputs.version }}" \ + -D CPACK_PACKAGE_FILE_NAME="wsjtx-${{ inputs.version }}-win64" + ls -la *.exe + + # Self-signed ephemeral signing — the signing step is wired into the + # pipeline, but the signature does NOT chain to a trusted root. This + # is intentional: Authenticode certification is a separate decision + # (CI/CD adoption decision #5). Generates an ephemeral cert per-run. + - name: Sign installer with self-signed ephemeral cert + run: | + cd wsjtx-build + INSTALLER=$(ls wsjtx-${{ inputs.version }}-*.exe | head -1) + if [ -z "$INSTALLER" ]; then + echo "ERROR: no NSIS installer produced by cpack" + ls -la + exit 1 + fi + echo "Unsigned installer: $INSTALLER" + # MSYS2 auto-converts arguments starting with '/' into Windows paths + # (e.g., '/CN=...' becomes 'D:/a/_temp/msys64/CN=...'). + # MSYS2_ARG_CONV_EXCL="*" disables that conversion for this command. + MSYS2_ARG_CONV_EXCL="*" openssl req -x509 -newkey rsa:2048 \ + -keyout ephemeral-key.pem -out ephemeral-cert.pem \ + -days 365 -nodes \ + -subj "/CN=WSJT-X Ephemeral Dev Signing/O=WSJTX/C=US" + SIGNED="${INSTALLER%.exe}-signed.exe" + osslsigncode sign \ + -certs ephemeral-cert.pem -key ephemeral-key.pem \ + -n "WSJT-X Installer" \ + -i "https://github.com/WSJTX/wsjtx-internal" \ + -h sha256 \ + -in "$INSTALLER" -out "$SIGNED" + mv "$SIGNED" "$INSTALLER" + rm -f ephemeral-key.pem ephemeral-cert.pem + echo "Signed installer: $INSTALLER" + osslsigncode verify "$INSTALLER" || true + # Exit 0: osslsigncode verify returns non-zero on CA-untrust even + # when the signature itself is structurally valid. The ephemeral + # cert is self-signed by design; the "|| true" keeps CI green. + # Structural presence is proven by the sign step succeeding above. + + - name: Upload installer artifact + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-windows-x86_64-installer + path: wsjtx-build/wsjtx-${{ inputs.version }}-*.exe + + - name: Upload build artifacts + uses: actions/upload-artifact@v7 + with: + name: wsjtx-${{ inputs.version }}-windows-x86_64 + path: | + wsjtx-build/jt9.exe + wsjtx-build/wsprd.exe + wsjtx-build/wsjtx.exe diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..52592fb4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + push: + branches: [develop] + pull_request: + branches: [develop] + workflow_dispatch: + +jobs: + # Single source of truth for the project version string: read it from + # CMakeLists.txt so CI and release.yml cannot disagree. Strip the + # optional fourth tweak segment (3.0.0.0 → 3.0.0) to match the 3-part + # shape release.yml derives from build/v<X.Y.Z> tags. + prepare: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.v.outputs.version }} + steps: + - uses: actions/checkout@v6 + - id: v + run: | + VERSION=$(grep -E '^\s*VERSION\s+[0-9]' CMakeLists.txt | head -1 | awk '{print $2}' | cut -d. -f1-3) + if [ -z "$VERSION" ]; then + echo "::error::Could not derive VERSION from CMakeLists.txt" + exit 1 + fi + echo "Derived version from CMakeLists.txt: $VERSION" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + macos: + needs: prepare + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "arm64" + runner: "macos-15" + deployment_target: "11.0" + secrets: inherit + + macos-intel: + needs: prepare + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "x86_64" + runner: "macos-15-intel" + deployment_target: "10.13" + secrets: inherit + + linux: + needs: prepare + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "x86_64" + secrets: inherit + + linux-arm: + needs: prepare + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "aarch64" + secrets: inherit + + windows: + needs: prepare + uses: ./.github/workflows/build-windows.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + secrets: inherit diff --git a/.github/workflows/hamlib-upstream-check.yml b/.github/workflows/hamlib-upstream-check.yml new file mode 100644 index 00000000..01add999 --- /dev/null +++ b/.github/workflows/hamlib-upstream-check.yml @@ -0,0 +1,107 @@ +name: Hamlib Upstream Check + +on: + schedule: + # Weekly, Monday 12:00 UTC. Courtesy check for new Hamlib 4.x releases. + - cron: '0 12 * * MON' + workflow_dispatch: + +permissions: + contents: read + issues: write + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + + - name: Check for newer upstream release + env: + GH_TOKEN: ${{ github.token }} + # Extension hook: to add Qt, Boost, fftw, or any other upstream, + # duplicate this workflow with different COMPONENT / REPO / MAJOR + # values, or convert this job into a matrix over those keys. + # The step logic below only reads these three env vars plus the + # hamlib_branch line in ci.yml, so swapping is mechanical. + COMPONENT: Hamlib + REPO: Hamlib/Hamlib + MAJOR: "4" + run: | + set -euo pipefail + + # Single source of truth for the pinned version lives in ci.yml. + # ci.yml and release.yml must agree on hamlib_branch; CI failure + # is the signal if they drift, so this step reads ci.yml only. + PINNED=$(grep -m1 'hamlib_branch:' .github/workflows/ci.yml \ + | sed -E 's/.*"([^"]+)".*/\1/') + if [[ -z "$PINNED" ]]; then + echo "::error::Could not read pinned ${COMPONENT} version from ci.yml" + exit 1 + fi + echo "Pinned: ${PINNED}" + + # Highest tag in the MAJOR.x series. Strict three-component filter + # skips partial tags like "4.6" and anything non-semver. sort -V + # handles numeric ordering correctly for dotted versions. + LATEST=$(gh api "/repos/${REPO}/tags" --paginate -q '.[].name' \ + | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \ + | awk -F. -v m="${MAJOR}" '$1 == m' \ + | sort -V \ + | tail -n1) + if [[ -z "${LATEST}" ]]; then + echo "::error::No ${COMPONENT} ${MAJOR}.x tags found upstream" + exit 1 + fi + echo "Upstream: ${LATEST}" + + if [[ "${LATEST}" == "${PINNED}" ]]; then + echo "Pinned version is current. Nothing to do." + exit 0 + fi + + HIGHEST=$(printf '%s\n%s\n' "${PINNED}" "${LATEST}" | sort -V | tail -n1) + if [[ "${HIGHEST}" != "${LATEST}" ]]; then + echo "Pinned (${PINNED}) is ahead of upstream (${LATEST}); no action." + exit 0 + fi + + # Avoid filing a duplicate if last week's tracking issue is still + # open. "in:title" + the specific version number is tight enough + # to never collide with an unrelated issue. + if gh issue list --state open \ + --search "${COMPONENT} ${LATEST} in:title" \ + --json number -q '.[].number' | grep -q .; then + echo "Tracking issue already open for ${COMPONENT} ${LATEST}. Nothing to do." + exit 0 + fi + + TITLE="Upstream: ${COMPONENT} ${LATEST} available (pinned at ${PINNED})" + BODY=$(cat <<EOF + Automated upstream version check. + + - **Component:** ${COMPONENT} + - **Pinned:** \`${PINNED}\` + - **Latest upstream ${MAJOR}.x tag:** \`${LATEST}\` + + ## To bump + + Update \`hamlib_branch\` in: + + - \`.github/workflows/ci.yml\` (five jobs) + - \`.github/workflows/release.yml\` (five jobs) + + Open a PR against \`develop\`, let CI run on all five platforms, then merge. + + ## Notes + + - This check only tracks the ${MAJOR}.x series. A future ${COMPONENT} ${MAJOR}+1 major release would require design review and is intentionally ignored here. + - Close this issue once the bump PR is merged. The next weekly run will re-file if another ${MAJOR}.x release appears. + + _Filed by \`.github/workflows/hamlib-upstream-check.yml\`._ + EOF + ) + + gh issue create --title "${TITLE}" --body "${BODY}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..be547624 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,313 @@ +name: Release + +on: + push: + tags: ["build/v*"] + +jobs: + # ── Derive the version string once from the pushed tag ──────────── + # Strips the "build/v" prefix so artifacts are named "wsjtx-3.0.1-rc1-*" + # rather than "wsjtx-build/v3.0.1-rc1-*". RC/beta suffixes (e.g. + # build/v3.0.1-rc1 → 3.0.1-rc1) are preserved so pre-release artifacts + # are distinguishable from GA. All downstream jobs consume this + # single output so the five platform artifacts cannot disagree. + prepare: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.v.outputs.version }} + steps: + - uses: actions/checkout@v6 + - id: v + run: echo "version=${GITHUB_REF_NAME#build/v}" >> "$GITHUB_OUTPUT" + + # Enforce that the pushed tag's numeric version base + # matches CMakeLists.txt:55 VERSION (first 3 components). CMake's + # VERSION field is numeric-only and cannot carry pre-release + # suffixes like -rc1 or -beta1, so this check compares the tag + # version stripped of any `-<suffix>` against the first three + # dotted components of CMakeLists.txt VERSION. Mismatch means the + # release commit forgot to bump CMakeLists.txt in lockstep with + # the tag; fail fast here before five platform builds burn ~30 + # minutes of CI. + - name: Verify tag ↔ CMakeLists.txt version parity + run: | + TAG_VERSION="${GITHUB_REF_NAME#build/v}" + TAG_NUMERIC="${TAG_VERSION%%-*}" + CMAKE_VERSION=$(sed -nE 's/^[[:space:]]*VERSION[[:space:]]+([0-9][0-9.]*).*/\1/p' CMakeLists.txt | head -1) + CMAKE_NUMERIC=$(echo "$CMAKE_VERSION" | awk -F. '{printf "%s.%s.%s", $1, $2, $3}') + echo "Tag version: $TAG_VERSION (numeric base: $TAG_NUMERIC)" + echo "CMakeLists.txt VER: $CMAKE_VERSION (first 3 components: $CMAKE_NUMERIC)" + if [ "$TAG_NUMERIC" != "$CMAKE_NUMERIC" ]; then + echo "::error::Tag numeric base ($TAG_NUMERIC) != CMakeLists.txt VERSION first 3 components ($CMAKE_NUMERIC)." + echo "::error::Bump CMakeLists.txt:55 VERSION in the same commit that gets tagged, then retry." + exit 1 + fi + echo "Parity check PASSED." + + # ── Build all five platforms ─────────────────────────────────────── + macos: + needs: prepare + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "arm64" + runner: "macos-15" + deployment_target: "11.0" + secrets: inherit + + macos-intel: + needs: prepare + uses: ./.github/workflows/build-macos.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "x86_64" + runner: "macos-15-intel" + deployment_target: "10.13" + secrets: inherit + + linux: + needs: prepare + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "x86_64" + secrets: inherit + + linux-arm: + needs: prepare + uses: ./.github/workflows/build-linux.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + arch: "aarch64" + secrets: inherit + + windows: + needs: prepare + uses: ./.github/workflows/build-windows.yml + with: + version: ${{ needs.prepare.outputs.version }} + hamlib_branch: "4.7.1" + secrets: inherit + + # ── Publish release + sync to public repo ────────────────────────── + release: + needs: [prepare, macos, macos-intel, linux, linux-arm, windows] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Download all artifacts + uses: actions/download-artifact@v8 + with: + path: artifacts + + # Source tarball is published on GA releases only, not on RC (-rc*, + # -beta*, etc.) pre-releases. Rationale: RCs may carry code for features + # that are not yet intended for open source distribution (limited-access + # field testing). GA releases always include a source tarball per the + # CI/CD adoption decision on platform-matrix assets. + - name: Build source tarball (GA only) + if: ${{ !contains(github.ref_name, '-') }} + env: + VERSION: ${{ needs.prepare.outputs.version }} + run: | + # This repo has no git submodules, so git archive's default + # single-tree output captures the full source. If submodules + # are ever added, this step must be revisited — git archive + # does not recurse into submodules on its own. + git archive \ + --format=tar.gz \ + --prefix="wsjtx-${VERSION}/" \ + -o "artifacts/wsjtx-${VERSION}-src.tar.gz" \ + "${GITHUB_REF_NAME}" + ls -lh "artifacts/wsjtx-${VERSION}-src.tar.gz" + + - name: List artifacts + run: find artifacts -type f | sort + + # ── All-platforms-ready gate ─────────────────────────────────────── + # Refuse to publish unless every platform produced an installer-grade + # artifact. The release job's `needs:` already enforces structural + # success (all 5 builds ran and exited 0), but a build can exit 0 + # without actually packaging — e.g. a packaging step behind an `if:` + # that evaluated false, or an upload-artifact step that silently + # matched zero files. This gate fails the release job BEFORE any + # asset upload so partial releases never reach GitHub Releases or + # the public mirror. + # + # Expected artifact layout (one installer per platform, per the + # five build-*.yml upload-artifact steps): + # artifacts/wsjtx-<ver>-arm64-macOS.pkg/*.pkg + # artifacts/wsjtx-<ver>-x86_64-macOS.pkg/*.pkg + # artifacts/wsjtx-<ver>-linux-x86_64-AppImage/*.AppImage + # artifacts/wsjtx-<ver>-linux-aarch64-AppImage/*.AppImage + # artifacts/wsjtx-<ver>-windows-x86_64-installer/*.exe + # + # Policy: publish only when all five platforms have produced an + # installer-grade artifact. Adjust or remove this step if the + # policy evolves (e.g. to publish any-platform-ready). + - name: Verify installer-grade artifacts (all-platforms-ready gate) + env: + VERSION: ${{ needs.prepare.outputs.version }} + run: | + shopt -s nullglob + labels=( + "macOS arm64 .pkg" + "macOS x86_64 .pkg" + "Linux x86_64 .AppImage" + "Linux aarch64 .AppImage" + "Windows x86_64 .exe" + ) + patterns=( + "artifacts/wsjtx-${VERSION}-arm64-macOS.pkg/*.pkg" + "artifacts/wsjtx-${VERSION}-x86_64-macOS.pkg/*.pkg" + "artifacts/wsjtx-${VERSION}-linux-x86_64-AppImage/*.AppImage" + "artifacts/wsjtx-${VERSION}-linux-aarch64-AppImage/*.AppImage" + "artifacts/wsjtx-${VERSION}-windows-x86_64-installer/*.exe" + ) + missing=0 + echo "Installer-grade artifact gate — checking 5 platforms…" + for i in "${!labels[@]}"; do + # shellcheck disable=SC2206 # word-split is intentional; nullglob makes it safe. + matches=( ${patterns[$i]} ) + if [ ${#matches[@]} -eq 0 ]; then + echo "::error::MISSING ${labels[$i]} — no match for ${patterns[$i]}" + missing=$((missing + 1)) + else + size=$(stat --printf '%s' "${matches[0]}") + printf ' ok %-22s %s (%s bytes)\n' "${labels[$i]}" "${matches[0]}" "$size" + fi + done + if [ "$missing" -gt 0 ]; then + echo "::error::All-platforms-ready gate FAILED — $missing of 5 platform(s) missing installer-grade artifact." + echo "::error::Refusing to publish a partial release. Fix the failing build job(s) and retry the tag." + exit 1 + fi + echo "All-platforms-ready gate PASSED — all 5 installer-grade artifacts present. Proceeding to publish." + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ github.token }} + run: | + TAG="${GITHUB_REF_NAME}" + # Filter to user-facing release assets. `find artifacts -type f` + # without filtering pulls in 5× ctest-results.xml (one per + # platform) and per-binary tarballs from individual-binaries-* + # that collide on basename across architectures — `gh release + # create` uses basenames as asset names and duplicates cause + # upload failures. + FILES=$(find artifacts -maxdepth 2 -type f \ + \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ + -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) + # SemVer pre-release tags contain a hyphen after the version + # (e.g., v3.0.1-rc1, v3.0.1-rc2, v3.0.1-beta1). Flag those as + # GitHub pre-releases so they don't appear as the latest stable. + PRERELEASE_FLAG="" + if [[ "$TAG" == *-* ]]; then + PRERELEASE_FLAG="--prerelease" + fi + gh release create "$TAG" \ + --title "WSJT-X ${{ needs.prepare.outputs.version }}" \ + --generate-notes \ + $PRERELEASE_FLAG \ + $FILES + + # ── Public mirror: GA only ───────────────────────────────────────── + # RC/beta tags (any tag carrying a '-' in the version, e.g. + # build/v3.0.1-rc1) stay internal — the public WSJTX/wsjtx repo is + # for stable releases only. The Build source tarball step above + # uses the same predicate; mirror logic must too. + + # Defense-in-depth: the workflow trigger already constrains + # github.ref_name to tags matching build/v*, but if this job + # ever runs outside that trigger (workflow_dispatch, manual + # re-run with a fork ref, misconfiguration) the force-push + # below would overwrite WSJTX/wsjtx:master with arbitrary content. + # Abort here if the ref doesn't match the expected release-tag + # shape. + - name: Verify release tag format (GA only) + if: ${{ !contains(github.ref_name, '-') }} + run: | + if [[ "$GITHUB_REF_TYPE" != "tag" || "$GITHUB_REF_NAME" != build/v* ]]; then + echo "::error::Refusing to sync — expected tag build/v*, got $GITHUB_REF_TYPE:$GITHUB_REF_NAME" + exit 1 + fi + + - name: Push to public repo (GA only) + if: ${{ !contains(github.ref_name, '-') }} + env: + TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} + run: | + # A "successful" release that silently skips the mirror sync is + # the worst failure mode — it looks green in Actions but leaves + # users unable to download. Fail loud instead. + if [ -z "$TOKEN" ]; then + echo "::error::CROSS_REPO_TOKEN not set — refusing to publish without public-mirror sync" + exit 1 + fi + # Use CROSS_REPO_TOKEN (PAT with Contents:write on WSJTX/wsjtx) + # over HTTPS. Idempotent: on job re-run the remote already exists, + # so skip add. + if ! git remote get-url public >/dev/null 2>&1; then + git remote add public "https://x-access-token:${TOKEN}@github.com/WSJTX/wsjtx.git" + fi + + # Strip "build/" prefix per public release convention. Public + # users search for "v3.0.1", not "build/v3.0.1". Internal tag + # stays as-is for the wsjtx-internal release. + PUBLIC_TAG="${GITHUB_REF_NAME#build/}" + + # Derive the bare-prefix tag locally so the workflow doesn't + # depend on the team having pushed both tag forms. -f overwrites + # any pre-existing local tag at a stale SHA. + git tag -f "$PUBLIC_TAG" "$GITHUB_REF_NAME" + + # Human-auditable record of what the force-push is overwriting. + # If public master doesn't exist yet, ls-remote returns empty — + # still safe, just logs "no prior SHA". + PRIOR_SHA=$(git ls-remote public master | awk '{print $1}') + LOCAL_SHA=$(git rev-parse HEAD) + echo "Public mirror force-push audit:" + echo " internal tag: $GITHUB_REF_NAME" + echo " public tag: $PUBLIC_TAG" + echo " prior SHA: ${PRIOR_SHA:-<none>}" + echo " new SHA: $LOCAL_SHA" + + # --force retained per CI/CD adoption decision #3 (option a): + # automate the existing sync pattern. The v3.0.0 tag SHAs already + # match on both repos, so the force-push aligns history rather + # than rewrites it in the normal release case. + git push public HEAD:master --force + git push public "refs/tags/${PUBLIC_TAG}:refs/tags/${PUBLIC_TAG}" + + # Create the public-side GitHub Release with installer assets + # attached. Without this step, public-side Releases page is empty + # after a mirror push (source + tag, no downloadables) and end users + # can't find the artifacts. + - name: Create public GitHub Release (GA only) + if: ${{ !contains(github.ref_name, '-') }} + env: + GH_TOKEN: ${{ secrets.CROSS_REPO_TOKEN }} + VERSION: ${{ needs.prepare.outputs.version }} + run: | + PUBLIC_TAG="${GITHUB_REF_NAME#build/}" + # Same asset filter as the internal release. Re-find rather than + # carrying a list — keeps the all-platforms-ready gate, internal + # release, and public release mechanically aligned on one filter. + FILES=$(find artifacts -maxdepth 2 -type f \ + \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ + -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) + gh release create "$PUBLIC_TAG" \ + -R WSJTX/wsjtx \ + --title "WSJT-X ${VERSION}" \ + --generate-notes \ + $FILES |
