-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (112 loc) · 4.38 KB
/
cmake_build.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
name: Build cmake project
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VALGRIND_GIT_TAG: VALGRIND_3_24_0
VALGRIND_PREFIX: ${{ github.workspace }}/valgrind/
BO_VALGRIND_BIN: ${{ github.workspace }}/valgrind/bin/valgrind
strategy:
fail-fast: false
matrix:
build_type: [ "debug", "release", "relwithdbg" ]
os: [ "ubuntu-24.04", "windows-2025" ]
exclude:
- os: "ubuntu-24.04"
build_type: "relwithdbg"
include:
- os: "ubuntu-24.04"
platform: "linux"
preset_prefix: "-gcc"
cmake_generator: Ninja
# cmake_extra_args: ""
- os: "windows-2025"
platform: "windows"
preset_prefix: ""
cmake_generator: Visual Studio 17 2022
cmake_extra_args: -A x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- 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-24.04'
- 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.2 # NOTE: this is cache version according to the docs.
if: matrix.os == 'ubuntu-24.04'
- name: Setup mold
uses: rui314/setup-mold@v1
if: matrix.os == 'ubuntu-24.04'
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
with:
version: 1.12.1
- name: Print Ninja version
run: ninja --version
- name: Cache Valgrind
uses: actions/cache@v4
id: cache-valgrind
if: matrix.os == 'ubuntu-24.04'
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-24.04') && (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
- name: Save installed Valgrind to cache
if: ${{ (matrix.os == 'ubuntu-24.04') && (steps.cache-valgrind.outputs.cache-hit != 'true') }}
uses: actions/cache/save@v4
with:
path: ${{ env.VALGRIND_PREFIX }}
key: ${{ runner.os }}-cache-${{ env.VALGRIND_GIT_TAG }}
- 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-24.04'
- 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-24.04'
- name: Print GCC version
run: gcc --version
if: matrix.os == 'ubuntu-24.04'
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-2025'
- name: Print MSVC version
run: cl.exe
if: matrix.os == 'windows-2025'
- name: Configure CMake
working-directory: ${{ github.workspace }}/build_commands_bot
run: cmake -G "${{ matrix.cmake_generator }}" ${{ env.cmake_extra_args }} --preset
config-${{ matrix.platform }}-${{ matrix.build_type }}-x64${{ matrix.preset_prefix }}
- name: Build with CMake
working-directory: ${{ github.workspace }}/build_commands_bot
run: cmake --build --preset ${{ matrix.platform }}-${{ matrix.build_type }}-x64${{ matrix.preset_prefix }}