Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/actions/setup-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Copyright 2026 The Iris Project Contributors
#
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

name: Setup Toolchain
description: Checkout, install compiler, and fetch environment info

inputs:
os-name:
required: true
os-version:
required: true
compiler-toolset:
required: true
compiler-version:
required: true
compiler-executable:
required: true
compiler-toolset-version:
required: false
type: string
default: ''
vs-path:
required: false
type: string
default: ''
cpp-version-name:
required: true
build-type-name:
required: true

outputs:
compiler-full-version:
description: Full version string of the compiler
value: ${{ steps.env-info.outputs.compiler-full-version }}
deps-cache-key:
description: Cache key for CMake dependencies
value: ${{ steps.env-info.outputs.deps-cache-key }}

runs:
using: composite
steps:
- name: Initialize Ubuntu
if: inputs.os-name == 'ubuntu'
shell: bash
run: |
sudo echo "set man-db/auto-update false" | sudo debconf-communicate
sudo dpkg-reconfigure man-db

- name: Setup GCC
if: inputs.compiler-toolset == 'gcc'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y g++-${{ inputs.compiler-version }}

- name: Setup Clang
if: inputs.compiler-toolset == 'clang'
shell: bash
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh ${{ inputs.compiler-version }}
sudo apt-get install -y libc++-${{ inputs.compiler-version }}-dev libc++abi-${{ inputs.compiler-version }}-dev libunwind-${{ inputs.compiler-version }}-dev

- uses: TheMrMilchmann/setup-msvc-dev@v3
if: inputs.os-name == 'windows'
with:
arch: x64
vs-path: ${{ inputs.vs-path }}
toolset: ${{ inputs.compiler-toolset-version }}

- name: Fetch Environment Info
id: env-info
shell: bash
run: |
set -e
case "${{ inputs.compiler-toolset }}" in
"gcc")
COMPILER_FULL_VERSION=$(${{ inputs.compiler-executable }} -dumpfullversion -dumpversion)
;;
"clang")
COMPILER_FULL_VERSION=$(${{ inputs.compiler-executable }} -dumpversion)
;;
"msvc")
COMPILER_FULL_VERSION=$(powershell -NoProfile -Command "(Get-Command ${{ inputs.compiler-executable }}).FileVersionInfo.FileVersion")
;;
esac
echo "COMPILER_FULL_VERSION=$COMPILER_FULL_VERSION"
echo "compiler-full-version=$COMPILER_FULL_VERSION" >> "$GITHUB_OUTPUT"
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"
31 changes: 31 additions & 0 deletions .github/workflows/GHA-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# https://docs.github.com/en/actions/how-tos/manage-workflow-runs/manage-caches#force-deleting-cache-entries

name: Cleanup GitHub runner caches on closed pull requests
on:
pull_request:
types:
- closed

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup
run: |
echo "Fetching list of cache keys"
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')

## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh cache delete $cacheKey
done
echo "Done"
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
198 changes: 198 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Copyright 2026 The Iris Project Contributors
#
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt

name: Build

on:
workflow_call:
inputs:
os-name:
required: true
type: string
os-version:
required: true
type: string
build-type-name:
required: true
type: string
cpp-version-name:
required: true
type: string
cpp-version-number:
required: true
type: string
compiler-toolset:
required: true
type: string
compiler-version:
required: true
type: string
compiler-executable:
required: true
type: string
compiler-cxxflags:
required: false
type: string
default: ""
compiler-toolset-version:
required: false
type: string
default: ""
vs-path:
required: false
type: string
default: ""
cmake-config-additional-args:
required: false
type: string
default: ""
compiler-builder-additional-args:
required: false
type: string
default: ""
components:
required: true
type: string
description: 'JSON array of components to build (e.g. ["iris", "alloy","x4"])'

env:
IRIS_CI_BUILD_JOBS: 4

jobs:
prepare-deps:
name: "Dependencies"
runs-on: ${{ inputs.os-name }}-${{ inputs.os-version }}

steps:
- uses: actions/checkout@v5
with:
submodules: recursive

