mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
Revert 5 commits, rolling back to 20b1ef95c7
This commit is contained in:
1 parent
dfc007e54e
commit
bb49381997
6 files changed
+120
-981
No files matched your search
@@ -1,221 +0,0 @@
|
||||
name: ResInsight Build With Cache (Linux container)
|
||||
|
||||
# Parallel companion to ResInsightWithCache.yml's Linux legs. Runs both the
|
||||
# Ubuntu 24.04 / gcc-14 and Ubuntu 24.04 / clang-19 builds inside the prebuilt
|
||||
# image at ghcr.io/<repo>/ci-ubuntu24:latest -- baked with both toolchains,
|
||||
# Qt, a per-compiler vcpkg binary cache, and a warm ResInsight buildcache.
|
||||
#
|
||||
# See:
|
||||
# * .github/docker/Dockerfile.ubuntu24 (what the image contains)
|
||||
# * .github/workflows/build-ubuntu24-image.yml (nightly image build)
|
||||
#
|
||||
# The non-containerized Linux legs in ResInsightWithCache.yml continue to run
|
||||
# in parallel during validation; once this workflow is stable, those legs will
|
||||
# be removed in a follow-up PR.
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
schedule:
|
||||
# 01:00 UTC -- one hour after the nightly image build at 00:00 UTC.
|
||||
- cron: '0 1 * * *'
|
||||
|
||||
concurrency:
|
||||
group: build-linux-container-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# Resolves the prebuilt CI image name so the workflow works in forks and
|
||||
# upstream alike (GHCR requires a lowercase repository path).
|
||||
resolve-image:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
image: ${{ steps.meta.outputs.image }}
|
||||
steps:
|
||||
- name: Compute image name
|
||||
id: meta
|
||||
run: echo "image=ghcr.io/${GITHUB_REPOSITORY,,}/ci-ubuntu24:latest" >> "$GITHUB_OUTPUT"
|
||||
|
||||
build:
|
||||
needs: resolve-image
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- name: "Ubuntu 24.04 gcc-14 (container)"
|
||||
cc: gcc-14
|
||||
cxx: g++-14
|
||||
buildcache_dir: /opt/buildcache-gcc
|
||||
vcpkg_cache: /opt/vcpkg-cache-gcc
|
||||
execute_pytests: true
|
||||
publish_to_pypi: true
|
||||
- name: "Ubuntu 24.04 clang-19 (container)"
|
||||
cc: clang-19
|
||||
cxx: clang++-19
|
||||
buildcache_dir: /opt/buildcache-clang
|
||||
vcpkg_cache: /opt/vcpkg-cache-clang
|
||||
execute_pytests: false
|
||||
publish_to_pypi: false
|
||||
container:
|
||||
# Prebuilt image with both toolchains, baked vcpkg binary caches, and
|
||||
# warm ResInsight buildcaches at /opt/buildcache-{gcc,clang}.
|
||||
# See .github/workflows/build-ubuntu24-image.yml
|
||||
image: ${{ needs.resolve-image.outputs.image }}
|
||||
credentials:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
# Source must live at /src to match the path the image's warmup compiled
|
||||
# at; buildcache hashes the absolute source path so any drift collapses
|
||||
# the hit rate. The clone step overrides this default since /src does not
|
||||
# exist yet at that point.
|
||||
defaults:
|
||||
run:
|
||||
working-directory: /src
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
BUILDCACHE_DIR: ${{ matrix.config.buildcache_dir }}
|
||||
BUILDCACHE_ACCURACY: SLOPPY
|
||||
|
||||
steps:
|
||||
- name: Clone source into /src
|
||||
working-directory: /
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# actions/checkout writes inside GITHUB_WORKSPACE (e.g.
|
||||
# /__w/ResInsight/ResInsight) which would not match the image's baked
|
||||
# cache path. Clone manually into /src instead. GITHUB_SHA is fetched
|
||||
# directly (GitHub allows any-SHA fetches on the workflow's own repo).
|
||||
#
|
||||
# The insteadOf rewrite is unset after the clone so the token is not
|
||||
# left in /etc/gitconfig where a later `git config --list` for
|
||||
# diagnostics could echo it into the log.
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
|
||||
git clone --no-checkout "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" /src
|
||||
cd /src
|
||||
git fetch --no-tags --depth 1 origin "${GITHUB_SHA}"
|
||||
git checkout FETCH_HEAD
|
||||
git submodule update --init --recursive --depth 1
|
||||
git config --global --unset url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf
|
||||
|
||||
# /src was just freshly cloned, so the ThirdParty/vcpkg/vcpkg binary
|
||||
# produced by bootstrap-vcpkg.sh is not present. The image's baked
|
||||
# vcpkg cache supplies prebuilt dependencies; the binary itself still
|
||||
# has to exist locally for `vcpkg install` to run.
|
||||
- name: Bootstrap vcpkg
|
||||
run: |
|
||||
cd ThirdParty/vcpkg
|
||||
./bootstrap-vcpkg.sh
|
||||
|
||||
- name: Install Python dev dependencies
|
||||
# rips package is required for pytest and mypy. PEP 668 marks Ubuntu
|
||||
# 24.04's system Python as externally managed; --break-system-packages
|
||||
# is the pragmatic path for a single-purpose CI container.
|
||||
run: |
|
||||
# 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
|
||||
python3 -m pip install --break-system-packages -e GrpcInterface/Python[dev]
|
||||
|
||||
- name: Configure
|
||||
env:
|
||||
CC: ${{ matrix.config.cc }}
|
||||
CXX: ${{ matrix.config.cxx }}
|
||||
VCPKG_FEATURE_FLAGS: binarycaching
|
||||
# Read vcpkg dependencies from the per-compiler binary cache baked
|
||||
# into the image. buildcache is auto-discovered on PATH by
|
||||
# CMakeLists.txt's find_program() and wired as
|
||||
# CMAKE_CXX_COMPILER_LAUNCHER -- no explicit setup step is needed.
|
||||
# Unity build must be OFF to match the warmup build (mismatched
|
||||
# flag would collapse the cache hit rate).
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{ matrix.config.vcpkg_cache }},read"
|
||||
run: |
|
||||
cmake -S /src -B /src/cmakebuild -G Ninja \
|
||||
-DVCPKG_BUILD_TYPE=release \
|
||||
-DCMAKE_INSTALL_PREFIX=/src/cmakebuild/install \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true \
|
||||
-DRESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true \
|
||||
-DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false \
|
||||
-DRESINSIGHT_ENABLE_UNITY_BUILD=false \
|
||||
-DRESINSIGHT_ENABLE_GRPC=true \
|
||||
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=$(command -v python3) \
|
||||
-DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true \
|
||||
-DRESINSIGHT_ENABLE_HDF5=false \
|
||||
-DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
|
||||
- name: Build
|
||||
run: cmake --build /src/cmakebuild --target install
|
||||
|
||||
- name: Stats for buildcache
|
||||
if: always()
|
||||
run: buildcache -s
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: /src/cmakebuild/ResInsight-tests
|
||||
|
||||
- name: (Python) Build Python module
|
||||
run: |
|
||||
python3 -m pip install --break-system-packages build wheel
|
||||
cd GrpcInterface/Python
|
||||
python3 -m build
|
||||
|
||||
- name: (Python) Check types using mypy
|
||||
run: |
|
||||
python3 -m pip install --break-system-packages mypy types-protobuf
|
||||
cd GrpcInterface/Python
|
||||
python3 -m mypy rips/*.py rips/generated/generated_classes.py
|
||||
|
||||
- name: Run pytest
|
||||
if: matrix.config.execute_pytests
|
||||
env:
|
||||
RESINSIGHT_EXECUTABLE: /src/cmakebuild/ResInsight
|
||||
run: |
|
||||
cd GrpcInterface/Python/rips
|
||||
python3 -m pytest --console
|
||||
|
||||
- name: Upload python distribution folder
|
||||
if: matrix.config.publish_to_pypi
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: python-distribution
|
||||
path: /src/GrpcInterface/Python/dist
|
||||
retention-days: 5
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ResInsight-${{ matrix.config.name }}
|
||||
path: /src/cmakebuild/install
|
||||
retention-days: 5
|
||||
|
||||
pypi-publish:
|
||||
name: Upload release to PyPI
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/p/rips
|
||||
permissions:
|
||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||
|
||||
# If this is a tagged release
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
steps:
|
||||
- name: Download python distribution folder
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
name: python-distribution
|
||||
path: dist
|
||||
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -R
|
||||
|
||||
- name: Publish Python package to pypi
|
||||
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
@@ -1,109 +0,0 @@
|
||||
name: Build Ubuntu 24.04 CI Image
|
||||
|
||||
# Builds the Docker image used by the containerized Linux cache workflow and
|
||||
# by the Copilot Coding Agent's setup-steps. The image bakes in both Linux
|
||||
# toolchains (gcc-14 + clang-19), Qt, a per-compiler vcpkg binary cache, and
|
||||
# a per-compiler warm ResInsight buildcache so CI runs do not have to
|
||||
# reprovision them every time.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Nightly at 00:00 UTC, before the containerized cache workflow's
|
||||
# scheduled run at 01:00 UTC.
|
||||
- cron: "0 0 * * *"
|
||||
push:
|
||||
paths:
|
||||
- ".github/docker/Dockerfile.ubuntu24"
|
||||
- ".github/workflows/build-ubuntu24-image.yml"
|
||||
- "vcpkg.json"
|
||||
- "vcpkg-configuration.json"
|
||||
- ".gitmodules"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
force_rebuild:
|
||||
description: "Rebuild and overwrite today's image even if it already exists in GHCR"
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
concurrency:
|
||||
group: build-ubuntu24-image
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-image:
|
||||
runs-on: ubuntu-latest
|
||||
# Cold first build runs the full ResInsight compile twice (once per
|
||||
# compiler) in the build-warmup stages -- ~3-4 h end-to-end. Incremental
|
||||
# nightly rebuilds reuse the BuildKit cache mount and finish much faster.
|
||||
timeout-minutes: 360
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Compute image name and tag
|
||||
id: meta
|
||||
run: |
|
||||
image="ghcr.io/${GITHUB_REPOSITORY,,}/ci-ubuntu24"
|
||||
date="$(date -u +%Y-%m-%d)"
|
||||
repo_name_lc="${GITHUB_REPOSITORY##*/}"
|
||||
repo_name_lc="${repo_name_lc,,}"
|
||||
web_url="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/pkgs/container/${repo_name_lc}%2Fci-ubuntu24"
|
||||
{
|
||||
echo "image=$image"
|
||||
echo "date=$date"
|
||||
echo "web_url=$web_url"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
echo "Image refs : $image:latest"
|
||||
echo " $image:$date"
|
||||
echo "GHCR page : $web_url"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# The image build is expensive (cold ~3-4 h). If an image tagged with
|
||||
# today's UTC date is already in GHCR, treat the build as already done
|
||||
# for this day and skip. To force a same-day rebuild, dispatch the
|
||||
# workflow with force_rebuild=true (or delete the dated tag from GHCR
|
||||
# and rerun).
|
||||
- name: Check if today's image already exists in GHCR
|
||||
id: check
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force_rebuild }}" == "true" ]]; then
|
||||
echo "force_rebuild=true -- skipping existence check."
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
target="${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.date }}"
|
||||
if docker buildx imagetools inspect "$target" >/dev/null 2>&1; then
|
||||
echo "Image $target already exists -- skipping build."
|
||||
echo "See: ${{ steps.meta.outputs.web_url }}"
|
||||
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Image $target not found -- proceeding with build."
|
||||
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Build and push image
|
||||
if: steps.check.outputs.exists != 'true'
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: .github/docker/Dockerfile.ubuntu24
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.meta.outputs.image }}:latest
|
||||
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.date }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -1,131 +0,0 @@
|
||||
name: Cleanup Ubuntu 24.04 CI Image Versions
|
||||
|
||||
# Daily cleanup of old dated tags pushed by build-ubuntu24-image.yml.
|
||||
#
|
||||
# Retention rules:
|
||||
# * Versions tagged "latest" are always kept (the consumer workflows pull
|
||||
# `:latest`, so deleting it would break CI).
|
||||
# * The most recent MIN_KEEP versions by updated_at are kept regardless of
|
||||
# age. This is a safety floor: if the last few nightly builds break, we
|
||||
# can still roll back to a working older image.
|
||||
# * Of what remains, anything older than RETENTION_DAYS is deleted.
|
||||
#
|
||||
# Owner type (User vs Organization) is auto-detected so the same workflow
|
||||
# runs unchanged on the upstream (OPM/ResInsight, org) and on forks
|
||||
# (e.g. magnesj/ResInsight, user).
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# 03:00 UTC -- after the nightly image build (00:00) and the cache
|
||||
# workflow's containerized run (01:00) have both finished, so we never
|
||||
# race them.
|
||||
- cron: "0 3 * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry_run:
|
||||
description: "List versions that would be deleted without deleting"
|
||||
type: boolean
|
||||
default: false
|
||||
retention_days:
|
||||
description: "Delete versions older than this many days"
|
||||
type: string
|
||||
default: "5"
|
||||
|
||||
concurrency:
|
||||
group: cleanup-ubuntu24-image
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
- name: Delete old image versions
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DRY_RUN: ${{ inputs.dry_run == true && 'true' || 'false' }}
|
||||
RETENTION_DAYS: ${{ inputs.retention_days || '5' }}
|
||||
MIN_KEEP: "3"
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
owner="${GITHUB_REPOSITORY_OWNER}"
|
||||
repo_name_lc="${GITHUB_REPOSITORY##*/}"
|
||||
repo_name_lc="${repo_name_lc,,}"
|
||||
pkg="${repo_name_lc}/ci-ubuntu24"
|
||||
pkg_enc="${pkg/\//%2F}"
|
||||
|
||||
# Owner type drives both the list endpoint and the delete endpoint.
|
||||
# User-owned packages delete via /user/... (authenticated user), org
|
||||
# packages via /orgs/<org>/...
|
||||
owner_type=$(gh api "/users/$owner" --jq '.type')
|
||||
case "$owner_type" in
|
||||
Organization)
|
||||
list_path="/orgs/$owner/packages/container/$pkg_enc/versions"
|
||||
del_prefix="/orgs/$owner/packages/container/$pkg_enc/versions"
|
||||
;;
|
||||
User)
|
||||
list_path="/users/$owner/packages/container/$pkg_enc/versions"
|
||||
del_prefix="/user/packages/container/$pkg_enc/versions"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown owner type: $owner_type" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Owner : $owner ($owner_type)"
|
||||
echo "Package : $pkg"
|
||||
echo "Retention days : $RETENTION_DAYS"
|
||||
echo "Safety floor : keep $MIN_KEEP most recent versions"
|
||||
echo "Dry run : $DRY_RUN"
|
||||
|
||||
# Tolerate 404: the package legitimately does not exist on a fork
|
||||
# that has never published an image yet.
|
||||
if ! versions=$(gh api --paginate "$list_path" 2>/tmp/api.err); then
|
||||
if grep -qiE 'not found|HTTP 404' /tmp/api.err; then
|
||||
echo "Package $pkg not found on $owner -- nothing to clean up."
|
||||
exit 0
|
||||
fi
|
||||
cat /tmp/api.err >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cutoff_epoch=$(date -u -d "$RETENTION_DAYS days ago" +%s)
|
||||
echo "Cutoff (UTC) : $(date -u -d @"$cutoff_epoch" -Iseconds)"
|
||||
|
||||
# jq pipeline:
|
||||
# 1. drop versions whose tags include "latest"
|
||||
# 2. sort newest-first
|
||||
# 3. skip the first MIN_KEEP (safety floor)
|
||||
# 4. keep only those older than the cutoff
|
||||
to_delete=$(jq -c \
|
||||
--argjson keep "$MIN_KEEP" \
|
||||
--argjson cutoff "$cutoff_epoch" '
|
||||
[ .[] | select((.metadata.container.tags // []) | index("latest") | not) ]
|
||||
| sort_by(.updated_at) | reverse
|
||||
| .[$keep:]
|
||||
| [ .[] | select((.updated_at | fromdateiso8601) < $cutoff) ]
|
||||
' <<<"$versions")
|
||||
|
||||
count=$(jq 'length' <<<"$to_delete")
|
||||
echo "Versions to delete: $count"
|
||||
jq -r '.[] | " - id=\(.id) updated=\(.updated_at) tags=\((.metadata.container.tags // []) | join(","))"' <<<"$to_delete"
|
||||
|
||||
if [[ "$count" -eq 0 ]]; then
|
||||
echo "Nothing to do."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "Dry run -- not deleting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
jq -r '.[].id' <<<"$to_delete" | while read -r id; do
|
||||
echo "DELETE $del_prefix/$id"
|
||||
gh api -X DELETE "$del_prefix/$id"
|
||||
done
|
||||
|
||||
echo "Cleanup complete."
|
||||
@@ -3,23 +3,13 @@ name: Copilot Setup Steps
|
||||
# Pre-flight job that GitHub Copilot's coding agent runs before each session.
|
||||
# The job name MUST be `copilot-setup-steps` for the agent to pick it up.
|
||||
#
|
||||
# Runs inside the prebuilt ghcr.io/<repo>/ci-ubuntu24 image
|
||||
# (see .github/docker/Dockerfile.ubuntu24) so the toolchain, Qt, vcpkg binary
|
||||
# cache, and warm ResInsight buildcache are already provisioned. The setup
|
||||
# only has to fetch the source, install the editable rips package, and warm
|
||||
# an incremental build for the agent.
|
||||
# Strategy: mirror the Ubuntu/gcc-14 leg of ResInsightWithCache.yml so we share
|
||||
# the same buildcache and vcpkg cache keys. A nightly run of that workflow
|
||||
# warms the caches; this job restores them and does a configure + build so the
|
||||
# agent's first edit only recompiles the translation units it actually touches.
|
||||
#
|
||||
# Source-path note: the image's warm buildcache was populated at /src
|
||||
# (buildcache hashes the absolute source path baked into compile commands).
|
||||
# actions/checkout puts source at $GITHUB_WORKSPACE; we symlink /src ->
|
||||
# $GITHUB_WORKSPACE and configure at /src so every gcc command line uses
|
||||
# /src/... and matches the baked cache entries. CMake records
|
||||
# CMAKE_SOURCE_DIR as the string passed to -S without resolving symlinks,
|
||||
# so this works transparently. The agent's editor still sees the source at
|
||||
# $GITHUB_WORKSPACE; edits land on the real files /src/... resolves to.
|
||||
#
|
||||
# Manual triggers below are for testing the file itself. The agent invokes
|
||||
# the job automatically -- no trigger is required for that path.
|
||||
# Manual triggers below are for testing the file itself. The agent invokes the
|
||||
# job automatically — no trigger is required for that path.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -30,15 +20,15 @@ on:
|
||||
jobs:
|
||||
copilot-setup-steps:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 59
|
||||
permissions:
|
||||
contents: read
|
||||
packages: read
|
||||
container:
|
||||
image: ghcr.io/${{ github.repository_owner }}/resinsight/ci-ubuntu24:latest
|
||||
credentials:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
timeout-minutes: 60
|
||||
|
||||
env:
|
||||
BUILD_TYPE: Release
|
||||
CC: gcc-14
|
||||
CXX: g++-14
|
||||
QT_VERSION: 6.7.0
|
||||
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
|
||||
BUILDCACHE_ACCURACY: SLOPPY
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -46,78 +36,114 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Fetch default branch reference
|
||||
- name: Set apt mirror
|
||||
# https://github.com/actions/runner-images/issues/7048
|
||||
run: |
|
||||
printf 'http://azure.archive.ubuntu.com/ubuntu\tpriority:1\n' | sudo tee /etc/apt/mirrors.txt
|
||||
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
|
||||
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
|
||||
|
||||
- name: Install Linux system dependencies
|
||||
run: |
|
||||
sudo apt-get update --option="APT::Acquire::Retries=3"
|
||||
sudo apt-get install --option="APT::Acquire::Retries=3" -y \
|
||||
libxkbcommon-x11-0 \
|
||||
libgl1-mesa-dev \
|
||||
mesa-common-dev \
|
||||
libglfw3-dev \
|
||||
libglu1-mesa-dev \
|
||||
libhdf5-dev
|
||||
|
||||
- name: Install gcc-14
|
||||
run: sudo apt-get install --option="APT::Acquire::Retries=3" -y gcc-14 g++-14
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Get Python executable path
|
||||
id: python-path
|
||||
shell: bash
|
||||
run: echo "PYTHON_EXECUTABLE=$(python -c 'import sys, pathlib; print(pathlib.PurePath(sys.executable).as_posix())')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Install Python dev dependencies
|
||||
run: |
|
||||
git config --global --add safe.directory '*'
|
||||
default_branch="${{ github.event.repository.default_branch }}"
|
||||
if [ -n "$default_branch" ]; then
|
||||
git fetch --no-tags origin "+refs/heads/${default_branch}:refs/remotes/origin/${default_branch}"
|
||||
fi
|
||||
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: Symlink /src -> workspace
|
||||
# Aligns the absolute source path with the image's baked buildcache
|
||||
# so the agent's first incremental build hits cache. See file header
|
||||
# for the buildcache hashing rationale.
|
||||
run: ln -sfn "$GITHUB_WORKSPACE" /src
|
||||
- name: Setup buildcache binary
|
||||
uses: CeetronSolutions/setup-buildcache-action@v1.1
|
||||
|
||||
- name: Install rips dev dependencies
|
||||
# rips/_version.py is normally generated by CMake; create a dev
|
||||
# fallback so the editable install below can resolve the version
|
||||
# before configure runs.
|
||||
run: |
|
||||
echo '__version__ = "0.0.0.dev"' > /src/GrpcInterface/Python/rips/_version.py
|
||||
python3 -m pip install -e /src/GrpcInterface/Python[dev]
|
||||
- name: Get current date
|
||||
id: current-time
|
||||
shell: bash
|
||||
run: echo "formattedTime=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Bootstrap vcpkg
|
||||
# /src was freshly checked out, so the ThirdParty/vcpkg/vcpkg binary
|
||||
# produced by bootstrap-vcpkg.sh is not present. The image's baked
|
||||
# /opt/vcpkg-cache-gcc supplies prebuilt dependencies; the binary
|
||||
# itself still has to exist locally for `vcpkg install` to run.
|
||||
run: /src/ThirdParty/vcpkg/bootstrap-vcpkg.sh
|
||||
- name: Restore buildcache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ env.BUILDCACHE_DIR }}
|
||||
# Key/restore-keys mirror ResInsightWithCache.yml's gcc-14 leg so the
|
||||
# nightly CI cache is reused here. Restore-keys fall back to any
|
||||
# older entry in the same family if today's bucket is empty.
|
||||
key: ubuntu-24.04-gcc-14-${{ env.QT_VERSION }}-cache-v03-${{ steps.current-time.outputs.formattedTime }}
|
||||
restore-keys: |
|
||||
ubuntu-24.04-gcc-14-${{ env.QT_VERSION }}-cache-v03-
|
||||
|
||||
- name: Create buildcache dir
|
||||
run: mkdir -p ${{ env.BUILDCACHE_DIR }}
|
||||
|
||||
- name: Install Qt
|
||||
uses: CeetronSolutions/install-qt-action@bump-node24
|
||||
with:
|
||||
version: ${{ env.QT_VERSION }}
|
||||
dir: ${{ github.workspace }}/Qt/
|
||||
cache: true
|
||||
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 binary cache
|
||||
id: vcpkg-cache
|
||||
uses: CeetronSolutions/vcpkg-cache@copilot/optimize-cache-storage-structure
|
||||
with:
|
||||
cache-key: ${{ runner.os }}-g++-14-${{ steps.vcpkg-sha.outputs.sha }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
|
||||
prefix: vcpkg-g++-14/
|
||||
|
||||
- name: Configure
|
||||
env:
|
||||
# vcpkg's compiler-hash detection runs before the CMake toolchain
|
||||
# file is loaded, so -DCMAKE_C_COMPILER on the cmake line is too
|
||||
# late -- vcpkg picks up /usr/bin/c++ (gcc-13 on Ubuntu 24.04) and
|
||||
# computes an ABI hash that does not match the gcc-14 entries baked
|
||||
# into /opt/vcpkg-cache-gcc. Forcing CC/CXX in the env matches what
|
||||
# the Dockerfile's vcpkg-builder-gcc stage exports.
|
||||
CC: gcc-14
|
||||
CXX: g++-14
|
||||
VCPKG_FEATURE_FLAGS: binarycaching
|
||||
# Read vcpkg dependencies from the gcc binary cache baked into the
|
||||
# image. buildcache is auto-discovered on PATH by CMakeLists.txt's
|
||||
# find_program() and wired as CMAKE_CXX_COMPILER_LAUNCHER -- no
|
||||
# explicit setup step is needed. BUILDCACHE_DIR/ACCURACY are baked
|
||||
# in the image ENV (defaults target the gcc-14 leg). Unity build
|
||||
# must be OFF to match the warmup build (mismatched flag would
|
||||
# collapse the cache hit rate).
|
||||
VCPKG_BINARY_SOURCES: "clear;files,/opt/vcpkg-cache-gcc,read"
|
||||
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
|
||||
run: |
|
||||
cmake -S /src -B /src/cmakebuild -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER=gcc-14 \
|
||||
-DCMAKE_CXX_COMPILER=g++-14 \
|
||||
cmake -S . -B cmakebuild \
|
||||
-DVCPKG_BUILD_TYPE=release \
|
||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
|
||||
-DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true \
|
||||
-DRESINSIGHT_ENABLE_PRECOMPILED_HEADERS=false \
|
||||
-DRESINSIGHT_ENABLE_UNITY_BUILD=false \
|
||||
-DRESINSIGHT_ENABLE_GRPC=true \
|
||||
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=$(command -v python3) \
|
||||
-DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} \
|
||||
-DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true \
|
||||
-DRESINSIGHT_ENABLE_HDF5=false \
|
||||
-DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake
|
||||
-DCMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
||||
-G Ninja
|
||||
|
||||
- name: Build (warm buildcache for agent)
|
||||
# Builds the default targets so the agent's first incremental build
|
||||
# only recompiles what it edits. Unity build is off (set above) so a
|
||||
# single .cpp change doesn't invalidate a whole unity blob.
|
||||
run: cmake --build /src/cmakebuild
|
||||
run: cmake --build cmakebuild
|
||||
|
||||
- name: buildcache stats
|
||||
# Watch the hit rate here. If significantly < 80%, something is
|
||||
# invalidating the cache (CMake flag drift, path resolution leaking
|
||||
# through realpath, etc.) and the symlink approach is not paying
|
||||
# off -- fall back to a manual clone into /src.
|
||||
run: buildcache -s
|
||||
Reference in new issue
Block a user