mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
206 lines
7.5 KiB
YAML
206 lines
7.5 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-..., macOS-appleclang-...-buildcache-v01-<date>,
|
|
# macOS-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.
|
|
concurrency:
|
|
group: mac-build-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: macos-15
|
|
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@v5
|
|
with:
|
|
path: ${{ github.workspace }}/buildcache-tool
|
|
key: ${{ runner.os }}-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@v5
|
|
with:
|
|
path: ${{ env.BUILDCACHE_DIR }}
|
|
key: ${{ runner.os }}-appleclang-6.7.0-buildcache-v01-${{ steps.current-time.outputs.formattedTime }}
|
|
restore-keys: |
|
|
${{ runner.os }}-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 }}-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=15.0
|
|
-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/ResInsight-tests
|
|
cmakebuild/ResInsight-tests
|
|
|
|
- name: Write macOS launch instructions
|
|
run: |
|
|
cat > cmakebuild/install/README-macOS.txt <<'EOF'
|
|
ResInsight macOS build
|
|
======================
|
|
|
|
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:
|
|
|
|
sudo 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
|
|
path: ${{ runner.workspace }}/ResInsight/cmakebuild/install
|
|
retention-days: 5
|