diff options
Diffstat (limited to '.github/workflows/build-windows.yml')
| -rw-r--r-- | .github/workflows/build-windows.yml | 362 |
1 files changed, 242 insertions, 120 deletions
diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index fd0f14a5..c2dca58d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -11,11 +11,90 @@ on: description: "Hamlib branch to build" required: false type: string - default: "4.7.0" + default: "4.7.2" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + save_ccache: + description: "Persist compiler objects from a trusted develop build" + required: false + type: boolean + default: false + release_channel: + description: "Build release channel: DEVEL, RC, or GA" + required: false + type: string + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" + outputs: + installer-artifact-id: + description: "Installer artifact id, for the SignPath submit step" + value: ${{ jobs.build.outputs.installer-artifact-id }} + # Also runnable on its own ("Run workflow" / gh workflow run) to build just + # the Windows installer, at ~1/6 the cost of the full ci.yml matrix. GitHub + # only exposes workflow_dispatch when the trigger is present on the default + # branch, so this must be merged to develop before it can be dispatched. + # Inputs mirror workflow_call with standalone defaults: hamlib_branch matches + # what ci.yml / release.yml actually pass (4.7.2, not the workflow_call legacy + # default), and version defaults to a clearly-marked devel string -- overridable + # via `-f version=...` -- so a manual build is never mistaken for a release. + workflow_dispatch: + inputs: + version: + description: "WSJT-X version string (installer filename + artifact names)" + required: false + type: string + default: "3.2.0-devel" + hamlib_branch: + description: "Hamlib branch to build" + required: false + type: string + default: "4.7.2" + recache: + description: "Force ccache to recompile and refresh cached objects" + required: false + type: boolean + default: false + save_ccache: + description: "Persist compiler objects when dispatching on develop" + required: false + type: boolean + default: true + release_channel: + description: "Build release channel" + required: false + type: choice + options: + - DEVEL + - RC + - GA + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" jobs: build: runs-on: windows-latest + timeout-minutes: 100 + outputs: + installer-artifact-id: ${{ steps.upload_installer.outputs.artifact-id }} + env: + BOOST_VERSION: 1.91.0 + BOOST_SOURCE_SHA256: de5e6b0e4913395c6bdfa90537febd9028ea4c0735d2cdb0cd9b45d5f51264f5 + WSJT_WINDOWS_API_FLOOR: "0x0601" + VERSION: ${{ inputs.version }} + HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} + WSJT_RELEASE_CHANNEL: ${{ inputs.release_channel }} + WSJT_RC_NUMBER: ${{ inputs.rc_number }} defaults: run: shell: msys2 {0} @@ -31,8 +110,16 @@ jobs: shell: pwsh run: git config --global core.autocrlf false - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 + - name: Validate workflow inputs + shell: bash + env: + WSJTX_VERSION: ${{ inputs.version }} + run: .github/scripts/validate-ci-inputs.sh + + # Boost is source-built by build-windows-deps so the Windows 7 API floor + # and Boost.Atomic patch stay pinned; do not install MSYS2 Boost here. - uses: msys2/setup-msys2@v2 with: msystem: MINGW64 @@ -42,6 +129,7 @@ jobs: git make tar mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran + mingw-w64-x86_64-ccache mingw-w64-x86_64-cmake mingw-w64-x86_64-qt5-base mingw-w64-x86_64-qt5-multimedia @@ -51,12 +139,10 @@ jobs: mingw-w64-x86_64-qt5-websockets mingw-w64-x86_64-qt5-activeqt mingw-w64-x86_64-fftw - mingw-w64-x86_64-boost mingw-w64-x86_64-libusb mingw-w64-x86_64-portaudio mingw-w64-x86_64-pkg-config mingw-w64-x86_64-nsis - mingw-w64-x86_64-osslsigncode mingw-w64-x86_64-ruby autoconf automake libtool @@ -66,73 +152,44 @@ jobs: - name: Install asciidoctor (Ruby gem) run: gem install asciidoctor --no-document - - name: Cache pFUnit - id: pfunit-cache - uses: actions/cache@v5 - with: - path: pfunit-prefix - key: pfunit-windows-v4.9.0-${{ hashFiles('.github/workflows/build-windows.yml') }} + - name: Select ccache key + id: ccache-key + shell: bash + env: + RECACHE: ${{ inputs.recache }} + run: .github/scripts/select-ccache-key-suffix.sh - - name: Build pFUnit - if: steps.pfunit-cache.outputs.cache-hit != 'true' - run: | - WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - git config --global core.longpaths true - git clone --depth 1 --branch v4.9.0 --recursive \ - https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src - cmake -S pfunit-src -B pfunit-build -G "MSYS Makefiles" \ - -DSKIP_MPI=YES \ - -DSKIP_OPENMP=YES \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DCMAKE_INSTALL_PREFIX="${WORKSPACE}/pfunit-prefix" - cmake --build pfunit-build -j$(nproc) - cmake --install pfunit-build + - name: Restore ccache + id: ccache + uses: actions/cache/restore@v6 + with: + path: .ccache + key: ccache-windows-x86_64-gcc-${{ github.sha }}${{ steps.ccache-key.outputs.suffix }} + restore-keys: | + ccache-windows-x86_64-gcc- - - name: Locate pFUnit config - id: pfunit + - name: Configure ccache run: | WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - # Locate each sub-package's config directly — MSYS2 pkg-config - # interacts badly with multi-entry CMAKE_PREFIX_PATH, so we pass - # explicit <pkg>_DIR hints instead. - for pkg in PFUNIT GFTL GFTL_SHARED FARGPARSE; do - CONFIG=$(find "${WORKSPACE}/pfunit-prefix" -name ${pkg}Config.cmake | head -1) - if [ -z "$CONFIG" ]; then - echo "ERROR: ${pkg}Config.cmake not found under pfunit-prefix" - find "${WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d - exit 1 - fi - DIR="$(dirname "$CONFIG")" - echo "Found ${pkg}Config.cmake at: $CONFIG" - echo "$(echo $pkg | tr '[:upper:]' '[:lower:]')_dir=${DIR}" >> "$GITHUB_OUTPUT" - done + echo "CCACHE_DIR=${WORKSPACE}/.ccache" >> "$GITHUB_ENV" + echo "ccache recache: ${{ inputs.recache }}" + if [ "${{ inputs.recache }}" = "true" ]; then + echo "CCACHE_RECACHE=1" >> "$GITHUB_ENV" + echo "Forcing ccache recache for this run" + fi + mkdir -p "${WORKSPACE}/.ccache" + ccache --version + ccache --zero-stats - - name: Cache Hamlib - id: hamlib-cache - uses: actions/cache@v5 + - name: Build Windows dependencies + id: windows-deps + uses: ./.github/actions/build-windows-deps with: - path: hamlib-prefix - key: hamlib-windows-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-windows.yml') }} - - - name: Build Hamlib - if: steps.hamlib-cache.outputs.cache-hit != 'true' - env: - MSYS2_PATH_TYPE: inherit - run: | - WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") - git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ - https://github.com/Hamlib/Hamlib.git hamlib-src - cd hamlib-src - ./bootstrap - ./configure \ - --prefix="${WORKSPACE}/hamlib-prefix" \ - --enable-shared --disable-static \ - --without-cxx-binding \ - --without-readline \ - CFLAGS="-DNDEBUG -g -O2 -fdata-sections -ffunction-sections" \ - LDFLAGS="-Wl,--gc-sections" - make -j$(nproc) - make install-strip + boost_version: ${{ env.BOOST_VERSION }} + boost_source_sha256: ${{ env.BOOST_SOURCE_SHA256 }} + windows_api_floor: ${{ env.WSJT_WINDOWS_API_FLOOR }} + hamlib_branch: ${{ inputs.hamlib_branch }} + save_caches: ${{ github.event_name != 'pull_request' }} - name: Install OmniRig shell: pwsh @@ -149,34 +206,71 @@ jobs: if (-not $omnirig) { throw "OmniRig install failed — OmniRig.exe not found" } echo "OMNIRIG_PATH=$($omnirig.FullName)" >> $env:GITHUB_ENV - - name: Fix dumpcpp name (MSYS2 ships dumpcpp-qt5, CMake expects dumpcpp) - run: | - ln -sf /mingw64/bin/dumpcpp-qt5.exe /mingw64/bin/dumpcpp.exe - - - name: Configure + - name: Configure build and tests run: | WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") OMNIRIG=$(cygpath "${OMNIRIG_PATH}") + BOOST_PREFIX="${{ steps.windows-deps.outputs.boost_prefix }}" + HAMLIB_PREFIX="${{ steps.windows-deps.outputs.hamlib_prefix }}" cmake -G "MSYS Makefiles" -S . -B wsjtx-build \ - -DCMAKE_PREFIX_PATH="${WORKSPACE}/hamlib-prefix" \ + -DCMAKE_PREFIX_PATH="${BOOST_PREFIX};${HAMLIB_PREFIX}" \ + -DBOOST_ROOT="${BOOST_PREFIX}" \ + -DBOOST_INCLUDEDIR="${BOOST_PREFIX}/include" \ + -DBOOST_LIBRARYDIR="${BOOST_PREFIX}/lib" \ + -DHamlib_INCLUDE_DIR="${HAMLIB_PREFIX}/include" \ + -DHamlib_LIBRARY="${HAMLIB_PREFIX}/lib/libhamlib.dll.a" \ + -DRIGCTL_EXE="${HAMLIB_PREFIX}/bin/rigctl.exe" \ + -DRIGCTLD_EXE="${HAMLIB_PREFIX}/bin/rigctld.exe" \ + -DRIGCTLCOM_EXE="${HAMLIB_PREFIX}/bin/rigctlcom.exe" \ + -DCMAKE_C_FLAGS="-D_WIN32_WINNT=${WSJT_WINDOWS_API_FLOOR} -DWINVER=${WSJT_WINDOWS_API_FLOOR}" \ + -DCMAKE_CXX_FLAGS="-D_WIN32_WINNT=${WSJT_WINDOWS_API_FLOOR} -DWINVER=${WSJT_WINDOWS_API_FLOOR} -DBOOST_USE_WINAPI_VERSION=${WSJT_WINDOWS_API_FLOOR}" \ + -DBoost_NO_SYSTEM_PATHS=ON \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DOMNIRIG_TYPE_LIB="${OMNIRIG}" \ - -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 }}" \ + -DWSJT_ENABLE_TESTS=ON \ + -DWSJT_FORTRAN_LIBRARY_VARIANTS=OPENMP_ONLY \ + -DWSJT_RELEASE_CHANNEL="${WSJT_RELEASE_CHANNEL}" \ + -DWSJT_RC_NUMBER="${WSJT_RC_NUMBER}" \ + -DPFUNIT_DIR="${{ steps.windows-deps.outputs.pfunit_dir }}" \ + -DGFTL_DIR="${{ steps.windows-deps.outputs.gftl_dir }}" \ + -DGFTL_SHARED_DIR="${{ steps.windows-deps.outputs.gftl_shared_dir }}" \ + -DFARGPARSE_DIR="${{ steps.windows-deps.outputs.fargparse_dir }}" \ -Wno-dev - - name: Build + - name: Build and test targets run: cmake --build wsjtx-build -j$(nproc) + - name: Show ccache stats + if: always() + run: ccache --show-stats + + - name: Report suppressed ccache save + if: ${{ (inputs.save_ccache || inputs.recache) && github.ref != 'refs/heads/develop' }} + run: echo "::notice::Not saving ccache because shared compiler caches are published only from develop" + + - name: Save ccache + if: ${{ success() && (inputs.save_ccache || inputs.recache) && github.ref == 'refs/heads/develop' && steps.ccache.outputs.cache-hit != 'true' }} + uses: actions/cache/save@v6 + with: + path: .ccache + key: ${{ steps.ccache.outputs.cache-primary-key }} + - name: Run tests id: ctest - run: ctest --output-on-failure --output-junit ctest-results.xml + run: | + # Tests that link wsjt_qt (e.g. test_jtty_txstream) pull in the + # rig-control code, so their exe imports libhamlib-4.dll. Hamlib is + # built --enable-shared into hamlib-prefix, so hamlib-prefix/bin must + # be on PATH for the test to load — the mingw runtime DLLs are already + # reachable via /mingw64/bin, but hamlib-prefix is not. Without this + # the test exits 0xc0000135 (STATUS_DLL_NOT_FOUND) at launch. The + # packaged installer is unaffected: cpack's bundle_fixup copies + # libhamlib-4.dll in. + export PATH="${{ steps.windows-deps.outputs.boost_prefix }}/lib:${{ steps.windows-deps.outputs.hamlib_prefix }}/bin:${PATH}" + ctest --output-on-failure --output-junit ctest-results.xml working-directory: wsjtx-build - name: Publish test summary @@ -192,12 +286,61 @@ jobs: path: wsjtx-build/ctest-results.xml if-no-files-found: ignore + # MAP65 builds by default again. Under OPENMP_ONLY, m65impl resolves + # wsjt_fort_common to wsjt_fort_omp, so this keeps the Windows Fortran + # linkage covered by CI. - name: Verify binary run: | file wsjtx-build/jt9.exe + file wsjtx-build/map65/map65.exe + test -f wsjtx-build/map65/map65.exe + + # Install to a staging prefix so bundle_fixup runs: its install(CODE) + # step copies Qt and dependent runtime DLLs next to the installed + # executables, making bin/ self-contained. Build-tree binaries are NOT + # self-contained (they resolve Qt/libgfortran/libgomp via /mingw64/bin), + # so the launch check below must run against the staged install, not the + # build tree — otherwise it would fail for binaries that ship fine. + - name: Stage install (runs bundle_fixup) + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + cmake --install wsjtx-build --prefix "${WORKSPACE}/stage-main" + ls -la "${WORKSPACE}/stage-main/bin" + + - name: Audit staged runtime DLL imports + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + test -f "${WORKSPACE}/stage-main/bin/map65.exe" + test -f "${WORKSPACE}/stage-main/bin/qmap.exe" + bash .github/scripts/audit-staged-dll-imports-windows.sh \ + "${WORKSPACE}/stage-main/bin" \ + "${WORKSPACE}"/stage-main/bin/*.exe \ + "${WORKSPACE}"/stage-main/bin/*.dll - # Emit an NSIS installer containing the full CLI tool set - # (wsjtx.exe, jt9, wsprd, fmtave, fcal, fmeasure + WSJT_BUILD_UTILS + - name: Smoke-launch staged WSJT-X (clean PATH) + id: wsjtx_smoke + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + .github/scripts/smoke-launch-windows.sh \ + "${WORKSPACE}/stage-main/bin/wsjtx.exe" \ + --startup-smoke-test --rig-name CI-STARTUP + + - name: Upload WSJT-X startup diagnostics + if: failure() && steps.wsjtx_smoke.outcome == 'failure' + uses: actions/upload-artifact@v7 + with: + name: wsjtx-startup-smoke-windows + path: launch.out + if-no-files-found: ignore + retention-days: 7 + + - name: Smoke-launch staged jt9 (clean PATH) + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + .github/scripts/smoke-launch-windows.sh "${WORKSPACE}/stage-main/bin/jt9.exe" --help + + # Emit an NSIS installer containing the full executable set + # (wsjtx.exe, map65.exe, jt9, wsprd, fmtave, fcal, fmeasure + WSJT_BUILD_UTILS # ft8code/jt65code/... + rigctl wrappers + Qt runtime via bundle_fixup). # CMakeLists.txt:1989-1990 sets CPACK_GENERATOR=NSIS on WIN32 and # CPACK_MONOLITHIC_INSTALL=1 packages every install() target. @@ -214,49 +357,28 @@ jobs: # wsjtx-<inputs.version>-win64.exe. release.yml's prepare job # enforces numeric-base parity; this override covers the # suffix gap. - cpack -G NSIS -V \ - -D CPACK_PACKAGE_VERSION="${{ inputs.version }}" \ - -D CPACK_PACKAGE_FILE_NAME="wsjtx-${{ inputs.version }}-win64" + cpack_args=( + -G NSIS + -D CPACK_PACKAGE_VERSION="${VERSION}" + -D CPACK_PACKAGE_FILE_NAME="wsjtx-${VERSION}-win64" + ) + if [ "${CPACK_VERBOSE:-0}" = "1" ]; then + cpack_args+=(-V) + fi + cpack "${cpack_args[@]}" ls -la *.exe - # Self-signed ephemeral signing — the signing step is wired into the - # pipeline, but the signature does NOT chain to a trusted root. This - # is intentional: Authenticode certification is a separate decision - # (CI/CD adoption decision #5). Generates an ephemeral cert per-run. - - name: Sign installer with self-signed ephemeral cert + - name: Verify installer has no Authenticode signature + shell: pwsh run: | - cd wsjtx-build - INSTALLER=$(ls wsjtx-${{ inputs.version }}-*.exe | head -1) - if [ -z "$INSTALLER" ]; then - echo "ERROR: no NSIS installer produced by cpack" - ls -la - exit 1 - fi - echo "Unsigned installer: $INSTALLER" - # MSYS2 auto-converts arguments starting with '/' into Windows paths - # (e.g., '/CN=...' becomes 'D:/a/_temp/msys64/CN=...'). - # MSYS2_ARG_CONV_EXCL="*" disables that conversion for this command. - MSYS2_ARG_CONV_EXCL="*" openssl req -x509 -newkey rsa:2048 \ - -keyout ephemeral-key.pem -out ephemeral-cert.pem \ - -days 365 -nodes \ - -subj "/CN=WSJT-X Ephemeral Dev Signing/O=WSJTX/C=US" - SIGNED="${INSTALLER%.exe}-signed.exe" - osslsigncode sign \ - -certs ephemeral-cert.pem -key ephemeral-key.pem \ - -n "WSJT-X Installer" \ - -i "https://github.com/WSJTX/wsjtx-internal" \ - -h sha256 \ - -in "$INSTALLER" -out "$SIGNED" - mv "$SIGNED" "$INSTALLER" - rm -f ephemeral-key.pem ephemeral-cert.pem - echo "Signed installer: $INSTALLER" - osslsigncode verify "$INSTALLER" || true - # Exit 0: osslsigncode verify returns non-zero on CA-untrust even - # when the signature itself is structurally valid. The ephemeral - # cert is self-signed by design; the "|| true" keeps CI green. - # Structural presence is proven by the sign step succeeding above. + $installer = Get-Item "wsjtx-build/wsjtx-${{ inputs.version }}-win64.exe" + $signature = Get-AuthenticodeSignature $installer.FullName + if ($signature.Status -ne 'NotSigned') { + throw "Installer Authenticode status is $($signature.Status), expected NotSigned" + } - name: Upload installer artifact + id: upload_installer uses: actions/upload-artifact@v7 with: name: wsjtx-${{ inputs.version }}-windows-x86_64-installer |
