-
Notifications
You must be signed in to change notification settings - Fork 21
309 lines (289 loc) · 12.4 KB
/
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
name: build
on:
pull_request:
push:
schedule:
- cron: '0 0 1 * *'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
compiler: [default]
include:
- {os: ubuntu-latest, extra-tests: [mingw-cross],
backends: [ninja, make], flags: -Wall -Werror}
- {os: windows-latest, msvc-version: '14.3', win-sdk: '10.0.20348.0',
boost-version: '1.80.0', qt-version: '5.15.2',
skipped-tests: [fortran, objc, scala],
backends: [ninja, make, msbuild], flags: /WX}
- {os: macos-latest, skipped-tests: [scala], backends: [ninja, make],
flags: -Wall -Werror -Wno-deprecated-declarations
-DGL_SILENCE_DEPRECATION, cxxflags: -std=c++11}
# Python 3.6 builds
- {os: ubuntu-20.04, python-version: '3.6', compiler: default,
backends: [ninja, make], flags: -Wall -Werror}
# Clang builds
- {os: ubuntu-latest, python-version: '3.11',
extra-tests: [mingw-cross],
# Install gfortran-13 and gobjc++-13 since clang will try to link
# to GCC 10 libs and will get confused otherwise.
extra-packages: [clang, gfortran-13, gobjc++-13],
compiler: clang, backends: [ninja, make], flags: -Wall -Werror}
# Xenial builds (for testing GCJ)
# FIXME: Currently disabled, since Github retired these images.
# - {os: ubuntu-16.04, python-version: '3.11', compiler: default,
# extra-packages: [gcj-4.9, gcj-4.9-jdk],
# extra-tests: [mingw-cross, gcj], backends: [ninja, make]}
# VS 2015 builds
- {os: windows-2019, python-version: '3.11', compiler: default,
msvc-version: '14.0', win-sdk: '10.0.17763.0',
boost-version: '1.80.0', qt-version: '5.15.2',
skipped-tests: [fortran, objc, scala],
backends: [ninja, make, msbuild], flags: /WX}
# VS 2017 builds
- {os: windows-2019, python-version: '3.11', compiler: default,
msvc-version: '14.1', win-sdk: '10.0.17763.0',
boost-version: '1.80.0', qt-version: '5.15.2',
skipped-tests: [fortran, objc, scala],
backends: [ninja, make, msbuild], flags: /WX}
# VS 2019 builds
- {os: windows-2019, python-version: '3.11', compiler: default,
msvc-version: '14.2', win-sdk: '10.0.18362.0',
boost-version: '1.80.0', qt-version: '5.15.2',
skipped-tests: [fortran, objc, scala],
backends: [ninja, make, msbuild], flags: /WX}
# VS 2022 x86 builds
- {os: windows-latest, python-version: '3.11', compiler: default-x86,
msvc-version: '14.3', msvc-arch: 'x86', win-sdk: '10.0.20348.0',
boost-version: '1.80.0', skipped-tests: [fortran, objc, qt, scala],
backends: [ninja, make, msbuild], flags: /WX}
# VS 2022 clang-cl builds
- {os: windows-latest, python-version: '3.11', compiler: clang-cl,
msvc-version: '14.3', win-sdk: '10.0.20348.0',
boost-version: '1.80.0', qt-version: '5.15.2',
skipped-tests: [boost, fortran, objc, scala],
backends: [ninja, make], flags: /WX -Wno-microsoft-include
-Wno-unused-command-line-argument -D_CRT_SECURE_NO_WARNINGS}
# MinGW builds
- {os: windows-latest, python-version: '3.11', compiler: mingw,
msvc-version: '14.3', win-sdk: '10.0.20348.0',
qt-version: '5.15.2', qt-arch: 'win64_mingw81',
skipped-tests: [boost, fortran, objc, pch, scala],
backends: [ninja, make], flags: -Wall -Werror}
exclude:
- os: macos-latest
python-version: '3.7'
fail-fast: false
env:
GCJ: gcj-4.9
BACKENDS: ${{ join(matrix.backends, ' ') }}
BFG_EXTRA_TESTS: ${{ join(matrix.extra-tests, ' ') }}
BFG_SKIPPED_TESTS: ${{ join(matrix.skipped-tests, ' ') }}
CPPFLAGS: ${{ matrix.flags }}
CXXFLAGS: ${{ matrix.cxxflags }}
steps:
- uses: actions/checkout@v4
- name: Cache Boost binaries
if: startsWith(matrix.os, 'windows-') && matrix.boost-version
uses: actions/cache@v4
id: cache-boost
with:
path: C:\boost-${{ matrix.boost-version }}
key: >
${{ matrix.os }}-boost-${{ matrix.boost-version }}-msvc-${{
matrix.msvc-version }}-${{ matrix.msvc-arch || 'x64' }}-compiler-${{
matrix.compiler }}-python-${{ matrix.python-version }}-${{
hashFiles('.github/workflows/build.yml') }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
pip install git+https://github.com/jimporter/mopack.git '.[test]'
- name: Initialize MSVC ${{ matrix.msvc-version }}
if: startsWith(matrix.os, 'windows-')
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: ${{ matrix.msvc-version }}
arch: ${{ matrix.msvc-arch || 'x64' }}
sdk: ${{ matrix.win-sdk }}
- name: Install Qt ${{ matrix.qt-version }}
if: matrix.qt-version
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt-version }}
arch: ${{ matrix.qt-arch }}
- name: Install Boost ${{ matrix.boost-version }} from binaries
if: startsWith(matrix.os, 'windows-') && matrix.boost-version
run: |
${boostroot} = "C:\boost-${{ matrix.boost-version }}"
${msvcver} = "${{ matrix.msvc-version }}" -replace '(\d+\.\d).*','$1'
${arch} = if ("${{ matrix.msvc-arch }}" -eq "x86") {"32"} else {"64"}
if ("${{ steps.cache-boost.outputs.cache-hit }}" -ne "true" ) {
${boost_ver} = "${{ matrix.boost-version }}" -replace '\.','_'
${boostexe} = "boost_${boost_ver}-msvc-${msvcver}-${arch}.exe"
curl --retry 3 --retry-all-errors -LO https://sourceforge.net/projects/boost/files/boost-binaries/${{ matrix.boost-version }}/${boostexe}
Start-Process -Wait -FilePath ".\${boostexe}" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=${boostroot}"
}
echo "BOOST_INCLUDEDIR=${boostroot}" >> ${env:GITHUB_ENV}
echo "BOOST_LIBRARYDIR=${boostroot}\lib${arch}-msvc-${msvcver}" >> ${env:GITHUB_ENV}
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu-')
run: >
sudo apt-get update && sudo apt-get install
bison
default-jdk
flex
freeglut3-dev
gcc-multilib
gfortran
gobjc++
libboost-dev
libboost-program-options-dev
libgl1-mesa-dev
libogg-dev
mingw-w64
ninja-build
patchelf
qtbase5-dev
qtbase5-dev-tools
qtchooser
qtdeclarative5-dev
qt5-qmake
scala
${{ join(matrix.extra-packages, ' ') }}
- name: Install Windows dependencies
if: startsWith(matrix.os, 'windows-')
run: |
choco install ninja winflexbison3
# Fetch and install pkg-config.
${gnomebase} = "https://ftp.gnome.org/pub/gnome/binaries/win32"
curl -LO ${gnomebase}/dependencies/pkg-config_0.26-1_win32.zip
curl -LO ${gnomebase}/glib/2.28/glib_2.28.8-1_win32.zip
curl -LO ${gnomebase}/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
7z x -y pkg-config_0.26-1_win32.zip -oC:\pkg-config
7z x -y glib_2.28.8-1_win32.zip -oC:\pkg-config
7z x -y gettext-runtime_0.18.1.1-2_win32.zip -oC:\pkg-config
echo "PKG_CONFIG=C:\pkg-config\bin\pkg-config.exe" >> ${env:GITHUB_ENV}
# Build and install libogg.
curl -LO http://downloads.xiph.org/releases/ogg/libogg-1.3.5.zip
7z x -y libogg-1.3.5.zip
${arch} = "${{ matrix.msvc-arch || 'x64' }}"
if(${arch} -eq 'x86') { ${arch} = "Win32" }
${toolset} = "${{ matrix.msvc-version }}" -replace '(\d+)\.(\d).*','$1$2'
msbuild libogg-1.3.5\win32\VS2015\libogg.sln /p:Configuration=ReleaseDLL /p:Platform=${arch} /p:PlatformToolset=v${toolset} /p:WindowsTargetPlatformVersion=${{ matrix.win-sdk }}
mkdir lib
${liboggbase} = "libogg-1.3.5\win32\VS2015\${arch}\ReleaseDLL"
copy ${liboggbase}\libogg.lib lib\ogg.lib
copy ${liboggbase}\libogg.dll lib\ogg.dll
robocopy libogg-1.3.5\include include *.h /E
if(${LastExitCode} -le 7) { ${LastExitCode} = 0 }
# Set up environment variables.
if(${env:Qt5_DIR}) {
echo "QT_ROOT=${env:Qt5_DIR}" >> ${env:GITHUB_ENV}
${env:LIBRARY_PATH} = "${env:LIBRARY_PATH};${env:Qt5_DIR}\lib"
${env:PATH} = "${env:PATH};${env:Qt5_DIR}\lib"
}
echo "CPPFLAGS=-I${pwd}\include ${env:CPPFLAGS}" >> ${env:GITHUB_ENV}
echo "LIBRARY_PATH=${env:LIBRARY_PATH};${pwd}\lib" >> ${env:GITHUB_ENV}
echo "PATH=${env:PATH};${pwd}\lib" >> ${env:GITHUB_ENV}
- name: Install macOS dependencies
if: startsWith(matrix.os, 'macos-')
run: |
brew install bison boost libogg ninja pkg-config qt5
brew link qt5 --force
echo "FC=gfortran-11" >> ${GITHUB_ENV}
echo "YACC=/opt/homebrew/opt/bison/bin/bison" >> ${GITHUB_ENV}
echo "CPATH=/opt/homebrew/include" >> ${GITHUB_ENV}
echo "LIBRARY_PATH=/opt/homebrew/lib" >> ${GITHUB_ENV}
- name: Set up clang
if: matrix.compiler == 'clang'
run: |
echo "CC=clang" >> ${GITHUB_ENV}
echo "CXX=clang++" >> ${GITHUB_ENV}
- name: Set up clang-cl
if: matrix.compiler == 'clang-cl'
run: |
echo "CC=clang-cl" >> ${env:GITHUB_ENV}
echo "CXX=clang-cl" >> ${env:GITHUB_ENV}
- name: Set up mingw
if: matrix.compiler == 'mingw'
run: |
echo "PATH=C:\msys64\mingw64\bin;${env:PATH}" >> ${env:GITHUB_ENV}
echo "CC=gcc" >> ${env:GITHUB_ENV}
echo "CXX=g++" >> ${env:GITHUB_ENV}
- name: Run tests
run: |
python setup.py coverage -q
coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
build-cygwin:
runs-on: windows-latest
env:
CYGROOT: C:\cygwin
CYGCACHE: C:\cygwin\var\cache\setup
steps:
- uses: actions/checkout@v4
- name: Install Cygwin
shell: cmd
run: >
curl -LO https://cygwin.com/setup-x86_64.exe
.\setup-x86_64.exe -qgnNdO -R %CYGROOT% -l %CYGCACHE%
-s http://mirrors.kernel.org/sourceware/cygwin/
-P gcc-g++,git,make,ninja,python38,python38-pip,python38-setuptools
- name: Copy bfg9000 to Cygwin
run: |
robocopy . ${env:CYGROOT}\home\runneradmin\bfg9000 /E
if(${LastExitCode} -le 7) { ${LastExitCode} = 0 }
- name: Install Python dependencies
run: >
C:\cygwin\bin\bash -lc
"cd bfg9000 && pip3.8 install
coverage git+https://github.com/jimporter/mopack.git ."
- name: Run tests
run: >
C:\cygwin\bin\bash -lc
"cd bfg9000 && python3.8 setup.py coverage -s
test.integration.test_executable && coverage xml"
- name: Copy coverage from Cygwin
run: |
copy C:\cygwin\home\runneradmin\bfg9000\coverage.xml .
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
bdist-wheel:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Test bdist_wheel
run: |
pip install wheel
python setup.py bdist_wheel
pip install dist/*.whl
! pip show pysetenv
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install '.[test]'
- name: Run lint
run: |
flake8