Add clang-21 to build #1152
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/build.yml' | |
| - 'include/**' | |
| - 'tests/**' | |
| - 'CMakeLists.txt' | |
| - 'cmake/**' | |
| - 'nix/**' | |
| - 'flake.nix' | |
| - 'flake.lock' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - '.github/workflows/build.yml' | |
| - 'include/**' | |
| - 'tests/**' | |
| - 'CMakeLists.txt' | |
| - 'cmake/**' | |
| - 'nix/**' | |
| - 'flake.nix' | |
| - 'flake.lock' | |
| jobs: | |
| linux: | |
| runs-on: | |
| group: runners-arm64 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| mode: | |
| - cxx20 | |
| - cxx23 | |
| configuration: | |
| - Debug | |
| - Release | |
| compiler: | |
| - "gcc:12" | |
| - "clang:16" | |
| - "clang:17" | |
| - "gcc:13" | |
| - "gcc:14" | |
| - "gcc:15" | |
| - "clang:18" | |
| - "clang:19" | |
| - "clang:20" | |
| - "clang:21" | |
| exclude: | |
| - mode: cxx23 | |
| compiler: "gcc:12" | |
| - mode: cxx23 | |
| compiler: "clang:16" | |
| - mode: cxx23 | |
| compiler: "clang:17" | |
| container: libfn/ci-build-${{ matrix.compiler }} | |
| 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 ${{ matrix.mode }} | |
| run: | | |
| cd .build | |
| cmake --build . --target ${{ matrix.mode }} | |
| ctest -L ${{ matrix.mode }} --output-on-failure | |
| # Build and test all for one arbitrary configuration | |
| - name: Build and test all | |
| if: ${{ matrix.compiler == 'gcc:14' && matrix.mode == 'cxx23' }} | |
| run: | | |
| cd .build | |
| cmake --build . --target clean | |
| cmake --build . | |
| ctest --output-on-failure | |
| macos: | |
| runs-on: macos-${{ matrix.osver }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| mode: | |
| - cxx20 | |
| - cxx23 | |
| configuration: | |
| - Debug | |
| - Release | |
| compiler: | |
| - appleclang | |
| - clang | |
| osver: | |
| - 14 | |
| - 15 | |
| clangrelease: | |
| - NA | |
| - 18 | |
| exclude: | |
| - compiler: clang | |
| osver: 14 | |
| - compiler: clang | |
| clangrelease: NA | |
| - compiler: appleclang | |
| clangrelease: 18 | |
| - mode: cxx23 | |
| compiler: appleclang | |
| osver: 14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare build | |
| run: | | |
| mkdir .build | |
| cd .build | |
| if [[ "${{ matrix.compiler }}" == "appleclang" ]]; then | |
| export CXX="$(which clang++)" | |
| export CC="$(which clang)" | |
| fi | |
| if [[ "${{ matrix.compiler }}" == "clang" ]]; then | |
| export CXX="$(brew --prefix llvm@${{ matrix.clangrelease }})/bin/clang++" | |
| export CC="$(brew --prefix llvm@${{ matrix.clangrelease }})/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 ${{ matrix.mode }} | |
| run: | | |
| cd .build | |
| cmake --build . --target ${{ matrix.mode }} | |
| ctest -L ${{ matrix.mode }} --output-on-failure | |
| # Build and test all for one arbitrary configuration | |
| - name: Build and test all | |
| if: ${{ matrix.compiler == 'appleclang' && matrix.osver == '15' && matrix.mode == 'cxx23' }} | |
| run: | | |
| cd .build | |
| cmake --build . --target clean | |
| cmake --build . | |
| ctest --output-on-failure | |
| windows: | |
| runs-on: windows-${{ matrix.osver }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| mode: | |
| - cxx20 | |
| configuration: | |
| - Debug | |
| - Release | |
| compiler: | |
| - "Visual Studio 17 2022" | |
| osver: | |
| - 2025 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Prepare build | |
| shell: bash | |
| run: | | |
| mkdir .build | |
| cd .build | |
| cmake -G "${{ matrix.compiler }}" -A x64 .. | |
| LINKER=$( grep -iE "^CMAKE_LINKER: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++ linker path: %s\n" "$LINKER" | |
| "$LINKER" . || true | |
| printf "C++ compilation options: %s\n" "$FLAGS" | |
| - name: Build and test ${{ matrix.mode }} | |
| shell: bash | |
| run: | | |
| cd .build | |
| cmake --build . --target ${{ matrix.mode }} --config ${{ matrix.configuration }} | |
| ctest -L ${{ matrix.mode }} -C ${{ matrix.configuration }} --output-on-failure | |
| nixos: | |
| runs-on: | |
| group: runners-intel | |
| 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}}' |