Use iterators to encode data #242
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 * *' | |
env: | |
COMMONFLAGS: '-Wall -Wextra -pedantic -Werror' | |
jobs: | |
build: | |
name: > | |
${{ matrix.os }}, ${{ matrix.compiler }}${{ | |
matrix.version && format('-{0}', matrix.version) || '' | |
}}${{ | |
matrix.boost-version && | |
format(', boost-{0}', matrix.boost-version) || '' | |
}}${{ | |
matrix.extra-desc && format(', {0}', matrix.extra-desc) || '' | |
}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
# GCC builds | |
- {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'} | |
- {os: ubuntu-24.04, compiler: gcc, version: '14', | |
flags: '-Wsuggest-override'} | |
# Clang builds | |
- {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'} | |
- {os: ubuntu-latest, compiler: clang, version: '17'} | |
- {os: ubuntu-latest, compiler: clang, version: '18'} | |
# Windows builds | |
- {os: windows-latest, compiler: msvc, version: '14.4', # VS 2022 | |
boost-version: '1.80.0'} | |
# macOS builds | |
- {os: macos-latest, compiler: clang} | |
# C++23 builds | |
- {os: ubuntu-24.04, compiler: gcc, version: '14', | |
common-options: '--std=c++23', flags: '-Wsuggest-override', | |
boost-version: '1.85.0', extra-desc: 'c++23'} | |
- {os: ubuntu-latest, compiler: clang, version: '18', | |
common-options: '--std=c++23', boost-version: '1.85.0', | |
extra-desc: 'c++23'} | |
fail-fast: false | |
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.version }}-${{ hashFiles('.github/workflows/build.yml') }} | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
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} | |
- name: Install macOS dependencies | |
if: startsWith(matrix.os, 'macos-') | |
run: | | |
brew install boost ninja pkg-config | |
echo "CPATH=/opt/homebrew/include" >> ${GITHUB_ENV} | |
echo "LIBRARY_PATH=/opt/homebrew/lib" >> ${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 '14.4','14.3' | |
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} | |
- 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} | |
- name: Initialize MSVC ${{ matrix.version }} | |
if: startsWith(matrix.os, 'windows-') | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
toolset: ${{ matrix.version }} | |
- name: Clone mettle | |
uses: actions/checkout@v4 | |
with: | |
repository: jimporter/mettle | |
path: mettle | |
- name: Build mettle | |
if: "!startsWith(matrix.os, 'windows-')" | |
run: | | |
pushd mettle | |
9k build --backend=ninja --prefix=${HOME} ${{ matrix.common-options }} | |
cd build | |
ninja install | |
popd | |
echo "PATH=${HOME}/bin:${PATH}" >> ${GITHUB_ENV} | |
echo "CPATH=${HOME}/include:${CPATH}" >> ${GITHUB_ENV} | |
echo "PKG_CONFIG_PATH=${HOME}/lib/pkgconfig" >> ${GITHUB_ENV} | |
echo "CXXFLAGS=${COMMONFLAGS} ${{ matrix.flags }}" >> ${GITHUB_ENV} | |
- name: Build mettle (Windows) | |
if: startsWith(matrix.os, 'windows-') | |
run: | | |
pushd mettle | |
9k build --backend=ninja --prefix=$env:HOME\mettle ${{ matrix.common-options }} | |
cd build | |
ninja install | |
popd | |
echo "PATH=${env:HOME}\mettle;${env:PATH}" >> ${env:GITHUB_ENV} | |
echo "CPATH=${env:HOME}\mettle" >> ${env:GITHUB_ENV} | |
echo "PKG_CONFIG_PATH=${env:HOME}\mettle\pkgconfig" >> ${env:GITHUB_ENV} | |
echo "CXXFLAGS=/WX ${{ matrix.flags }}" >> ${env:GITHUB_ENV} | |
- name: Run tests | |
run: | | |
9k build --backend=ninja ${{ matrix.common-options }} | |
cd build | |
ninja test |