- name: Setup Toolchain
id: setup
uses: ./.github/actions/setup-cpp
with:
os-name: ${{ inputs.os-name }}
os-version: ${{ inputs.os-version }}
compiler-toolset: ${{ inputs.compiler-toolset }}
compiler-version: ${{ inputs.compiler-version }}
compiler-executable: ${{ inputs.compiler-executable }}
compiler-toolset-version: ${{ inputs.compiler-toolset-version }}
vs-path: ${{ inputs.vs-path }}
cpp-version-name: ${{ inputs.cpp-version-name }}
build-type-name: ${{ inputs.build-type-name }}

- name: Cache CMake Dependencies (restore)
id: cache-deps
uses: actions/cache/restore@v5
with:
key: ${{ steps.setup.outputs.deps-cache-key }}
path: ${{ github.workspace }}/build/_deps

# Adapt CMP0168; enable caching in CI
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_FULLY_DISCONNECTED
- name: Setup Cached CMake Dependencies
id: deps-info
shell: bash
run: |
if [ "${{ steps.cache-deps.outputs.cache-hit }}" = "true" ]; then
echo "IRIS_CI_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT"
else
echo "IRIS_CI_CMAKE_ARGS=" >> "$GITHUB_OUTPUT"
fi

- name: Configure
env:
CLICOLOR_FORCE: 1
shell: bash
run: |
set -xe
cmake ${{ steps.deps-info.outputs.IRIS_CI_CMAKE_ARGS }} -B build \
${{ inputs.cmake-config-additional-args }} \
-DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \
-DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \
-DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \
-DCMAKE_BUILD_TYPE=${{ inputs.build-type-name }} \
-DIRIS_CI=ON \
-S .

- name: Build Deps
env:
CLICOLOR_FORCE: 1
run: |
cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_CI_BUILD_JOBS }} --target Catch2WithMain ${{ inputs.compiler-builder-additional-args }}

- name: Cache CMake Dependencies (save)
# Due to some bogus "Unable to reserve cache with key" error, we *always* save the cache for now.
# See this page for the rate limit: https://docs.github.com/en/actions/reference/limits#existing-system-limits
# if: steps.cache-deps.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
key: ${{ steps.cache-deps.outputs.cache-primary-key }}
path: ${{ github.workspace }}/build/_deps

build:
name: ${{ matrix.component }}
needs: prepare-deps
runs-on: ${{ inputs.os-name }}-${{ inputs.os-version }}

strategy:
fail-fast: false

matrix:
component: ${{ fromJSON(inputs.components) }}

steps:
- uses: actions/checkout@v5
with:
submodules: recursive

- name: Setup Toolchain
id: setup
uses: ./.github/actions/setup-cpp
with:
os-name: ${{ inputs.os-name }}
os-version: ${{ inputs.os-version }}
compiler-toolset: ${{ inputs.compiler-toolset }}
compiler-version: ${{ inputs.compiler-version }}
compiler-executable: ${{ inputs.compiler-executable }}
cpp-version-name: ${{ inputs.cpp-version-name }}
build-type-name: ${{ inputs.build-type-name }}

- name: Cache CMake Dependencies (restore)
id: cache-deps
uses: actions/cache/restore@v4
with:
key: ${{ steps.setup.outputs.deps-cache-key }}
path: ${{ github.workspace }}/build/_deps

- name: Configure
env:
CLICOLOR_FORCE: 1
shell: bash
run: |
set -xe
cmake -DFETCHCONTENT_FULLY_DISCONNECTED=ON -B build \
-DCMAKE_CXX_COMPILER=${{ inputs.compiler-executable }} \
-DCMAKE_CXX_FLAGS="${{ inputs.compiler-cxxflags }}" \
-DCMAKE_CXX_STANDARD=${{ inputs.cpp-version-number }} \
-DCMAKE_BUILD_TYPE=${{ inputs.build-type-name }} \
-DIRIS_CI_COMPONENT=${{ matrix.component }} \
-DIRIS_CI=ON \
-S .

- name: Build Tests
env:
CLICOLOR_FORCE: 1
shell: bash
run: |
echo "CPPWARNINGNOTIFIER_LOG_MARKER"
cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_CI_BUILD_JOBS }} ${{ inputs.compiler-builder-additional-args }}

- name: Test
env:
CLICOLOR_FORCE: 1
working-directory: ${{ github.workspace }}/build/test
run: ctest --output-on-failure -C ${{ inputs.build-type-name }}
Loading
Loading