Files
ResInsight/.github/workflows/ResInsightMac.yml
T
Magne Sjaastad c6c5ff5808 #14584 Move ResInsight-tests out of the shared build root
ResInsight-tests linked into the build root and copied its full runtime DLL
set there as a POST_BUILD step, the same pattern that made
extract-projectfile-versions race against the generated_classes.py edge. The
set is a superset of the one that failed, covering Qt6Gui, Qt6Widgets and the
rest, and nothing orders it against the code generation edge either. It fires
rarely only because copy_if_different compares content, so windeployqt having
already placed identical DLLs makes it a no-op. On a cold build where the copy
wins that race it genuinely writes.

Give the target its own RUNTIME_OUTPUT_DIRECTORY, and point the companion
PreBuildFileCopyTest target at the same directory so the ODB, OpenVDS and HDF5
runtime files stay next to the executable. That target runs before the link
creates the directory, so create it first.

Update the three workflows that run the test executable by path.
2026-08-22 11:50:55 +02:00

246 lines
9.8 KiB
YAML

name: ResInsight Mac Build
on:
workflow_dispatch:
push:
tags:
- '*'
schedule:
# 02:00 UTC daily, offset from ResInsightWithCache.yml's 01:00 slot
# so the two workflows do not contend for the same Actions runners.
- cron: '0 2 * * *'
permissions:
contents: read
# Cancel a still-running build when a new push lands on the same ref --
# otherwise two simultaneous Mac runs race on the same daily cache keys
# (vcpkg-clang/macOS-<arch>-..., macOS-<arch>-appleclang-...-buildcache-v01-<date>,
# macOS-<arch>-buildcache-tool-v0.33.0) and one reports
# "Failed to save: Unable to reserve cache with key ..., another job may
# be creating this cache." Mirrors the pattern in ResInsightWithCache.yml.
# The two matrix legs (arm64, x64) use arch-qualified keys, so they cache
# independently and do not race against each other within a single run.
concurrency:
group: mac-build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
# Build every architecture even if one leg fails, so a broken x86_64
# build does not withhold the (previously working) arm64 artifact.
fail-fast: false
matrix:
include:
# Apple Silicon, built natively on the arm64 runner.
- runner: macos-15
arch: arm64
arch_label: "Apple Silicon (arm64)"
deployment_target: "15.0"
# Intel, built natively on GitHub's Intel macOS runner so
# ResInsight also runs on x86_64 Macs (issue #1009). The older
# macos-13 Intel image was retired on 2025-12-04; macos-15-intel
# is its replacement. A lower deployment target widens the range
# of supported Intel machines and stays at/below the runner SDK.
# 13.3 is the floor: Apple's libc++ only ships the <format> /
# std::to_chars(float) runtime symbols from macOS 13.3, and the
# code (e.g. custom-surfio) uses std::format on floating-point
# values; a lower target fails to compile with "'to_chars' is
# unavailable". (Apple/GitHub plan to end Intel macOS runners
# after macOS 15 in Fall 2027, at which point this leg needs a
# universal build or a self-hosted Intel runner.)
- runner: macos-15-intel
arch: x64
arch_label: "Intel (x86_64)"
deployment_target: "13.3"
env:
BUILD_TYPE: Release
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
BUILDCACHE_ACCURACY: SLOPPY
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Get Python executable path
id: python-path
run: echo "PYTHON_EXECUTABLE=$(python -c 'import sys; import pathlib; print(pathlib.PurePath(sys.executable).as_posix())')" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
python -m pip install --upgrade pip
# rips/_version.py is normally generated by CMake; create a dev
# fallback so the editable install below can resolve the version.
echo '__version__ = "0.0.0.dev"' > GrpcInterface/Python/rips/_version.py
pip install -e GrpcInterface/Python[dev]
- name: Restore buildcache tool binary
uses: actions/cache@v6
with:
path: ${{ github.workspace }}/buildcache-tool
key: ${{ runner.os }}-${{ matrix.arch }}-buildcache-tool-v0.33.0
- name: Build buildcache from source if needed
# CeetronSolutions/setup-buildcache-action has no macOS support, so
# build the binary from the upstream source release and add it to
# PATH. Source build (~30 s) only happens on cache miss; subsequent
# runs restore the binary from the cache step above.
env:
BUILDCACHE_VERSION: v0.33.0
BUILDCACHE_PREFIX: ${{ github.workspace }}/buildcache-tool
run: |
if [ ! -x "$BUILDCACHE_PREFIX/bin/buildcache" ]; then
workdir="$RUNNER_TEMP/buildcache-src"
mkdir -p "$workdir" "$BUILDCACHE_PREFIX"
cd "$workdir"
curl -sSL "https://gitlab.com/bits-n-bites/buildcache/-/archive/${BUILDCACHE_VERSION}/buildcache-${BUILDCACHE_VERSION}.tar.gz" \
| tar xz --strip-components=1
cmake -S src -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$BUILDCACHE_PREFIX"
cmake --build build --target install
fi
echo "$BUILDCACHE_PREFIX/bin" >> "$GITHUB_PATH"
"$BUILDCACHE_PREFIX/bin/buildcache" --version
- name: Get current date
id: current-time
shell: bash
run: echo "formattedTime=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
- name: Cache buildcache contents
id: cache-buildcache
uses: actions/cache@v6
with:
path: ${{ env.BUILDCACHE_DIR }}
key: ${{ runner.os }}-${{ matrix.arch }}-appleclang-6.7.0-buildcache-v01-${{ steps.current-time.outputs.formattedTime }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-appleclang-6.7.0-buildcache-v01-
- name: Create folder for buildcache
run: mkdir -p "${{ env.BUILDCACHE_DIR }}"
- name: Install Homebrew build tools
# vcpkg's thrift port (transitive dep of arrow) requires bison > 2.5;
# macOS ships an ancient /usr/bin/bison (2.3). Install Homebrew's
# bison and put it ahead on PATH so the port build finds it.
run: |
brew install bison
echo "$(brew --prefix bison)/bin" >> "$GITHUB_PATH"
"$(brew --prefix bison)/bin/bison" --version | head -1
- name: Install Qt
# cache: false on macOS: the 1.1 GB Qt tarball eats most of the
# 10 GB per-repo Actions cache quota; downloading fresh each run
# is ~30 s on the runner-internal mirror and leaves room for the
# buildcache + vcpkg caches which actually save build time.
uses: CeetronSolutions/install-qt-action@bump-node24
with:
version: 6.7.0
dir: "${{ github.workspace }}/Qt/"
cache: false
setup-python: false
modules: "qtnetworkauth"
- name: vcpkg bootstrap
run: |
ThirdParty/vcpkg/bootstrap-vcpkg.sh
- name: Get vcpkg submodule SHA
id: vcpkg-sha
shell: bash
run: echo "sha=$(git rev-parse HEAD:ThirdParty/vcpkg)" >> $GITHUB_OUTPUT
- name: Restore vcpkg cache
id: vcpkg-cache
uses: CeetronSolutions/vcpkg-cache@copilot/optimize-cache-storage-structure
with:
cache-key: ${{ runner.os }}-${{ matrix.arch }}-clang-${{ steps.vcpkg-sha.outputs.sha }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
prefix: vcpkg-clang/
- name: Configure
shell: bash
env:
VCPKG_FEATURE_FLAGS: "binarycaching"
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
run: >
cmake -S . -B cmakebuild
-DVCPKG_BUILD_TYPE=release
-DCMAKE_INSTALL_PREFIX=cmakebuild/install
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.deployment_target }}
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DCMAKE_C_COMPILER_LAUNCHER=buildcache
-DCMAKE_CXX_COMPILER_LAUNCHER=buildcache
-DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true
-DRESINSIGHT_TREAT_WARNINGS_AS_ERRORS=false
-DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false
-DRESINSIGHT_ENABLE_UNITY_BUILD=false
-DRESINSIGHT_ENABLE_GRPC=false
-DRESINSIGHT_ENABLE_HDF5=false
-DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
-G Ninja
- name: Build
run: |
cmake --build cmakebuild --target install
- name: Stats for buildcache
run: buildcache -s
- name: Run Unit Tests
shell: bash
run: |
echo "Content of unit test folder"
ls cmakebuild/ApplicationLibCode/UnitTests
cmakebuild/ApplicationLibCode/UnitTests/ResInsight-tests
- name: Write macOS launch instructions
run: |
cat > cmakebuild/install/README-macOS.txt <<'EOF'
ResInsight macOS build - ${{ matrix.arch_label }}
======================================================
This is the ${{ matrix.arch_label }} build of ResInsight. It runs
on ${{ matrix.arch_label }} Macs with macOS ${{ matrix.deployment_target }}
or newer.
Pick the download that matches your Mac:
- Apple Silicon (M1/M2/M3/...): ResInsight-macOS-arm64
- Intel (x86_64): ResInsight-macOS-x64
To check, see Apple menu > About This Mac. The two builds are
not interchangeable: an arm64 build will not launch on an Intel
Mac (and vice versa).
This build is unsigned and unnotarised. macOS Gatekeeper will
quarantine ResInsight.app when the artifact is downloaded and
refuse to launch it ("app is damaged" or "cannot be opened").
Remove the quarantine attribute before first launch:
xattr -r -d com.apple.quarantine ResInsight.app
Then start the app normally (double-click or `open ResInsight.app`).
EOF
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: ResInsight-macOS-${{ matrix.arch }}
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install
retention-days: 5