-
Notifications
You must be signed in to change notification settings - Fork 0
212 lines (190 loc) · 6.56 KB
/
build.yml
File metadata and controls
212 lines (190 loc) · 6.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# 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: Copy Local GitHub Actions
shell: bash
run: |
if [ -e modules/iris ]; then
cp -r modules/iris/.github/actions .github/
fi
- 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.setup.outputs.deps-cache-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: Copy Local GitHub Actions
shell: bash
run: |
if [ -e modules/iris ]; then
cp -r modules/iris/.github/actions .github/
fi
- 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@v5
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 }}