This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
233 lines (203 loc) · 8.71 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
name: CMake Build
# Rules: Only run if there's a push to origin/main or a pull request to merge
# a branch into main. Any other branches will NOT be tested, so you must test
# them by yourself, but see #2 for details (this can (should) also be
# discussed there too). The only exception is for 'ci-fixes', having been
# dedicated for CI changes.
on:
push:
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- name: Ubuntu
os: ubuntu-latest
arch: x86_64 # as reported by `arch` or `uname -m`
compiler_cache: ccache
compiler_cache_path: ~/.ccache
vcpkg_binary_cache: ~/.cache/vcpkg
vcpkg_triplet: x64-linux
wxwidgets_git_url: https://github.com/wxWidgets/wxWidgets.git
wxwidgets_git_ref: v3.1.5
WX_CONFIG: /home/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config
- name: macOS_Intel
os: macos-latest
arch: Intel # as reported by Apple menu > About This Mac
compiler_cache: ccache
compiler_cache_path: ~/Library/Caches/ccache
vcpkg_binary_cache: ~/.cache/vcpkg
vcpkg_triplet: x64-osx-10.12min
wxwidgets_git_url: https://github.com/wxWidgets/wxWidgets.git
wxwidgets_git_ref: v3.1.5
WX_CONFIG: /Users/runner/work/tenacity/tenacity/wxwidgets-install/bin/wx-config
#- name: macOS_ARM
# os: macos-latest
# arch: aarch64
# generator: Xcode
# Windows (x86) config
- name: Windows_32bit
os: windows-latest
arch: x86
# required so CMake uses MSVC rather than MinGW
cc: cl
cxx: cl
compiler_cache: sccache
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache
vcpkg_binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg
vcpkg_triplet: x86-windows
exe_suffix: .exe
# Windows (x64) config
- name: Windows_64bit
os: windows-latest
arch: amd64
# required so CMake uses MSVC rather than MinGW
cc: cl
cxx: cl
compiler_cache: sccache
compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache
vcpkg_binary_cache: C:\Users\runneradmin\AppData\Local\vcpkg
vcpkg_triplet: x64-windows
exe_suffix: .exe
env:
CMAKE_BUILD_TYPE: RelWithDebInfo
CMAKE_C_COMPILER_LAUNCHER: ${{ matrix.config.os.compiler_cache }}
CMAKE_CXX_COMPILER_LAUNCHER: ${{ matrix.config.os.compiler_cache }}
MACOSX_DEPLOYMENT_TARGET: 10.12
VCPKG_DISABLE_METRICS: true
VCPKG_DEFAULT_TRIPLET: ${{ matrix.config.vcpkg_triplet }}
# Windows codesigning
# This variables will be used by all the steps
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
AUDACITY_ARCH_LABEL: ${{ matrix.config.arch }}
steps:
- name: Checkout Git repository
uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
exec bash "scripts/ci/dependencies.sh"
- name: Install Apple codesigning certificates
uses: apple-actions/import-codesign-certs@v1
if: startswith( matrix.config.os, 'macos' ) && github.event_name == 'push' && github.repository_owner == 'audacity'
with:
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# required for CMake to find Ninja
- name: "[Windows] Set up MSVC Developer Command Prompt"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-vsdevenv@v4
with:
arch: ${{ matrix.config.arch }}
- name: Get Git commit of vcpkg submodule
run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> ${GITHUB_ENV}
- name: Setup vcpkg cache
uses: actions/cache@v2
with:
# cache the vcpkg executable to avoid having to bootstrap vcpkg every time
path: |
${{ github.workspace }}/vcpkg/vcpkg${{ matrix.config.exe_suffix }}
${{ matrix.config.vcpkg_binary_cache }}
key: ${{ matrix.config.name }}-${{ hashFiles('**/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-${{ github.run_number }}
restore-keys: |
${{ matrix.config.name }}-${{ hashFiles(' **/vcpkg.json') }}-${{ env.VCPKG_COMMIT }}-
${{ matrix.config.name }}-${{ hashFiles(' **/vcpkg.json') }}-
${{ matrix.config.name }}-
# FIXME: hack around bad SSL certificate, needed to build ffmpeg
# https://github.com/microsoft/vcpkg/issues/19121
- name: "[Windows] Install yasm"
if: runner.os == 'Windows'
run: |
mkdir -p "vcpkg/downloads/tools/yasm/1.3.0.6"
curl -k -o "vcpkg/downloads/tools/yasm/1.3.0.6/yasm.exe" \
"http://www.tortall.net/projects/yasm/snapshots/v1.3.0.6.g1962/yasm-1.3.0.6.g1962.exe"
- name: "Set up wxwidgets cache"
uses: actions/cache@v3
id: wxwidgets-cache
if: runner.os != 'Windows'
with:
path: ${{ github.workspace }}/wxwidgets-install
key: ${{ matrix.config.os }}-${{ matrix.config.arch }}-${{ matrix.config.wxwidgets_git_url }}-${{ matrix.config.wxwidgets_git_ref }}
# FIXME: use wxWidgets from vcpkg for all OSes when bugs are fixed for Linux and macOS
# https://github.com/microsoft/vcpkg/pull/17111
- name: 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
git clone --recurse-submodules ${{ matrix.config.wxwidgets_git_url }}
cd wxWidgets
git checkout ${{ matrix.config.wxwidgets_git_ref }}
cmake -G Ninja -D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/wxwidgets-install \
-S . -B cmake_build
cmake --build cmake_build
cmake --install cmake_build
- name: "Set up compiler cache"
uses: actions/cache@v3
with:
path: ${{ matrix.config.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
-G Ninja
-D CMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }}
-D CMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install
-D VCPKG=ON
-S .
-B build
env:
# Apple code signing
APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }}
APPLE_NOTARIZATION_USER_NAME: ${{ secrets.APPLE_NOTARIZATION_USER_NAME }}
APPLE_NOTARIZATION_PASSWORD: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
# hack to get CMake to find wxWidgets until vcpkg wxWidgets port is fixed
# https://github.com/microsoft/vcpkg/pull/17111
WX_CONFIG: ${{ matrix.config.WX_CONFIG }}
- name: Build
run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: "Print compiler cache stats"
run: ${{ matrix.config.compiler_cache }} -s
- name: Install
run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --verbose
- name: "[Windows] Package"
if: runner.os == 'Windows'
run: cmake --build build --target innosetup --config ${{ env.CMAKE_BUILD_TYPE }}
- name: "[Ubuntu/macOS] Package"
if: runner.os != 'Windows'
working-directory: build
run: >-
cpack
-C ${{ env.CMAKE_BUILD_TYPE }}
-D CPACK_COMMAND_HDIUTIL=${{ github.workspace }}/scripts/ci/macos/repeat_hdiutil.sh
--verbose
&& rm -r package/_CPack_Packages
env:
# Required for linuxdeploy to find wxWidgets libraries installed without a package manager
WXWIDGETS_LD_LIBRARY_PATH: ${{ github.workspace }}/wxwidgets-install/lib
- name: Upload package artifact
uses: actions/upload-artifact@v3
with:
name: tenacity_${{ matrix.config.name }}_${{ github.run_id }}_${{ env.GIT_HASH_SHORT }}
path: |
build/package/*
!build/package/_CPack_Packages
if-no-files-found: error
- name: Upload artifact of vcpkg build logs
if: always()
uses: actions/upload-artifact@v3
with:
name: vcpkg-logs-${{ runner.os }}
path: ${{ github.workspace }}/vcpkg/buildtrees/**/*.log