Skip to content

C++20 compatible polyfill for <expected> #1055

C++20 compatible polyfill for <expected>

C++20 compatible polyfill for <expected> #1055

Workflow file for this run

name: build
on:
push:
branches:
- main
paths:
- '.github/workflows/build.yml'
- 'include/**'
- 'tests/**'
- 'CMakeLists.txt'
- 'cmake/**'
- 'nix/**'
pull_request:
branches:
- main
paths:
- '.github/workflows/build.yml'
- 'include/**'
- 'tests/**'
- 'CMakeLists.txt'
- 'cmake/**'
- 'nix/**'
jobs:
linux:
runs-on:
group: default
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
env:
- compiler: gcc
release: 12
modes: "cxx20"
- compiler: clang
release: 16
modes: "cxx20"
- compiler: clang
release: 17
modes: "cxx20"
- compiler: gcc
release: 13
modes: "cxx20 cxx23"
- compiler: gcc
release: 14
modes: "cxx20 cxx23"
- compiler: clang
release: 18
modes: "cxx20 cxx23"
- compiler: clang
release: 19
modes: "cxx20 cxx23"
container: libfn/ci-build-${{ matrix.env.compiler }}:${{ matrix.env.release }}
steps:
- uses: actions/checkout@v4
- name: Prepare build
run: |
mkdir .build
cd .build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
COMPILER=$( grep -iE "^CMAKE_CXX_COMPILER:FILEPATH=" CMakeCache.txt | sed -n 's/^[^=]*=//p' )
FLAGS=$( grep -iE "^CMAKE_CXX_FLAGS(_${{ matrix.configuration }})?:STRING" CMakeCache.txt | sed -n 's/^[^=]*=//p' | tr '\n' ' ' )
printf "C++ compiler path: %s\n" "$COMPILER"
$COMPILER --version
printf "C++ compilation options: %s\n" "$FLAGS"
- name: Build and test C++20 mode
if: ${{ contains( matrix.env.modes, 'cxx20' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx20
ctest -L cxx20 --output-on-failure
- name: Build and test C++23 mode
if: ${{ contains( matrix.env.modes, 'cxx23' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx23
ctest -L cxx23 --output-on-failure
# We want to build all for at least one arbitrary configuration
- name: Build and test all
if: ${{ matrix.env.compiler == 'gcc' && matrix.env.release == '14' }}
run: |
cd .build
cmake --build . --target clean
cmake --build .
ctest --output-on-failure
macos:
runs-on: macos-${{ matrix.env.osver }}
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
env:
- compiler: appleclang
osver: 15
modes: "cxx20 cxx23"
- compiler: clang
release: 18
osver: 15
modes: "cxx20 cxx23"
steps:
- uses: actions/checkout@v4
- name: Prepare build
run: |
mkdir .build
cd .build
if [[ "${{ matrix.env.compiler }}" == "appleclang" ]]; then
export CXX="$(which clang++)"
export CC="$(which clang)"
fi
if [[ "${{ matrix.env.compiler }}" == "clang" ]]; then
export CXX="$(brew --prefix llvm@${{ matrix.env.release }})/bin/clang++"
export CC="$(brew --prefix llvm@${{ matrix.env.release }})/bin/clang"
fi
cmake -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} ..
COMPILER=$( grep -iE "^CMAKE_CXX_COMPILER:FILEPATH=" CMakeCache.txt | sed -n 's/^[^=]*=//p' )
FLAGS=$( grep -iE "^CMAKE_CXX_FLAGS(_${{ matrix.configuration }})?:STRING" CMakeCache.txt | sed -n 's/^[^=]*=//p' | tr '\n' ' ' )
printf "C++ compiler path: %s\n" "$COMPILER"
$COMPILER --version
printf "C++ compilation options: %s\n" "$FLAGS"
- name: Build and test C++20 mode
if: ${{ contains( matrix.env.modes, 'cxx20' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx20
ctest -L cxx20 --output-on-failure
- name: Build and test C++23 mode
if: ${{ contains( matrix.env.modes, 'cxx23' ) }}
run: |
cd .build
cmake --build . --target clean
cmake --build . --target cxx23
ctest -L cxx23 --output-on-failure
windows:
runs-on: windows-${{ matrix.env.osver }}
strategy:
fail-fast: false
matrix:
configuration:
- Debug
- Release
env:
- compiler: "Visual Studio 17 2022"
osver: 2025
modes: "cxx20"
steps:
- uses: actions/checkout@v4
- name: Prepare build
run: |
mkdir .build
cd .build
cmake -G "${{ matrix.env.compiler }}" -A x64 ..
- name: Build and test C++20 mode
if: ${{ contains( matrix.env.modes, 'cxx20' ) }}
run: |
cd .build
cmake --build . --config ${{ matrix.configuration }} --target clean
cmake --build . --config ${{ matrix.configuration }} --target cxx20
ctest -L cxx20 -C ${{ matrix.configuration }} --output-on-failure
- name: Build and test C++23 mode
if: ${{ contains( matrix.env.modes, 'cxx23' ) }}
run: |
cd .build
cmake --build . --config ${{ matrix.configuration }} --target clean
cmake --build . --config ${{ matrix.configuration }} --target cxx23
ctest -L cxx23 -C ${{ matrix.configuration }} --output-on-failure
nixos:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler:
- gcc
- clang
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Build and test
run: nix -L build '.#${{matrix.compiler}}'