-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (150 loc) · 5.51 KB
/
Copy pathcpp-build-test-run.yaml
File metadata and controls
174 lines (150 loc) · 5.51 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
name: C++ build, test and run
on:
workflow_call:
inputs:
homebrew-downloads-hash-from-prepare-macos:
description: Hash of cached Homebrew downloads on MacOS
required: true
type: string
homebrew-downloads-hash-from-prepare-ubuntu:
description: Hash of cached Homebrew downloads on Ubuntu
required: true
type: string
workflow_dispatch:
permissions:
contents: read
jobs:
build-test-run:
strategy:
fail-fast: false
matrix:
os:
- ubuntu
compiler:
- clang
- gcc
cxxLib:
- libc++
- libstdc++
buildType:
- debug
- release
exclude:
- compiler: gcc
cxxLib: libc++
include:
- os: ubuntu
homebrew-downloads-hash-from-prepare: ${{ inputs.homebrew-downloads-hash-from-prepare-ubuntu }}
runsOn: ubuntu-24.04
- os: ubuntu
compiler: clang
cxxLib: libc++
buildType: sanitizers
homebrew-downloads-hash-from-prepare: ${{ inputs.homebrew-downloads-hash-from-prepare-ubuntu }}
runsOn: ubuntu-24.04
- os: ubuntu
compiler: clang
cxxLib: libc++
buildType: hardened
homebrew-downloads-hash-from-prepare: ${{ inputs.homebrew-downloads-hash-from-prepare-ubuntu }}
runsOn: ubuntu-24.04
- os: macos
compiler: clang
cxxLib: libstdc++
buildType: release
homebrew-downloads-hash-from-prepare: ${{ inputs.homebrew-downloads-hash-from-prepare-macos }}
runsOn: macos-15
name: ${{ matrix.os }} ${{ matrix.compiler }} ${{ matrix.cxxLib }} ${{ matrix.buildType }} - Build + test + run
runs-on: ${{ matrix.runsOn }}
timeout-minutes: 30
steps:
- id: preset-name
name: Define workflow preset name
env:
MATRIX_BUILDTYPE: ${{ matrix.buildType }}
MATRIX_COMPILER: ${{ matrix.compiler }}
MATRIX_CXXLIB: ${{ matrix.cxxLib }}
MATRIX_OS: ${{ matrix.os }}
run: |
name="ci-${MATRIX_OS}-${MATRIX_COMPILER}-${MATRIX_CXXLIB}-${MATRIX_BUILDTYPE}"
echo "name=${name}" | tee -a "${GITHUB_OUTPUT}"
shell: bash
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- name: Setup homebrew packages
uses: ./.github/actions/homebrew-packages-setup
with:
cache-mode: use
downloads-hash-from-prepare: ${{ matrix.homebrew-downloads-hash-from-prepare }}
- name: Setup tools through mise
uses: ./.github/actions/mise-project-setup
with:
directory: solvers/cpp
- id: setup-cmake-project
name: Setup CMake project
uses: ./.github/actions/cmake-project-setup
with:
conan-cache-key-prefix: conan-${{ steps.preset-name.outputs.name }}
- if: matrix.os == 'ubuntu'
name: Specify HOMEBREW_PREFIX
run: |
brewPrefix=$(brew --prefix)
echo "HOMEBREW_PREFIX=${brewPrefix}" | tr -d '\n' >> "${GITHUB_ENV}"
shell: bash
- if: matrix.os == 'ubuntu' && matrix.compiler == 'gcc'
name: Add brew binutils to path
run: |
echo "${HOMEBREW_PREFIX}/opt/binutils/bin" >> "${GITHUB_PATH}"
shell: bash
- id: setup-hardened-libcxx
if: matrix.cxxLib == 'libc++' && matrix.buildType == 'hardened'
name: Setup hardened libc++
uses: ./.github/actions/hardened-libc++
with:
llvm-major-version: ${{ env.LLVM_MAJOR_VERSION }}
- if: matrix.cxxLib == 'libc++' && matrix.buildType == 'hardened'
name: Set env to hardened libc++ install dir for CMake and Conan configs
env:
HARDENED_LIBCXX_DIR: ${{ steps.setup-hardened-libcxx.outputs.install-dir }}
run: |
echo "HARDENED_LIBCXX_DIR=${HARDENED_LIBCXX_DIR}" | tr -d '\n' >> "${GITHUB_ENV}"
shell: bash
- if: matrix.buildType == 'sanitizers'
name: Configure sanitizers
run: |
{
echo "ASAN_OPTIONS=detect_leaks=1"
echo "UBSAN_OPTIONS=print_stacktrace=1"
} | tee -a "${GITHUB_ENV}"
echo "${HOMEBREW_PREFIX}/opt/llvm/bin" | tee -a "${GITHUB_PATH}"
shell: bash
- name: Run CMake workflow
uses: lukka/run-cmake@5d55ea7949e25f69f0ecb516d8d572297e03a956 # v10.9
with:
cmakeListsTxtPath: solvers/cpp/CMakeLists.txt
workflowPreset: ${{ steps.preset-name.outputs.name }}
- name: Restore aoc-main uv project
uses: ./.github/actions/uv-project-setup
with:
directory: aoc-main
- name: Extract inputs
uses: ./.github/actions/extract-inputs
with:
encryption-key: ${{ secrets.INPUTS_ENCRYPTION_KEY }}
- name: Run all solutions
env:
AOC_CPP_SKIP_PREPARE: "1"
AOC_CPP_WORKFLOW_PRESET: ${{ steps.preset-name.outputs.name }}
run: mise run aoc:all -- --solver cpp
- continue-on-error: true
if: always()
name: sccache stats
run: sccache --show-stats
shell: bash
- name: Finalize cmake project
uses: ./.github/actions/cmake-project-finalize
with:
conan-cache-key-prefix: conan-${{ steps.preset-name.outputs.name }}
conan-cache-matched-key: ${{ steps.setup-cmake-project.outputs.conan-cache-matched-key }}