name: "Warm macOS dependency caches" description: "Restore or populate macOS Qt and pinned dependency caches without building WSJT-X." inputs: arch: description: "Target architecture: arm64 or x86_64" required: true runner: description: "GitHub Actions runner label" required: true deployment_target: description: "macOS deployment target version" required: true hamlib_branch: description: "Hamlib branch to build" required: true runs: using: "composite" steps: - name: Validate workflow inputs shell: bash env: HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} ARCH: ${{ inputs.arch }} DEPLOYMENT_TARGET: ${{ inputs.deployment_target }} RUNNER: ${{ inputs.runner }} run: .github/scripts/validate-ci-inputs.sh - name: Verify macOS build tuple shell: bash run: | case "${{ inputs.arch }}:${{ inputs.runner }}:${{ inputs.deployment_target }}" in arm64:macos-15:11.0|x86_64:macos-15-intel:10.13) echo "Using supported macOS dependency tuple: ${{ inputs.arch }} on ${{ inputs.runner }} targeting ${{ inputs.deployment_target }}" ;; *) echo "::error::Unsupported macOS dependency tuple: arch=${{ inputs.arch }}, runner=${{ inputs.runner }}, deployment_target=${{ inputs.deployment_target }}" exit 1 ;; esac - name: Set Homebrew prefix shell: bash run: echo "HOMEBREW_PREFIX=$(brew --prefix)" >> "$GITHUB_ENV" - name: Install dependencies shell: bash run: brew install cmake autoconf automake libtool pkg-config - name: Compute Qt cache key id: qt-key shell: bash run: | .github/scripts/macos-qt-cache-key.sh \ --arch "${{ inputs.arch }}" \ --runner "${{ inputs.runner }}" \ --deployment-target "${{ inputs.deployment_target }}" \ --github-output - name: Restore Qt cache id: qt-cache uses: actions/cache/restore@v5 with: path: qt-prefix key: ${{ steps.qt-key.outputs.key }} - name: Build Qt id: qt-build if: steps.qt-cache.outputs.cache-hit != 'true' shell: bash run: | .github/scripts/build-qt-macos.sh \ --arch "${{ inputs.arch }}" \ --deployment-target "${{ inputs.deployment_target }}" \ --prefix "${GITHUB_WORKSPACE}/qt-prefix" - name: Save Qt cache if: steps.qt-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: qt-prefix key: ${{ steps.qt-cache.outputs.cache-primary-key }} - name: Verify Qt prefix shell: bash run: | .github/scripts/verify-macos-artifacts.sh \ --target "${{ inputs.deployment_target }}" \ --arch "${{ inputs.arch }}" \ --allow-prefix "${GITHUB_WORKSPACE}/qt-prefix" \ "${GITHUB_WORKSPACE}/qt-prefix" - name: Install controlled ARM gfortran id: controlled-arm-fc if: inputs.arch == 'arm64' shell: bash run: | .github/scripts/install-r-macos-gfortran.sh \ --target "${{ inputs.deployment_target }}" \ --arch "${{ inputs.arch }}" \ --work-dir "${RUNNER_TEMP}/r-macos-gfortran" \ --prefix "${GITHUB_WORKSPACE}/gfortran-prefix" \ --github-output - name: Install controlled Intel gfortran id: controlled-intel-fc if: inputs.arch == 'x86_64' shell: bash run: | .github/scripts/install-xpack-gfortran-macos.sh \ --target "${{ inputs.deployment_target }}" \ --arch "${{ inputs.arch }}" \ --work-dir "${RUNNER_TEMP}/xpack-gfortran" \ --prefix "${GITHUB_WORKSPACE}/gfortran-prefix" \ --github-output - name: Select gfortran id: fc shell: bash run: | if [ "${{ inputs.arch }}" = "x86_64" ]; then echo "Using controlled gfortran: ${{ steps.controlled-intel-fc.outputs.path }}" { echo "path=${{ steps.controlled-intel-fc.outputs.path }}" echo "runtime_lib_dir=${{ steps.controlled-intel-fc.outputs.runtime_lib_dir }}" echo "runtime_archives=${{ steps.controlled-intel-fc.outputs.runtime_archives }}" echo "cache_key=${{ steps.controlled-intel-fc.outputs.cache_key }}" } >> "$GITHUB_OUTPUT" exit 0 fi echo "Using controlled gfortran: ${{ steps.controlled-arm-fc.outputs.path }}" { echo "path=${{ steps.controlled-arm-fc.outputs.path }}" echo "runtime_lib_dir=${{ steps.controlled-arm-fc.outputs.runtime_lib_dir }}" echo "runtime_archives=${{ steps.controlled-arm-fc.outputs.runtime_archives }}" echo "cache_key=${{ steps.controlled-arm-fc.outputs.cache_key }}" } >> "$GITHUB_OUTPUT" - name: Verify static Fortran runtime shell: bash run: | .github/scripts/verify-macos-static-archives.sh \ --target "${{ inputs.deployment_target }}" \ --arch "${{ inputs.arch }}" \ --mode error \ ${{ steps.fc.outputs.runtime_archives }} - name: Restore libusb cache id: libusb-cache uses: actions/cache/restore@v5 with: path: libusb-prefix key: libusb-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.0.27-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} - name: Build libusb id: libusb-build if: steps.libusb-cache.outputs.cache-hit != 'true' shell: bash run: | .github/scripts/build-libusb-macos.sh \ 1.0.27 \ "${{ inputs.deployment_target }}" \ "${GITHUB_WORKSPACE}/libusb-prefix" - name: Save libusb cache if: steps.libusb-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: libusb-prefix key: ${{ steps.libusb-cache.outputs.cache-primary-key }} - name: Restore PortAudio cache id: portaudio-cache uses: actions/cache/restore@v5 with: path: portaudio-prefix key: portaudio-macos-${{ inputs.arch }}-${{ inputs.runner }}-19.7.0-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} - name: Build PortAudio id: portaudio-build if: steps.portaudio-cache.outputs.cache-hit != 'true' shell: bash run: | .github/scripts/build-portaudio-macos.sh \ 19.7.0 \ "${{ inputs.deployment_target }}" \ "${GITHUB_WORKSPACE}/portaudio-prefix" - name: Save PortAudio cache if: steps.portaudio-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: portaudio-prefix key: ${{ steps.portaudio-cache.outputs.cache-primary-key }} - name: Restore FFTW cache id: fftw-cache uses: actions/cache/restore@v5 with: path: fftw-prefix key: fftw-macos-${{ inputs.arch }}-${{ inputs.runner }}-3.3.10-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} - name: Build FFTW id: fftw-build if: steps.fftw-cache.outputs.cache-hit != 'true' shell: bash run: | .github/scripts/build-fftw-macos.sh \ 3.3.10 \ "${{ inputs.deployment_target }}" \ "${GITHUB_WORKSPACE}/fftw-prefix" - name: Save FFTW cache if: steps.fftw-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: fftw-prefix key: ${{ steps.fftw-cache.outputs.cache-primary-key }} - name: Restore Boost cache id: boost-cache uses: actions/cache/restore@v5 with: path: boost-prefix key: boost-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.85.0-7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} - name: Build Boost id: boost-build if: steps.boost-cache.outputs.cache-hit != 'true' shell: bash run: | .github/scripts/build-boost-macos.sh \ 1.85.0 \ 7009fe1faa1697476bdc7027703a2badb84e849b7b0baad5086b087b971f8617 \ "${{ inputs.arch }}" \ "${{ inputs.deployment_target }}" \ "${GITHUB_WORKSPACE}/boost-prefix" - name: Save Boost cache if: steps.boost-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: boost-prefix key: ${{ steps.boost-cache.outputs.cache-primary-key }} - name: Verify pinned runtime prefixes shell: bash run: | .github/scripts/verify-macos-artifacts.sh \ --target "${{ inputs.deployment_target }}" \ --arch "${{ inputs.arch }}" \ --allow-prefix "${GITHUB_WORKSPACE}/libusb-prefix" \ --allow-prefix "${GITHUB_WORKSPACE}/portaudio-prefix" \ --allow-prefix "${GITHUB_WORKSPACE}/fftw-prefix" \ --allow-prefix "${GITHUB_WORKSPACE}/boost-prefix" \ "${GITHUB_WORKSPACE}/libusb-prefix" \ "${GITHUB_WORKSPACE}/portaudio-prefix" \ "${GITHUB_WORKSPACE}/fftw-prefix" \ "${GITHUB_WORKSPACE}/boost-prefix" - name: Restore Hamlib cache id: hamlib-cache uses: actions/cache/restore@v5 with: path: hamlib-prefix key: hamlib-macos-${{ inputs.arch }}-${{ inputs.runner }}-${{ inputs.hamlib_branch }}-libusb1.0.27-min${{ inputs.deployment_target }}-epoch1-${{ hashFiles('.github/scripts/build-hamlib-macos.sh', '.github/scripts/build-libusb-macos.sh') }} - name: Build Hamlib id: hamlib-build if: steps.hamlib-cache.outputs.cache-hit != 'true' shell: bash env: HAMLIB_BRANCH: ${{ inputs.hamlib_branch }} DEPLOYMENT_TARGET: ${{ inputs.deployment_target }} run: | .github/scripts/build-hamlib-macos.sh \ "$HAMLIB_BRANCH" \ "$DEPLOYMENT_TARGET" \ "${GITHUB_WORKSPACE}/hamlib-prefix" \ "${GITHUB_WORKSPACE}/libusb-prefix" - name: Verify Hamlib prefix shell: bash run: | test -f "${GITHUB_WORKSPACE}/hamlib-prefix/lib/libhamlib.a" .github/scripts/verify-macos-static-archives.sh \ --target "${{ inputs.deployment_target }}" \ --arch "${{ inputs.arch }}" \ --mode error \ "${GITHUB_WORKSPACE}/hamlib-prefix/lib/libhamlib.a" - name: Save Hamlib cache if: steps.hamlib-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: hamlib-prefix key: ${{ steps.hamlib-cache.outputs.cache-primary-key }} - name: Restore pFUnit cache id: pfunit-cache uses: actions/cache/restore@v5 with: path: pfunit-prefix key: pfunit-macos-${{ inputs.arch }}-${{ inputs.runner }}-v4.14.0-${{ steps.fc.outputs.cache_key }}-min${{ inputs.deployment_target }}-epoch3-${{ hashFiles('.github/scripts/build-pfunit-macos.sh') }} - name: Build pFUnit id: pfunit-build if: steps.pfunit-cache.outputs.cache-hit != 'true' shell: bash env: DYLD_LIBRARY_PATH: ${{ steps.fc.outputs.runtime_lib_dir }} run: | .github/scripts/build-pfunit-macos.sh \ v4.14.0 \ "${{ steps.fc.outputs.path }}" \ "${{ inputs.deployment_target }}" \ "${GITHUB_WORKSPACE}/pfunit-prefix" - name: Locate pFUnit config shell: bash run: | config=$(find "${GITHUB_WORKSPACE}/pfunit-prefix" -name PFUNITConfig.cmake -print -quit) if [ -z "$config" ]; then echo "ERROR: PFUNITConfig.cmake not found under pfunit-prefix" find "${GITHUB_WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d exit 1 fi echo "Found PFUNITConfig.cmake at: $config" - name: Save pFUnit cache if: steps.pfunit-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v5 with: path: pfunit-prefix key: ${{ steps.pfunit-cache.outputs.cache-primary-key }} - name: Summarize dependency caches if: always() shell: bash env: CACHE_STEPS: ${{ toJSON(steps) }} COLD_BUILD: "false" run: python3 .github/scripts/summarize-native-caches.py qt libusb portaudio fftw boost hamlib pfunit >> "$GITHUB_STEP_SUMMARY"