-
Notifications
You must be signed in to change notification settings - Fork 35
206 lines (203 loc) · 6.47 KB
/
build-fast.yml
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
# Build directly on the GitHub runner with caching
name: build-fast
on:
workflow_dispatch:
workflow_call:
concurrency:
group: build-fast-${{github.ref}}-${{github.event.pull_request.number || github.run_number}}-${{github.workflow}}
cancel-in-progress: true
jobs:
linux:
name: "${{matrix.runner}}-${{matrix.compiler}}-${{matrix.version}}${{matrix.cxxstd && format('-c++{0}', matrix.cxxstd) || ''}}"
strategy:
matrix:
include:
- runner: focal
compiler: gcc
version: 8
- runner: focal
compiler: clang
version: 10
- runner: jammy
compiler: gcc
version: 12
- runner: jammy
compiler: clang
version: 15
- runner: noble
compiler: gcc
version: 14
- runner: noble
compiler: clang
version: 18
- runner: noble
compiler: gcc
version: 14
cxxstd: 20
- runner: noble
compiler: clang
version: 18
cxxstd: 20
- runner: noble-arm
compiler: clang
version: 18
cxxstd: 20
env:
GHA_JOB_NAME: "${{matrix.runner}}-${{matrix.compiler}}-${{matrix.version}}${{matrix.cxxstd && format('-c++{0}', matrix.cxxstd) || ''}}"
CCACHE_DIR: "${{github.workspace}}/.ccache"
CCACHE_MAXSIZE: "100Mi"
CMAKE_PRESET: fast
CC: ${{matrix.compiler}}-${{matrix.version}}
CXX: ${{matrix.compiler == 'gcc' && 'g++' || 'clang++'}}-${{matrix.version}}
runs-on: >-
${{ matrix.runner == 'focal' && 'ubuntu-20.04'
|| matrix.runner == 'jammy' && 'ubuntu-22.04'
|| matrix.runner == 'noble' && 'ubuntu-24.04'
|| matrix.runner == 'noble-arm' && 'ubuntu-24.04-arm'
}}
steps:
- name: Install dependencies
run: |
sudo apt-get -q -y update
sudo apt-get -q -y install \
ccache cmake ninja-build python3 \
nlohmann-json3-dev libgtest-dev libhepmc3-dev libpng-dev \
${{matrix.compiler}}-${{matrix.version}} \
${{matrix.compiler == 'gcc' && format('g++-{0}', matrix.version) || ''}}
echo "Installed toolchain:"
ld --version | head -1
$CC --version | head -1
$CXX --version | head -1
- name: Check out Celeritas
uses: actions/checkout@v4
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{env.CCACHE_DIR}}
key: ccache-${{env.GHA_JOB_NAME}}-${{github.run_id}}
restore-keys: |
ccache-${{env.GHA_JOB_NAME}}
- name: Zero ccache stats
run: |
ccache -z
- name: Configure Celeritas
run: |
ln -fs scripts/cmake-presets/ci-ubuntu-github.json CMakeUserPresets.json
cmake --preset=${CMAKE_PRESET} \
${{matrix.cxxstd && format('-DCMAKE_CXX_STANDARD={0} ', matrix.cxxstd) || ''}} \
-DCeleritas_GIT_DESCRIBE="${{github.event.pull_request
&& format(';-pr.{0};', github.event.pull_request.number)
|| format(';-{0};', github.ref_name)}}"
- name: Build
id: build
working-directory: build
run: |
ninja
- name: Run unit tests
id: unittest
run: |
ctest -LE app --preset=${CMAKE_PRESET}-unit
- name: Run app tests
id: apptest
if: ${{!cancelled() && steps.build.outcome == 'success'}}
run: |
ctest -L app --preset=${CMAKE_PRESET}-app
- name: Install
working-directory: build
run: |
ninja install
- name: Check installation
working-directory: install
run: |
./bin/celer-sim --version
- name: Show ccache stats
if: ${{!cancelled()}}
run: |
ccache -s
- name: Upload test results
uses: actions/upload-artifact@v4
if: >-
${{
always()
&& (steps.unittest.outcome == 'success'
|| steps.unittest.outcome == 'failure')
}}
with:
name: test-results-fast-${{env.GHA_JOB_NAME}}
path: "test-output/**/*.xml"
if-no-files-found: error
retention-days: 1
windows:
defaults:
run:
shell: pwsh
env:
CCACHE_DIR: "${{github.workspace}}\\.ccache"
CCACHE_MAXSIZE: "100Mi"
CMAKE_PRESET: fast
runs-on: windows-latest
steps:
- name: Install dependencies
run: |
choco install ninja ccache
- name: Check out Celeritas
uses: actions/checkout@v4
- name: Set up MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Cache ccache
uses: actions/cache@v4
with:
path: ${{env.CCACHE_DIR}}
key: ccache-fast-windows-${{github.run_id}}
restore-keys: |
ccache-fast
- name: Zero ccache stats
run: |
ccache -z
- name: Configure Celeritas
run: |
Copy-Item scripts/cmake-presets/ci-windows-github.json -Destination CMakeUserPresets.json
cmake --preset=$Env:CMAKE_PRESET `
-DCeleritas_GIT_DESCRIBE="${{github.event.pull_request
&& format(';-pr.{0};', github.event.pull_request.number)
|| format(';-{0};', github.ref_name)}}"
- name: Build
id: build
run: |
cmake --build --preset=$Env:CMAKE_PRESET
- name: Run unit tests
id: unittest
continue-on-error: true
run: |
ctest --preset=$Env:CMAKE_PRESET-unit
- name: Run app tests
id: apptest
if: ${{!cancelled() && steps.build.outcome == 'success'}}
run: |
ctest --preset=$Env:CMAKE_PRESET-app
- name: Install
working-directory: build
run: |
cmake --install .
- name: Check installation
working-directory: install
run: |
./bin/celer-sim --version
- name: Show ccache stats
if: ${{!cancelled()}}
run: |
ccache -s
- name: Upload test results
uses: actions/upload-artifact@v4
if: >-
${{
always()
&& (steps.unittest.outcome == 'success'
|| steps.unittest.outcome == 'failure')
}}
with:
name: test-results-fast-windows
path: "test-output/**/*.xml"
if-no-files-found: error
retention-days: 1
# vim: set nowrap tw=100: