-
Notifications
You must be signed in to change notification settings - Fork 0
206 lines (173 loc) · 7.28 KB
/
cmake-build.yaml
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
name: CMake build and tests
on: [ push ]
# TODO: just use CMake presets?
# https://github.com/actions/runner/issues/382
env:
ErrorView: NormalView
jobs:
build:
env:
VALGRIND_GIT_TAG: VALGRIND_3_22_0
VALGRIND_PREFIX: ${{ github.workspace }}/valgrind/
UMB_VALGRIND_BIN: ${{ github.workspace }}/valgrind/bin/valgrind
name: ${{ matrix.os }}-${{ matrix.build_type }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build_type: [ Debug, Release ]
os: [ ubuntu-latest, windows-latest ]
include:
- os: windows-latest
vcpkg_commit_id: 'fe1e9f508ee13ed3d0a7d318beac7efe1ec4f9d7'
umb_include_meta: OFF # TODO: fix later. Boost Hana (and other) issues on MSVC.
umb_run_clang_format: OFF # TODO: seems to cause issues on the runner.
cxx_compiler: cl
cmake_generator: Visual Studio 17 2022
cmake_extra_args: -A x64
- os: ubuntu-latest
vcpkg_commit_id: 'fe1e9f508ee13ed3d0a7d318beac7efe1ec4f9d7'
umb_include_meta: ON
umb_run_clang_format: ON
cxx_compiler: g++
cmake_generator: Ninja
# cmake_extra_args:
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Change default cmd.exe codepage on Windows
run: REG ADD HKCU\Console\%SystemRoot^%_system32_cmd.exe /v CodePage /t REG_DWORD /d 65001
if: matrix.os == 'windows-latest'
- name: Change default PowerShell codepage on Windows
run: REG ADD HKCU\Console\%SystemRoot^%_System32_WindowsPowerShell_v1.0_powershell.exe /v CodePage /t REG_DWORD /d 65001
if: matrix.os == 'windows-latest'
- name: Add Universe repository and check package availability
run: sudo add-apt-repository universe
&& sudo apt update
&& apt search gcc-14
if: matrix.os == 'ubuntu-latest'
- name: Install apt dependencies
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: autoconf-archive build-essential gcc-14 g++14 libc6-dbg
version: 1.1 # NOTE: this is cache version according to the docs.
if: matrix.os == 'ubuntu-latest'
- name: Cache Valgrind
uses: actions/cache@v4
id: cache-valgrind
if: matrix.os == 'ubuntu-latest'
with:
path: ${{ env.VALGRIND_PREFIX }}
key: ${{ runner.os }}-cache-${{ env.VALGRIND_GIT_TAG }}
restore-keys: ${{ runner.os }}-cache-${{ env.VALGRIND_GIT_TAG }}
- name: Install Valgrind
if: ${{ (matrix.os == 'ubuntu-latest') && (steps.cache-valgrind.outputs.cache-hit != 'true') }}
run: git clone https://sourceware.org/git/valgrind.git --depth 1 --branch ${{ env.VALGRIND_GIT_TAG }}
&& cd valgrind
&& ./autogen.sh
&& ./configure --prefix=${{ env.VALGRIND_PREFIX }}
&& make -j2
&& make install
# && find / -name valgrind 2>/dev/null
# && test -e ${{ env.UMB_VALGRIND_BIN }} && echo "Valgrind bin found" || echo "Valgrind bin not found"
- name: List installed gcc binaries
run: find /usr/bin/ -name "*gcc*"
&& whereis gcc
&& whereis g++
&& whereis gcc-14
&& whereis g++-14
if: matrix.os == 'ubuntu-latest'
- name: Set default GCC
run: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 10
--slave /usr/bin/g++ g++ /usr/bin/g++-14
if: matrix.os == 'ubuntu-latest'
- name: Print GCC version
run: gcc --version
if: matrix.os == 'ubuntu-latest'
- name: Print clang-format version
run: clang-format --version
if: matrix.os == 'ubuntu-latest'
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- name: Print MSVC version
run: cl.exe
if: matrix.os == 'windows-latest'
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Create Build Environment
run: cmake -E make_directory ${{ github.workspace }}/build
- name: Setup vcpkg
uses: lukka/run-vcpkg@main
id: runvcpkg
with:
vcpkgDirectory: '${{ runner.workspace }}/build/vcpkg'
vcpkgGitCommitId: '${{ matrix.vcpkg_commit_id }}'
# Run vcpkg with the command specified by the `runVcpkgFormatString` input.
runVcpkgInstall: true
vcpkgJsonGlob: '**/vcpkg.json'
- name: Print output of run-vcpkg's action.
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
- name: Configure CMake
working-directory: ${{ github.workspace }}/build
run: cmake -G "${{ matrix.cmake_generator }}" ${{ env.cmake_extra_args }} ${{ github.workspace }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
-DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake
-DBUILD_TESTS=ON
-DUMB_INCLUDE_META=${{ matrix.umb_include_meta }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx_compiler }}
-DUMB_RUN_CLANG_FORMAT=${{ matrix.umb_run_clang_format }}
- name: Build
working-directory: ${{ github.workspace }}/build
run: cmake --build . --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ matrix.build_type }} --verbose
- name: Print Valgrind version
run:
# find / -name valgrind 2>/dev/null &&
${{ env.UMB_VALGRIND_BIN }} --version
if: matrix.os == 'ubuntu-latest'
- name: Run CTest with Valgrind
env:
VALGRIND_LIB: ${{ env.VALGRIND_PREFIX }}/libexec/valgrind/
run: ctest -C ${{ matrix.build_type }} --verbose -T memcheck
if: matrix.os == 'ubuntu-latest'
- name: Run UMB generator with Valgrind
env:
UMB_GEN_BIN: build/uscript_msgbuf_generator
VALGRIND_LIB: ${{ env.VALGRIND_PREFIX }}/libexec/valgrind/
run: tests/gen_test_messages_with_valgrind.sh
if: matrix.os == 'ubuntu-latest'
- name: Archive UMB generated C++ files
uses: actions/upload-artifact@v4
with:
name: umb-generated-cpp-${{ matrix.os }}-${{ matrix.build_type }}
path: |
build/generated/*.umb.cpp
build/generated/*.umb.hpp
- name: Archive UMB generated UnrealScript files
uses: actions/upload-artifact@v4
with:
name: umb-generated-uscript-${{ matrix.os }}-${{ matrix.build_type }}
path: |
build/generated/*.uc
- name: Archive UMB build artifacts
uses: actions/upload-artifact@v4
with:
name: umb-generator-executable-${{ matrix.os }}-${{ matrix.build_type }}
path: |
build/templates/
build/*.exe
build/*.pdb
build/*.dll
build/*.a
build/*.lib
build/*.so
build/uscript_msgbuf_generator
build/umb_echo_server
build-and-test-with-udk:
needs: [ build ]
uses: ./.github/workflows/udk-tests.yaml