Skip to content

Commit fe6d507

Browse files
committed
Use new CI scheme from X4
1 parent 7eee48e commit fe6d507

5 files changed

Lines changed: 399 additions & 119 deletions

File tree

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Copyright 2026 The Iris Project Contributors
2+
#
3+
# Distributed under the Boost Software License, Version 1.0.
4+
# https://www.boost.org/LICENSE_1_0.txt
5+
6+
name: Setup Toolchain
7+
description: Checkout, install compiler, and fetch environment info
8+
9+
inputs:
10+
os-name:
11+
required: true
12+
os-version:
13+
required: true
14+
compiler-toolset:
15+
required: true
16+
compiler-version:
17+
required: true
18+
compiler-executable:
19+
required: true
20+
compiler-toolset-version:
21+
required: false
22+
type: string
23+
default: ''
24+
vs-path:
25+
required: false
26+
type: string
27+
default: ''
28+
cpp-version-name:
29+
required: true
30+
build-type-name:
31+
required: true
32+
33+
outputs:
34+
compiler-full-version:
35+
description: Full version string of the compiler
36+
value: ${{ steps.env-info.outputs.compiler-full-version }}
37+
deps-cache-key:
38+
description: Cache key for CMake dependencies
39+
value: ${{ steps.env-info.outputs.deps-cache-key }}
40+
41+
runs:
42+
using: composite
43+
steps:
44+
- name: Initialize Ubuntu
45+
if: inputs.os-name == 'ubuntu'
46+
shell: bash
47+
run: |
48+
sudo echo "set man-db/auto-update false" | sudo debconf-communicate
49+
sudo dpkg-reconfigure man-db
50+
51+
- name: Setup GCC
52+
if: inputs.compiler-toolset == 'gcc'
53+
shell: bash
54+
run: |
55+
sudo apt-get update
56+
sudo apt-get install -y g++-${{ inputs.compiler-version }}
57+
58+
- name: Setup Clang
59+
if: inputs.compiler-toolset == 'clang'
60+
shell: bash
61+
run: |
62+
wget https://apt.llvm.org/llvm.sh
63+
chmod +x ./llvm.sh
64+
sudo ./llvm.sh ${{ inputs.compiler-version }}
65+
sudo apt-get install -y libc++-${{ inputs.compiler-version }}-dev libc++abi-${{ inputs.compiler-version }}-dev libunwind-${{ inputs.compiler-version }}-dev
66+
67+
- uses: TheMrMilchmann/setup-msvc-dev@v3
68+
if: inputs.os-name == 'windows'
69+
with:
70+
arch: x64
71+
vs-path: ${{ inputs.vs-path }}
72+
toolset: ${{ inputs.compiler-toolset-version }}
73+
74+
- name: Fetch Environment Info
75+
id: env-info
76+
shell: bash
77+
run: |
78+
set -e
79+
case "${{ inputs.compiler-toolset }}" in
80+
"gcc")
81+
COMPILER_FULL_VERSION=$(${{ inputs.compiler-executable }} -dumpfullversion -dumpversion)
82+
;;
83+
"clang")
84+
COMPILER_FULL_VERSION=$(${{ inputs.compiler-executable }} -dumpversion)
85+
;;
86+
"msvc")
87+
COMPILER_FULL_VERSION=$(powershell -NoProfile -Command "(Get-Command ${{ inputs.compiler-executable }}).FileVersionInfo.FileVersion")
88+
;;
89+
esac
90+
echo "COMPILER_FULL_VERSION=$COMPILER_FULL_VERSION"
91+
echo "compiler-full-version=$COMPILER_FULL_VERSION" >> "$GITHUB_OUTPUT"
92+
echo "deps-cache-key=deps4-${{ inputs.os-name }}-${{ inputs.os-version }}-${{ inputs.compiler-toolset }}-${COMPILER_FULL_VERSION}-${{ inputs.cpp-version-name }}-${{ inputs.build-type-name }}" >> "$GITHUB_OUTPUT"

