build #713
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} | |
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 ninja pkg-config qt5 | |
brew link qt5 --force | |
echo "FC=gfortran-11" >> ${GITHUB_ENV} | |
echo "YACC=/usr/local/opt/bison/bin/bison" >> ${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 |