diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 000000000..451bde891 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -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" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..1dc35bdb6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,191 @@ +# 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. ["alloy","x4"])' + +env: + IRIS_X4_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 + 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@v4 + 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_X4_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT" + else + echo "IRIS_X4_CMAKE_ARGS=" >> "$GITHUB_OUTPUT" + fi + + - name: Configure + shell: bash + run: | + set -xe + cmake ${{ steps.deps-info.outputs.IRIS_X4_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_TEST_ALLOY=OFF \ + -DIRIS_TEST_X4=OFF \ + -DIRIS_CI=ON \ + -S . + + - name: Build Deps + run: | + cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_X4_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@v4 + 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 + 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 + 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_TEST_ALLOY=${{ case(matrix.component == 'alloy', 'ON', 'OFF') }} \ + -DIRIS_TEST_X4=${{ case(matrix.component == 'x4', 'ON', 'OFF') }} \ + -DIRIS_CI=ON \ + -S . + + - name: Build Tests + run: | + cmake --build build --config ${{ inputs.build-type-name }} -j${{ env.IRIS_X4_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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3c0ccb3c..977419dc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,18 +10,17 @@ on: pull_request: push: branches: - - 'main' + - "main" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -env: - IRIS_X4_BUILD_JOBS: 4 - jobs: changes: + name: "Check Changes" runs-on: ubuntu-latest + outputs: components: ${{ steps.processed.outputs.result }} steps: @@ -31,9 +30,10 @@ jobs: with: filters: | general: - - '.github/workflows/*.yml' - - 'CMakeLists.txt' + - '.github/workflows/**/*.yml' + - '.github/actions/**/*.yml' - 'modules/iris' + - 'CMakeLists.txt' - 'test/CMakeLists.txt' - 'scripts/generate_tuple_members.sh' - 'scripts/generate_tuple_members.bat' @@ -58,15 +58,12 @@ jobs: console.log('result: ', result); return result; - build: - name: "[${{ matrix.cpp_version.name }}] ${{ matrix.components }} | ${{ matrix.compiler.toolset }}-${{ matrix.compiler.version }} (${{ matrix.build_type.name }}) @ ${{ matrix.os.name }}-${{ matrix.os.version }}" + name: "[${{ matrix.cpp_version.name }}] ${{ matrix.compiler.name }} ${{ matrix.compiler.version }} (${{ matrix.build_type.name }})" needs: changes if: ${{ needs.changes.outputs.components != '[]' && needs.changes.outputs.components != '' }} - runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }} - strategy: fail-fast: false @@ -76,6 +73,8 @@ jobs: version: 24.04 - name: windows version: 2022 + - name: windows + version: 2025-vs2026 build_type: - name: Debug lowercase: debug @@ -100,13 +99,31 @@ jobs: - name: MSVC toolset: msvc version: 2022 + toolset_version: 14.44 + vs-path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise + cmake_config_additional_args: -G "Visual Studio 17 2022" + builder_additional_args: -- "-consoleLoggerParameters:ForceConsoleColor" + executable: cl + - name: MSVC + toolset: msvc + version: 2026 + toolset_version: 14.50 + vs-path: C:\Program Files\Microsoft Visual Studio\18\Enterprise + cmake_config_additional_args: -G "Visual Studio 18 2026" builder_additional_args: -- "-consoleLoggerParameters:ForceConsoleColor" executable: cl - - components: ${{ fromJSON(needs.changes.outputs.components) }} exclude: - # Blacklist all invalid combinations of environments + - os: + name: windows + version: 2022 + compiler: + version: 2026 + - os: + name: windows + version: 2025-vs2026 + compiler: + version: 2022 - os: name: windows compiler: @@ -120,100 +137,19 @@ jobs: compiler: name: MSVC - steps: - - uses: actions/checkout@v5 - with: - submodules: recursive - - - name: Initialize Ubuntu - if: matrix.os.name == 'ubuntu' - run: | - sudo echo "set man-db/auto-update false" | sudo debconf-communicate - sudo dpkg-reconfigure man-db - - - name: Setup GCC - if: matrix.compiler.toolset == 'gcc' - run: | - sudo apt-get update - sudo apt-get install -y g++-${{ matrix.compiler.version }} - - - name: Setup Clang - if: matrix.compiler.toolset == 'clang' - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x ./llvm.sh - sudo ./llvm.sh ${{ matrix.compiler.version }} - sudo apt-get install -y libc++-${{ matrix.compiler.version }}-dev libc++abi-${{ matrix.compiler.version }}-dev libunwind-${{ matrix.compiler.version }}-dev - - - uses: TheMrMilchmann/setup-msvc-dev@v3 - if: matrix.os.name == 'windows' - with: - arch: x64 - - - name: Fetch Environment Info - id: env-info - shell: bash - run: | - set -e - case "${{ matrix.compiler.toolset }}" in - "gcc") - COMPILER_FULL_VERSION=$(${{ matrix.compiler.executable }} -dumpfullversion -dumpversion) - ;; - "clang") - COMPILER_FULL_VERSION=$(${{ matrix.compiler.executable }} -dumpversion) - ;; - "msvc") - COMPILER_FULL_VERSION=$(powershell -NoProfile -Command "(Get-Command ${{ matrix.compiler.executable }}).FileVersionInfo.FileVersion") - ;; - esac - echo "COMPILER_FULL_VERSION=$COMPILER_FULL_VERSION" - echo "compiler-full-version=$COMPILER_FULL_VERSION" >> "$GITHUB_OUTPUT" - - - name: Cache CMake Dependencies (restore) - id: cache-deps - uses: actions/cache/restore@v4 - with: - key: deps-${{ matrix.os.name }}-${{ matrix.os.version }}-${{ matrix.compiler.toolset }}-${{ steps.env-info.outputs.compiler-full-version }}-${{ matrix.cpp_version.name }}-${{ matrix.build_type.name }} - 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_X4_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT" - else - echo "IRIS_X4_CMAKE_ARGS=" >> "$GITHUB_OUTPUT" - fi - - - name: Configure - shell: bash - run: | - set -xe - cmake ${{ steps.deps-info.outputs.IRIS_X4_CMAKE_ARGS }} -B build \ - -DCMAKE_CXX_COMPILER=${{ matrix.compiler.executable }} \ - -DCMAKE_CXX_FLAGS="${{ matrix.compiler.cxxflags }}" \ - -DCMAKE_CXX_STANDARD=${{ matrix.cpp_version.number }} \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type.name }} \ - -DIRIS_TEST_ALLOY=${{ case(matrix.components == 'alloy', 'ON', 'OFF') }} \ - -DIRIS_TEST_X4=${{ case(matrix.components == 'x4', 'ON', 'OFF') }} \ - -S . - - - name: Build Tests - run: | - cmake --build build --config ${{ matrix.build_type.name }} -j${{ env.IRIS_X4_BUILD_JOBS }} ${{ matrix.compiler.builder_additional_args }} - - - name: Cache CMake Dependencies (save) - if: steps.cache-deps.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - key: ${{ steps.cache-deps.outputs.cache-primary-key }} - path: ${{ github.workspace }}/build/_deps - - - name: Test - env: - CLICOLOR_FORCE: 1 - working-directory: ${{ github.workspace }}/build/test - run: ctest --output-on-failure -C ${{ matrix.build_type.name }} + uses: ./.github/workflows/build.yml + with: + os-name: ${{ matrix.os.name }} + os-version: ${{ matrix.os.version }} + build-type-name: ${{ matrix.build_type.name }} + cpp-version-name: ${{ matrix.cpp_version.name }} + cpp-version-number: ${{ matrix.cpp_version.number }} + compiler-toolset: ${{ matrix.compiler.toolset }} + compiler-version: ${{ matrix.compiler.version }} + compiler-executable: ${{ matrix.compiler.executable }} + compiler-cxxflags: ${{ matrix.compiler.cxxflags }} + compiler-toolset-version: ${{ matrix.compiler.toolset_version }} + vs-path: ${{ matrix.compiler.vs-path }} + cmake-config-additional-args: ${{ matrix.compiler.cmake_config_additional_args }} + compiler-builder-additional-args: ${{ matrix.compiler.builder_additional_args }} + components: ${{ needs.changes.outputs.components }} diff --git a/modules/iris b/modules/iris index e1d143a0c..2e0e691fa 160000 --- a/modules/iris +++ b/modules/iris @@ -1 +1 @@ -Subproject commit e1d143a0c0ece7373ad73abe999602220140d096 +Subproject commit 2e0e691fa8ec4de4c82eeb8c9f2338c14dbf56b5