Repository navigation
230 lines (207 loc) · 7.99 KB
/
Copy pathbuild.yml
File metadata and controls
230 lines (207 loc) · 7.99 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# 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: ""
msvc-toolset-prefix:
required: false
type: string
default: ""
description: 'Version prefix of the MSVC toolset; the newest installed match is used (e.g. "14.5")'
msvc-platform-toolset:
required: false
type: string
default: ""
description: 'Visual Studio platform toolset passed to CMake -T (e.g. "v145")'
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
# Take the local actions from this workflow's own commit, not from the
# caller's checkout, so that callers in other repositories get the
# version this workflow was written against.
- name: Checkout CI Actions
uses: actions/checkout@v5
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: .iris-ci
sparse-checkout: .github/actions
persist-credentials: false
- name: Setup Toolchain
id: setup
uses: ./.iris-ci/.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 }}
msvc-toolset-prefix: ${{ inputs.msvc-toolset-prefix }}
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: Configure
env:
CLICOLOR_FORCE: 1
shell: bash
run: |
set -xe
cmake ${{ steps.cache-deps.outputs.cache-hit == 'true' && '-DFETCHCONTENT_FULLY_DISCONNECTED=ON' || '' }} -B build \
${{ inputs.cmake-config-additional-args }} \
${{ inputs.compiler-toolset == 'msvc' && format('-T {0},version={1}', inputs.msvc-platform-toolset, steps.setup.outputs.msvc-toolset) || '' }} \
-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: Checkout CI Actions
uses: actions/checkout@v5
with:
repository: ${{ job.workflow_repository }}
ref: ${{ job.workflow_sha }}
path: .iris-ci
sparse-checkout: .github/actions
persist-credentials: false
- name: Setup Toolchain
id: setup
uses: ./.iris-ci/.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 }}
msvc-toolset-prefix: ${{ inputs.msvc-toolset-prefix }}
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
# The cache can miss when this job lands on a runner image with another
# toolset than prepare-deps did (e.g. during an image rollout); fetch the
# dependencies again in that case.
- name: Configure
env:
CLICOLOR_FORCE: 1
shell: bash
run: |
set -xe
cmake ${{ steps.cache-deps.outputs.cache-hit == 'true' && '-DFETCHCONTENT_FULLY_DISCONNECTED=ON' || '' }} -B build \
${{ inputs.compiler-toolset == 'msvc' && format('-T {0},version={1}', inputs.msvc-platform-toolset, steps.setup.outputs.msvc-toolset) || '' }} \
-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: Prepare Deps
if: steps.cache-deps.outputs.cache-hit != 'true'
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)
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
- 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 }}