This repository has been archived by the owner on Dec 18, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 253
325 lines (286 loc) · 11.8 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: CMake Build
on:
push:
branches:
- master
paths-ignore:
[
"**/**.md",
"**/**.dox2",
"**/**.dox",
"**/**.dox.in",
"**/LICENSE.txt",
"/.builds/**",
"/.github/ISSUE_TEMPLATE/**",
"/.github/funding.yml",
"/.vscode/**",
]
pull_request:
paths-ignore:
[
"**/**.md",
"**/**.dox2",
"**/**.dox",
"**/**.dox.in",
"**/LICENSE.txt",
"/.builds/**",
"/.github/ISSUE_TEMPLATE/**",
"/.github/funding.yml",
"/.vscode/**",
]
workflow_dispatch:
defaults:
run:
shell: bash
# See https://docs.github.com/en/rest/reference/permissions-required-for-github-apps
# for information on what these individual permissions represent/control
permissions:
actions: none
checks: none
contents: read
deployments: none
issues: none
packages: read
pull-requests: none
repository-projects: none
security-events: none
statuses: read
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
permissions:
packages: write
strategy:
fail-fast: false
matrix:
# Matrix id format: {os}-{osname}-{osversion}-{arch}-{triplet}-{generator(_platform)}
# Replace - with _
# Remove .
config:
- name: Linux - Ubuntu 20.04 (x86_64) - Ninja
id: linux-ubuntu-2004-x86_64-x64_linux-ninja
os: ubuntu-20.04
arch: x86_64
vcpkg_triplet: x64-linux
CMAKE_GENERATOR: Ninja
- name: macOS - Big Sur 11 (Intel) - Ninja
id: macos-bigsur-1100-intel-x64_osx_1012min-ninja
os: macos-11
arch: Intel
vcpkg_triplet: x64-osx-10.12min
CMAKE_GENERATOR: Ninja
- name: macOS - Catalina 10.15 (Intel) - Ninja
id: macos-catalina-1015-intel-x64_osx_1012min-ninja
os: macos-10.15
arch: Intel
vcpkg_triplet: x64-osx-10.12min
CMAKE_GENERATOR: Ninja
- name: Windows - Server 2019 (amd64) - Visual Studio 2019
id: windows-server-2019-amd64-x64_windows-vs2019_x64
os: windows-2019
arch: amd64
vcpkg_triplet: x64-windows
CMAKE_GENERATOR: Visual Studio 16 2019
CMAKE_GENERATOR_PLATFORM: x64
- name: Windows - Server 2019 (win32) - Visual Studio 2019
id: windows-server-2019-x86-x86_windows-vs2019_win32
os: windows-2019
arch: x86
vcpkg_triplet: x86-windows
CMAKE_GENERATOR: Visual Studio 16 2019
CMAKE_GENERATOR_PLATFORM: win32
- name: Windows - Server 2019 (amd64) - Ninja
id: windows-server-2019-amd64-x64_windows-ninja
os: windows-2019
arch: amd64
vcpkg_triplet: x64-windows
CMAKE_GENERATOR: Ninja
- name: Windows - Server 2019 (win32) - Ninja
id: windows-server-2019-x86-x86_windows-ninja
os: windows-2019
arch: x86
vcpkg_triplet: x86-windows
CMAKE_GENERATOR: Ninja
env:
AUDACITY_ARCH_LABEL: ${{ matrix.config.arch }}
# CMake settings
CMAKE_BUILD_TYPE: MinSizeRel
CMAKE_GENERATOR: ${{matrix.config.CMAKE_GENERATOR}}
CMAKE_GENERATOR_PLATFORM: ${{matrix.config.CMAKE_GENERATOR_PLATFORM}}
# vcpkg settings
VCPKG_DISABLE_METRICS: true
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }}
NUGET_PACKAGES: ${{ github.workspace }}/vcpkg/packages/
# Apple codesigning
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_NOTARIZATION_USER_NAME: ${{ secrets.APPLE_NOTARIZATION_USER_NAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
# Windows codesigning
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
# WxWidgets info for Linux and macOS builds
WX_VERSION: 3.1.5
steps:
- name: Checkout Git repository
uses: actions/checkout@v2
with:
submodules: true
- name: Get Git commit of vcpkg submodule
run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> ${GITHUB_ENV}
- name: Setup platform specific environmental variables
run: |
if [[ "${{runner.os}}" == "Windows" ]]; then
echo "Using Windows specific env vars"
echo COMPILER_CACHE_PATH=C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache >> ${GITHUB_ENV}
echo COMPILER_CACHE=sccache >> ${GITHUB_ENV}
echo EXE_SUFFIX=.exe >> ${GITHUB_ENV}
echo VCPKG_CACHE_PATH=C:\Users\runneradmin\AppData\Local\vcpkg >> ${GITHUB_ENV}
echo CMAKE_C_COMPILER_LAUNCHER=sccache >> ${GITHUB_ENV}
echo CMAKE_CXX_COMPILER_LAUNCHER=sccache >> ${GITHUB_ENV}
if [[ "${{ env.CMAKE_GENERATOR }}" == "Ninja" ]]; then
echo CC=cl >> ${GITHUB_ENV}
echo CXX=cl >> ${GITHUB_ENV}
fi
else
echo "Using non-Windows env vars"
echo COMPILER_CACHE_PATH= ~/Library/Caches/ccache >> ${GITHUB_ENV}
echo COMPILER_CACHE=ccache >> ${GITHUB_ENV}
echo EXE_SUFFIX= >> ${GITHUB_ENV}
echo VCPKG_CACHE_PATH=~/.cache/vcpkg >> ${GITHUB_ENV}
echo CMAKE_C_COMPILER_LAUNCHER=ccache >> ${GITHUB_ENV}
echo CMAKE_CXX_COMPILER_LAUNCHER=ccache >> ${GITHUB_ENV}
if [[ "${{runner.os}}" == "Linux" ]]; then
echo WX_INSTALL_DIR=/home/runner/work/tenacity/tenacity/wxwidgets-install >> ${GITHUB_ENV}
echo WX_CONFIG=/home/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config >> ${GITHUB_ENV}
else
echo WX_INSTALL_DIR=/Users/runner/work/tenacity/tenacity/wxwidgets-install >> ${GITHUB_ENV}
echo WX_CONFIG=/Users/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config >> ${GITHUB_ENV}
fi
fi
- name: "[macOS] Install Apple codesigning certificates"
uses: apple-actions/import-codesign-certs@v1
if: startswith( matrix.config.os, 'macos' ) && github.repository_owner == 'tenacityteam' && github.event_name == 'create' && github.event.ref_type == 'tag'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v3
with:
arch: ${{ matrix.config.arch }}
- name: Install Nuget
uses: nuget/setup-nuget@v1
with:
nuget-version: 5.10.0
- name: "Authenticate CI to Github Packages"
if: github.repository_owner == 'tenacityteam'
run: |
nuget sources add -Name tenacityteam_github_auto -Source https://nuget.pkg.github.com/tenacityteam/index.json -Username tenacityteam -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText -ForceEnglishOutput -NonInteractive
nuget setapikey ${{ secrets.GITHUB_TOKEN }} -Source tenacityteam_github_auto -ForceEnglishOutput -NonInteractive
echo "VCPKG_BINARY_SOURCES=clear;nuget,tenacityteam_github_auto,readwrite;" >> ${GITHUB_ENV}
- name: "[Linux] Install dependencies"
if: runner.os == 'Linux'
run: >-
sudo apt-get update &&
sudo apt-get install -y --no-install-recommends
file
g++
ninja-build
nasm
git
wget
bash
scdoc
ccache
debhelper-compat
gettext
libasound2-dev
libgtk-3-dev
libsuil-dev
gettext
- name: "[MacOS] Install dependencies"
if: runner.os == 'macOS'
run: >-
brew install
bash
ccache
ninja
nasm
- name: "[Windows] Install dependencies"
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install sccache -y
# Cache the vcpkg executable to avoid bootstrapping each time
- name: "Setup vcpkg executable cache"
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/vcpkg/vcpkg${{ env.EXE_SUFFIX }}
key: ${{ matrix.config.id }}-${{ env.VCPKG_COMMIT }}
- name: "[Linux/macOS] Set up wxWidgets cache"
uses: actions/cache@v2
id: wxwidgets-cache
if: runner.os != 'Windows'
with:
path: ${{ env.WX_INSTALL_DIR }}
key: wx-${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ env.WX_VERSION }}
# FIXME: use wxWidgets from vcpkg for all OSes when bugs are fixed for Linux and macOS
# https://github.com/microsoft/vcpkg/pull/17111
- name: "[Linux/macOS] Build and install wxWidgets"
if: steps.wxwidgets-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
run: |
# wxWidgets' build system does not find dependencies from vcpkg, so use its vendored Git submodules
wget https://github.com/wxWidgets/wxWidgets/releases/download/v${{ env.WX_VERSION }}/wxWidgets-${{ env.WX_VERSION }}.tar.bz2
tar xvf wxWidgets-${{ env.WX_VERSION }}.tar.bz2
rm wxWidgets-${{ env.WX_VERSION }}.tar.bz2
cd wxWidgets-${{ env.WX_VERSION }}
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=${{ env.WX_INSTALL_DIR }} \
-S . -B cmake_build
cmake --build cmake_build
cmake --install cmake_build
- name: Set up compiler cache
uses: actions/cache@v2
with:
path: ${{ env.COMPILER_CACHE_PATH }}
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.head_ref }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ github.head_ref }}-
${{ matrix.config.os }}-${{ matrix.config.arch }}-
- name: Configure
run: cmake -B build -D VCPKG=ON -D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
- name: Build
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: Print compiler cache stats
run: ${{ env.COMPILER_CACHE}} -s
- name: Install
run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: Package
run: |
if [[ "${{runner.os}}" == "Windows" ]]; then
cmake --build build --target innosetup --config ${{ env.CMAKE_BUILD_TYPE }}
else
cd build
cpack -C ${{ env.CMAKE_BUILD_TYPE }} -D CPACK_COMMAND_HDIUTIL=${{ env.CPACK_COMMAND_HDIUTIL }} --verbose
rm -r package/_CPack_Packages
fi
env:
# Workaround for CPack hdiutil/ finder service race condition bug
CPACK_COMMAND_HDIUTIL: ${{ github.workspace }}/scripts/ci/macos/repeat_hdiutil.sh
# Required on Linux to find wxWidgets libraries installed without a package manager
WXWIDGETS_LD_LIBRARY_PATH: ${{ env.WX_INSTALL_DIR }}/lib
- name: Upload package artifact
uses: actions/upload-artifact@v2
with:
name: Tenacity_${{ matrix.config.id }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }}
path: build/package/*
if-no-files-found: error
- name: Upload artifact of vcpkg build logs
uses: actions/upload-artifact@v2
if: always()
with:
name: vcpkg-logs-${{ matrix.config.id }}
path: |
${{ github.workspace }}/vcpkg/buildtrees/**/*.log
${{ github.workspace }}/build/vcpkg-bootstrap.log
if-no-files-found: ignore