.github/workflows/GHA-cleanup.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches#force-deleting-cache-entries
2+
3+
name: Cleanup GitHub runner caches on closed pull requests
4+
on:
5+
pull_request:
6+
types:
7+
- closed
8+
9+
jobs:
10+
cleanup:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
actions: write
14+
steps:
15+
- name: Cleanup
16+
run: |
17+
echo "Fetching list of cache keys"
18+
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
19+
20+
## Setting this to not fail the workflow while deleting cache keys.
21+
set +e
22+
echo "Deleting caches..."
23+
for cacheKey in $cacheKeysForPR
24+
do
25+
gh cache delete $cacheKey
26+
done
27+
echo "Done"
28+
env:
29+
GH_TOKEN: ${{ github.token }}
30+
GH_REPO: ${{ github.repository }}
31+
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge

.github/workflows/build.yml

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
# Copyright 2026 The Iris Project Contributors
2+
#
3+
# Distributed under the Boost Software License, Version 1.0.
4+
# https://www.boost.org/LICENSE_1_0.txt
5+
6+
name: Build
7+
8+
on:
9+
workflow_call:
10+
inputs:
11+
os-name:
12+
required: true
13+
type: string
14+
os-version:
15+
required: true
16+
type: string
17+
build-type-name:
18+
required: true
19+
type: string
20+
cpp-version-name:
21+
required: true
22+
type: string
23+
cpp-version-number:
24+
required: true
25+
type: string
26+
compiler-toolset:
27+
required: true
28+
type: string
29+
compiler-version:
30+
required: true
31+
type: string
32+
compiler-executable:
33+
required: true
34+
type: string
35+
compiler-cxxflags:
36+
required: false
37+
type: string
38+
default: ""
39+
compiler-toolset-version:
40+
required: false
41+
type: string
42+
default: ""
43+
vs-path:
44+
required: false
45+
type: string
46+
default: ""
47+
cmake-config-additional-args:
48+
required: false
49+
type: string
50+
default: ""
51+
compiler-builder-additional-args:
52+
required: false
53+
type: string
54+
default: ""
55+
components:
56+
required: true
57+
type: string
58+
description: 'JSON array of components to build (e.g. ["iris", "alloy","x4"])'
59+
60+
env:
61+
IRIS_CI_BUILD_JOBS: 4
62+
63+
jobs:
64+
prepare-deps:
65+
name: "Dependencies"
66+
runs-on: ${{ inputs.os-name }}-${{ inputs.os-version }}
67+
68+
steps:
69+
- uses: actions/checkout@v5
70+
with:
71+
submodules: recursive
72+
73+
- name: Setup Toolchain
74+
id: setup
75+
uses: ./.github/actions/setup-cpp
76+
with:
77+
os-name: ${{ inputs.os-name }}
78+
os-version: ${{ inputs.os-version }}
79+
compiler-toolset: ${{ inputs.compiler-toolset }}
80+
compiler-version: ${{ inputs.compiler-version }}
81+
compiler-executable: ${{ inputs.compiler-executable }}
82+
compiler-toolset-version: ${{ inputs.compiler-toolset-version }}
83+
vs-path: ${{ inputs.vs-path }}
84+
cpp-version-name: ${{ inputs.cpp-version-name }}
85+
build-type-name: ${{ inputs.build-type-name }}
86+
87+
- name: Cache CMake Dependencies (restore)
88+
id: cache-deps
89+
uses: actions/cache/restore@v5
90+
with:
91+
key: ${{ steps.setup.outputs.deps-cache-key }}
92+
path: ${{ github.workspace }}/build/_deps
93+
94+
# Adapt CMP0168; enable caching in CI
95+
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_FULLY_DISCONNECTED
96+
- name: Setup Cached CMake Dependencies
97+
id: deps-info
98+
shell: bash
99+
run: |
100+
if [ "${{ steps.cache-deps.outputs.cache-hit }}" = "true" ]; then
101+
echo "IRIS_CI_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT"
102+
else
103+
echo "IRIS_CI_CMAKE_ARGS=" >> "$GITHUB_OUTPUT"
104+
fi
105+
106+
- name: Configure
107+
env:
108+
CLICOLOR_FORCE: 1
109+
shell: bash
110+
run: |
111+
set -xe
112+
cmake ${{ steps.deps-info.outputs.IRIS_CI_CMAKE_ARGS }} -B build \
113+
${{ inputs.cmake-config-additional-args }} \
114+
-DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \
115+
-DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \
116+
-DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \
117+
-DCMAKE_BUILD_TYPE=${{ inputs.build-type-name }} \
118+
-DIRIS_CI=ON \
119+
-S .
120+
121+
- name: Build Deps
122+
env:
123+
CLICOLOR_FORCE: 1
124+
run: |
125+
cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_CI_BUILD_JOBS }} --target Catch2WithMain ${{ inputs.compiler-builder-additional-args }}
126+
127+
- name: Cache CMake Dependencies (save)
128+
# Due to some bogus "Unable to reserve cache with key" error, we *always* save the cache for now.
129+
# See this page for the rate limit: https://docs.github.com/en/actions/reference/limits#existing-system-limits
130+
# if: steps.cache-deps.outputs.cache-hit != 'true'
131+
uses: actions/cache/save@v5
132+
with:
133+
key: ${{ steps.cache-deps.outputs.cache-primary-key }}
134+
path: ${{ github.workspace }}/build/_deps
135+
136+
build:
137+
name: ${{ matrix.component }}
138+
needs: prepare-deps
139+
runs-on: ${{ inputs.os-name }}-${{ inputs.os-version }}
140+
141+
strategy:
142+
fail-fast: false
143+
144+
matrix:
145+
component: ${{ fromJSON(inputs.components) }}
146+
147+
steps:
148+
- uses: actions/checkout@v5
149+
with:
150+
submodules: recursive
151+
152+
- name: Setup Toolchain
153+
id: setup
154+
uses: ./.github/actions/setup-cpp
155+
with:
156+
os-name: ${{ inputs.os-name }}
157+
os-version: ${{ inputs.os-version }}
158+
compiler-toolset: ${{ inputs.compiler-toolset }}
159+
compiler-version: ${{ inputs.compiler-version }}
160+
compiler-executable: ${{ inputs.compiler-executable }}
161+
cpp-version-name: ${{ inputs.cpp-version-name }}
162+
build-type-name: ${{ inputs.build-type-name }}
163+
164+
- name: Cache CMake Dependencies (restore)
165+
id: cache-deps
166+
uses: actions/cache/restore@v4
167+
with:
168+
key: ${{ steps.setup.outputs.deps-cache-key }}
169+
path: ${{ github.workspace }}/build/_deps
170+
171+
- name: Configure
172+
env:
173+
CLICOLOR_FORCE: 1
174+
shell: bash
175+
run: |
176+
set -xe
177+
cmake -DFETCHCONTENT_FULLY_DISCONNECTED=ON -B build \
178+
-DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \
179+
-DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \
180+
-DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \
181+
-DCMAKE_BUILD_TYPE=${{ inputs.build-type-name }} \
182+
-DIRIS_CI_COMPONENT=${{ matrix.component }} \
183+
-DIRIS_CI=ON \
184+
-S .
185+
186+
- name: Build Tests
187+
env:
188+
CLICOLOR_FORCE: 1
189+
shell: bash
190+
run: |
191+
echo "CPPWARNINGNOTIFIER_LOG_MARKER"
192+
cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_CI_BUILD_JOBS }} ${{ inputs.compiler-builder-additional-args }}
193+
194+
- name: Test
195+
env:
196+
CLICOLOR_FORCE: 1
197+
working-directory: ${{ github.workspace }}/build/test
198+
run: ctest --output-on-failure -C ${{ inputs.build-type-name }}

0 commit comments

Comments
 (0)