-
Notifications
You must be signed in to change notification settings - Fork 23
193 lines (172 loc) · 7.22 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
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
name: CMake on multiple platforms
on:
push:
branches: [ "stable" ]
pull_request:
branches: [ "stable" ]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release]
bits: [64, 32]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: macos-latest
bits: 32
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 1
fetch-tags: true
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/0.83/Omnibot/build" >> "$GITHUB_OUTPUT"
echo "build-libs-dir=${{ github.workspace }}/build/libs/download" >> "$GITHUB_OUTPUT"
echo "BOOST_ROOT=${{ github.workspace }}/build/libs/boost-1.84.0" >> "$GITHUB_OUTPUT"
- name: Install Linux multilib
if: matrix.os == 'ubuntu-latest' && matrix.bits == 32
run: |
sudo dpkg --add-architecture i386
sudo apt install -y gcc-multilib g++-multilib
- name: Install boost on macos
if: matrix.os == 'macos-latest'
id: install-boost-macos
run: |
mkdir -p ${{ steps.strings.outputs.build-libs-dir }}
cd ${{ steps.strings.outputs.build-libs-dir }}
curl -L -O https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz
tar -xf boost-1.84.0.tar.gz
cd boost-1.84.0
./bootstrap.sh --with-libraries=system,filesystem,regex,date_time
./b2 architecture=arm+x86 cxxflags="-arch x86_64 \
-arch arm64 -mmacosx-version-min=10.12" \
link=static --prefix=${{ steps.strings.outputs.BOOST_ROOT }} \
install
- name: Install boost on linux
if: matrix.os == 'ubuntu-latest'
id: install-boost-linux
run: |
mkdir -p ${{ steps.strings.outputs.build-libs-dir }}
cd ${{ steps.strings.outputs.build-libs-dir }}
curl -L -O https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz
tar -xf boost-1.84.0.tar.gz
cd boost-1.84.0
./bootstrap.sh --with-libraries=system,filesystem,regex,date_time
./b2 address-model=${{ matrix.bits }} cxxflags="-fPIC" link=static \
--prefix=${{ steps.strings.outputs.BOOST_ROOT }} \
install
- name: Install boost on windows
if: matrix.os == 'windows-latest'
shell: cmd
id: install-boost-windows
run: |
mkdir ${{ steps.strings.outputs.build-libs-dir }}
cd ${{ steps.strings.outputs.build-libs-dir }}
curl -L -O https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.zip
unzip -qq boost-1.84.0.zip
cd boost-1.84.0
call .\bootstrap.bat
b2 address-model=${{ matrix.bits }} link=static runtime-link=static ^
--with-system --with-filesystem --with-regex --with-date_time ^
--variant=release --prefix=${{ steps.strings.outputs.BOOST_ROOT }} ^
install
- name: Configure CMake macOS
if: matrix.os == 'macos-latest'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
"-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64"
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.12
-S ${{ github.workspace }}/0.83/Omnibot
env:
BOOST_ROOT: ${{ steps.strings.outputs.BOOST_ROOT }}
- name: Configure CMake Linux
if: matrix.os == 'ubuntu-latest'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_C_FLAGS=-m${{ matrix.bits }}
-DCMAKE_CXX_FLAGS=-m${{ matrix.bits }}
-DCMAKE_SHARED_LINKER_FLAGS=-m${{ matrix.bits }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}/0.83/Omnibot
env:
BOOST_ROOT: ${{ steps.strings.outputs.BOOST_ROOT }}
- name: Configure CMake Windows
if: matrix.os == 'windows-latest'
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}\0.83\Omnibot
-A ${{ matrix.bits == 32 && 'Win32' || 'x64' }}
env:
BOOST_ROOT: ${{ steps.strings.outputs.BOOST_ROOT }}
- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --build-config ${{ matrix.build_type }}
- uses: actions/upload-artifact@v4
name: Upload ET artifacts
with:
name: "${{ matrix.os }}-${{ matrix.bits }}bit-omnibot-ET"
path: "${{ steps.strings.outputs.build-output-dir }}/ET/omnibot_et*"
retention-days: 1
- uses: actions/upload-artifact@v4
name: Upload RTCW artifacts
with:
name: "${{ matrix.os }}-${{ matrix.bits }}bit-omnibot-RTCW"
path: "${{ steps.strings.outputs.build-output-dir }}/RTCW/omnibot_rtcw*"
retention-days: 1
collect:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/download-artifact@v4
name: download all artifacts
with:
path: packages
merge-multiple: true
- uses: geekyeggo/delete-artifact@v4
with:
name: |
*bit-omnibot-*
- uses: actions/upload-artifact@v4
name: Upload final ET artifact
with:
name: "omnibot-ET"
path: "${{ github.workspace }}/packages/omnibot_et*"
retention-days: 1
- uses: actions/upload-artifact@v4
name: Upload final RTCW artifact
with:
name: "omnibot-RTCW"
path: "${{ github.workspace }}/packages/omnibot_rtcw*"
retention-days: 1