Skip to content

build

build #208

Workflow file for this run

name: build
on:
pull_request:
push:
schedule:
- cron: '0 0 1 * *'
jobs:
build:
name: >
${{ matrix.os }}, ${{ matrix.compiler }}${{
matrix.version && format('-{0}', matrix.version) || ''
}}${{
matrix.boost-version &&
format(', boost-{0}', matrix.boost-version) || ''
}}${{
matrix.backend && format(', {0}', matrix.backend) || ''
}}${{
matrix.extra-desc && format(', {0}', matrix.extra-desc) || ''
}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# GCC builds
- {os: ubuntu-20.04, compiler: gcc, version: '7',
flags: '-Wsuggest-override'}
- {os: ubuntu-20.04, compiler: gcc, version: '8',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '9',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '10',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '11',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '12',
flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: gcc, version: '13',
flags: '-Wsuggest-override'}
# Clang builds
- {os: ubuntu-20.04, compiler: clang, version: '9'}
- {os: ubuntu-20.04, compiler: clang, version: '10'}
- {os: ubuntu-20.04, compiler: clang, version: '11'}
- {os: ubuntu-20.04, compiler: clang, version: '12'}
- {os: ubuntu-latest, compiler: clang, version: '13'}
- {os: ubuntu-latest, compiler: clang, version: '14'}
- {os: ubuntu-latest, compiler: clang, version: '15'}
- {os: ubuntu-latest, compiler: clang, version: '16'}
# Windows builds
- {os: windows-2019, compiler: msvc, version: '14.1', # VS 2017
boost-version: '1.80.0'}
- {os: windows-2019, compiler: msvc, version: '14.2', # VS 2019
boost-version: '1.80.0'}
- {os: windows-latest, compiler: msvc, version: '14.3', # VS 2022
boost-version: '1.80.0'}
# macOS builds
# FIXME: Remove -Wno-deprecated flag.
- {os: macos-latest, compiler: clang, flags: '-Wno-deprecated'}
# Boost 1.58 builds
# (Test 1.58 specifically because it has very strict rules for
# Boost.Variant.)
- {os: ubuntu-latest, compiler: gcc, version: '13',
boost-version: '1.58.0'}
# NDEBUG builds
- {os: ubuntu-latest, compiler: gcc, version: '13',
flags: '-Wsuggest-override -DNDEBUG', extra-desc: 'NDEBUG'}
- {os: ubuntu-latest, compiler: clang, version: '16',
flags: '-DNDEBUG', extra-desc: 'NDEBUG'}
- {os: windows-latest, compiler: msvc, flags: '/DNDEBUG',
version: '14.3', boost-version: '1.80.0', extra-desc: 'NDEBUG'}
# FIXME: Remove -Wno-deprecated flag.
- {os: macos-latest, compiler: clang,
flags: '-Wno-deprecated -DNDEBUG', extra-desc: 'NDEBUG'}
# C++20 builds
- {os: ubuntu-latest, compiler: gcc, version: '13',
options: '--std=c++20', flags: '-Wsuggest-override',
boost-version: '1.78.0', extra-desc: 'c++20'}
- {os: ubuntu-latest, compiler: clang, version: '16',
options: '--std=c++20', boost-version: '1.78.0',
extra-desc: 'c++20'}
# Make-backend builds
- {os: ubuntu-latest, compiler: gcc, version: '13',
backend: 'make', flags: '-Wsuggest-override'}
- {os: ubuntu-latest, compiler: clang, version: '16',
backend: 'make'}
fail-fast: false
env:
COMMONFLAGS: '-Wall -Wextra -pedantic -Werror'
steps:
- uses: actions/checkout@v3
- name: Cache Boost binaries
if: startsWith(matrix.os, 'windows-') && matrix.boost-version
uses: actions/cache@v3
id: cache-boost
with:
path: C:\boost-${{ matrix.boost-version }}
key: >
${{ matrix.os }}-boost-${{ matrix.boost-version }}-msvc-${{
matrix.version }}-${{ hashFiles('.github/workflows/build.yml') }}
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Python dependencies
run: |
pip install bfg9000
- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu-')
run: >
sudo apt-get install
ninja-build
libboost-dev
libboost-iostreams-dev
libboost-program-options-dev
- name: Install Windows dependencies
if: startsWith(matrix.os, 'windows-')
run: |
choco install ninja
${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}
echo "CXXFLAGS=/W3 /WX ${{ matrix.flags }}" >> ${env:GITHUB_ENV}
- name: Install macOS dependencies
if: startsWith(matrix.os, 'macos-')
run: |
brew install ninja pkg-config boost
echo "CXXFLAGS=${COMMONFLAGS} ${{ matrix.flags }}" >> ${GITHUB_ENV}
- name: Install Boost ${{ matrix.boost-version }} from source
if: "!startsWith(matrix.os, 'windows-') && matrix.boost-version"
run: |
export BOOST_ROOT=${HOME}/boost-${{ matrix.boost-version }}
export SRCDIR=boost_`echo ${{ matrix.boost-version }} | sed 's/\./_/g'`
curl -LO https://sourceforge.net/projects/boost/files/boost/${{ matrix.boost-version }}/${SRCDIR}.tar.bz2
tar -xjf ${SRCDIR}.tar.bz2
pushd ${SRCDIR}
./bootstrap.sh --prefix=${BOOST_ROOT} --with-libraries=program_options,iostreams
./b2 link=shared threading=multi variant=release -d0
./b2 install -d0
popd
echo "BOOST_ROOT=${BOOST_ROOT}" >> ${GITHUB_ENV}
- 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.version }}" -replace '(\d+\.\d).*','$1'
if ("${{ steps.cache-boost.outputs.cache-hit }}" -ne "true" ) {
${boost_ver} = "${{ matrix.boost-version }}" -replace '\.','_'
${boostexe} = "boost_${boost_ver}-msvc-${msvcver}-64.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}\lib64-msvc-${msvcver}" >> ${env:GITHUB_ENV}
- name: Install gcc
if: startsWith(matrix.os, 'ubuntu-') && matrix.compiler == 'gcc'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-${{ matrix.version }}
echo "CXX=g++-${{ matrix.version }}" >> ${GITHUB_ENV}
echo "CXXFLAGS=${COMMONFLAGS} ${{ matrix.flags }}" >> ${GITHUB_ENV}
- name: Install clang
if: startsWith(matrix.os, 'ubuntu-') && matrix.compiler == 'clang'
run: |
export CODENAME=`lsb_release -c | sed 's/Codename:\t//'`
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/${CODENAME}/ llvm-toolchain-${CODENAME}-${{ matrix.version }} main"
sudo apt-get update
sudo apt-get install clang-${{ matrix.version }}
echo "CXX=clang++-${{ matrix.version }}" >> ${GITHUB_ENV}
echo "CXXFLAGS=${COMMONFLAGS} ${{ matrix.flags }}" >> ${GITHUB_ENV}
- name: Initialize MSVC ${{ matrix.version }}
if: startsWith(matrix.os, 'windows-')
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: ${{ matrix.version }}
- name: Run tests
run: |
9k build --backend=${{ matrix.backend || 'ninja' }} ${{ matrix.options }}
cd build
${{ matrix.backend || 'ninja' }} test