Skip to content

Bump actions/setup-python from 6 to 7 #24

Bump actions/setup-python from 6 to 7

Bump actions/setup-python from 6 to 7 #24

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.
#
# 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.
#
# 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:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
- vcpkg.json
- vcpkg-configuration.json
- ThirdParty/vcpkg
jobs:
copilot-setup-steps:
runs-on: ubuntu-24.04
timeout-minutes: 60
# No job-level `env:` — the Copilot agent's per-step runner strips it, so
# the first step writes all shared vars to $GITHUB_ENV instead. That path
# works for both agent and workflow_dispatch runs.
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
- name: Export env to $GITHUB_ENV
# The Copilot coding agent invokes each step in its own context and
# drops the job-level `env:` block, so ${{ env.X }} expansions go
# empty (breaking cache keys and `path:` inputs). Re-export here so
# later steps see the values in both agent and workflow_dispatch runs.
shell: bash
run: |
echo "BUILD_TYPE=Release" >> $GITHUB_ENV
echo "CC=gcc-14" >> $GITHUB_ENV
echo "CXX=g++-14" >> $GITHUB_ENV
echo "QT_VERSION=6.7.0" >> $GITHUB_ENV
echo "BUILDCACHE_DIR=${{ github.workspace }}/buildcache_dir" >> $GITHUB_ENV
echo "BUILDCACHE_ACCURACY=SLOPPY" >> $GITHUB_ENV
- name: Exclude CI artifacts from git
# The Copilot agent's end-of-session `git add . -v` times out when the
# workspace contains hundreds of vcpkg/Qt/buildcache files. These are
# CI-only paths so we exclude them locally rather than polluting the
# repo's .gitignore. cmakebuild/ is already in .gitignore.
shell: bash
run: |
cat >> .git/info/exclude <<'EOF'
/buildcache_dir/
/Qt/
/.vcpkg-cache/
/vcpkg_installed/
EOF
- 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@v7
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: |
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: Setup buildcache binary
uses: CeetronSolutions/setup-buildcache-action@v1.1
- name: Get current date
id: current-time
shell: bash
run: echo "formattedTime=$(date -u +%Y-%m-%d)" >> $GITHUB_OUTPUT
- name: Restore buildcache
uses: actions/cache@v5
with:
# Inline literals (not ${{ env.X }}) so this works under the Copilot
# agent, whose per-step runner doesn't expose job-level env to
# expression evaluation. Key/restore-keys mirror ResInsightWithCache.yml's
# gcc-14 leg so the nightly CI cache is reused here.
path: ${{ github.workspace }}/buildcache_dir
key: ubuntu-24.04-gcc-14-6.7.0-cache-v03-${{ steps.current-time.outputs.formattedTime }}
restore-keys: |
ubuntu-24.04-gcc-14-6.7.0-cache-v03-
- name: Create buildcache dir
run: mkdir -p ${{ github.workspace }}/buildcache_dir
- name: Install Qt
uses: CeetronSolutions/install-qt-action@bump-node24
with:
version: 6.7.0
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_FEATURE_FLAGS: binarycaching
VCPKG_BINARY_SOURCES: "clear;files,${{ steps.vcpkg-cache.outputs.path }},readwrite"
CC: gcc-14
CXX: g++-14
run: |
cmake -S . -B cmakebuild \
-DVCPKG_BUILD_TYPE=release \
-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=${{ 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 \
-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.
# BUILDCACHE_DIR/ACCURACY set step-local in case the agent runner
# doesn't propagate $GITHUB_ENV writes.
env:
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
BUILDCACHE_ACCURACY: SLOPPY
run: cmake --build cmakebuild
- name: buildcache stats
env:
BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir
run: buildcache -s