88
99jobs :
1010 dotnet :
11- name : .NET Build and Test
11+ name : .NET
1212 runs-on : ubuntu-latest
1313 defaults :
1414 run :
@@ -28,14 +28,14 @@ jobs:
2828 - name : Check formatting
2929 run : dotnet format --verify-no-changes --verbosity diagnostic
3030
31- - name : Build (warnings as errors)
31+ - name : Build
3232 run : dotnet build --no-restore --configuration Release
3333
3434 - name : Test
3535 run : dotnet test --no-build --configuration Release --verbosity normal
3636
3737 format-check :
38- name : clang-format Check
38+ name : clang-format
3939 runs-on : ubuntu-latest
4040 if : github.event_name == 'pull_request'
4141
@@ -45,47 +45,84 @@ jobs:
4545 - name : Install clang-format
4646 run : sudo apt-get update && sudo apt-get install -y clang-format-18
4747
48- - name : Check C++ formatting
48+ - name : Check formatting
4949 run : |
5050 find src include tests -name '*.cpp' -o -name '*.hpp' -o -name '*.h' | \
5151 xargs clang-format-18 --dry-run --Werror
5252
53- native-linux :
54- name : Linux x64 (GCC 13)
55- runs-on : ubuntu-latest
53+ native :
54+ name : ${{ matrix.name }}
55+ runs-on : ${{ matrix.os }}
56+ strategy :
57+ fail-fast : false
58+ matrix :
59+ include :
60+ - name : Linux x64 (GCC 13)
61+ os : ubuntu-latest
62+ triplet : x64-linux
63+ cc : gcc-13
64+ cxx : g++-13
65+ install : sudo apt-get update && sudo apt-get install -y gcc-13 g++-13 ninja-build
66+ generator : Ninja
67+ - name : Windows x64 (MSVC)
68+ os : windows-latest
69+ triplet : x64-windows
70+ generator : Ninja
71+ - name : macOS x64 (AppleClang)
72+ os : macos-latest
73+ triplet : x64-osx
74+ generator : Ninja
5675
5776 env :
58- VCPKG_ROOT : /usr/local/share/vcpkg
5977 VCPKG_DEFAULT_BINARY_CACHE : ${{ github.workspace }}/.vcpkg-cache
6078
6179 steps :
6280 - uses : actions/checkout@v4
6381
64- - name : Create vcpkg binary cache directory
65- run : mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
82+ - name : Create vcpkg binary cache
83+ run : mkdir -p ${{ github.workspace }}/.vcpkg-cache
84+ shell : bash
6685
6786 - name : Cache vcpkg packages
6887 uses : actions/cache@v4
6988 with :
7089 path : .vcpkg-cache
71- key : vcpkg-linux-x64 -${{ hashFiles('vcpkg.json') }}
90+ key : vcpkg-${{ matrix.triplet }} -${{ hashFiles('vcpkg.json') }}
7291 restore-keys : |
73- vcpkg-linux-x64 -
92+ vcpkg-${{ matrix.triplet }} -
7493
75- - name : Install build tools
76- run : |
77- sudo apt-get update
78- sudo apt-get install -y gcc-13 g++-13 ninja-build
94+ - name : Install build tools (Linux)
95+ if : runner.os == 'Linux'
96+ run : ${{ matrix.install }}
97+
98+ - name : Setup MSVC (Windows)
99+ if : runner.os == 'Windows'
100+ uses : ilammy/msvc-dev-cmd@v1
101+ with :
102+ arch : x64
103+
104+ - name : Install Ninja (Windows)
105+ if : runner.os == 'Windows'
106+ run : choco install ninja -y
107+
108+ - name : Install Ninja (macOS)
109+ if : runner.os == 'macOS'
110+ run : brew install ninja
111+
112+ - name : Setup vcpkg
113+ uses : lukka/run-vcpkg@v11
79114
80- - name : Configure (warnings as errors)
115+ - name : Configure
81116 run : |
82117 cmake -B build \
83- -G Ninja \
84- -DCMAKE_C_COMPILER=gcc-13 \
85- -DCMAKE_CXX_COMPILER=g++-13 \
118+ -G "${{ matrix.generator }}" \
119+ ${{ matrix.cc && format(' -DCMAKE_C_COMPILER={0}', matrix.cc) || '' }} \
120+ ${{ matrix.cxx && format(' -DCMAKE_CXX_COMPILER={0}', matrix.cxx) || '' }} \
86121 -DCMAKE_BUILD_TYPE=Release \
87- -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
122+ -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake \
123+ -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
88124 -DBUILD_TESTING=ON
125+ shell : bash
89126
90127 - name : Build
91128 run : cmake --build build --parallel
0 commit comments