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: CMake Build | |
on: | |
push: | |
paths-ignore: | |
- '.clang*' | |
- '.gitignore' | |
- 'LICENSE' | |
- 'README*' | |
pull_request: | |
paths-ignore: | |
- '.clang*' | |
- '.gitignore' | |
- 'LICENSE' | |
- 'README*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows-latest | |
- macos-latest | |
- ubuntu-latest | |
build_type: | |
- "RelWithDebInfo" | |
generators: | |
- "Ninja" | |
steps: | |
- name: Install dependencies on windows | |
if: startsWith(matrix.os, 'windows') | |
run: | | |
choco install ninja | |
ninja --version | |
cmake --version | |
- name: Install dependencies on macos | |
if: startsWith(matrix.os, 'macos') | |
shell: bash | |
run: | | |
brew install ninja python-setuptools | |
ninja --version | |
cmake --version | |
clang --version | |
- name: Install dependencies on ubuntu | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build clang | |
ninja --version | |
cmake --version | |
gcc --version | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install custom vcpkg | |
uses: RealChuan/install-vcpkg@main | |
with: | |
repo: 'https://github.com/RealChuan/vcpkg.git' | |
branch: 'dev' | |
- name: Update vcpkg manifest baseline | |
shell: bash | |
run: | | |
vcpkg x-update-baseline | |
- name: Cache vcpkg | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/build/vcpkg_installed | |
key: ${{ matrix.os }}-vcpkg-installed-${{ runner.os }}-${{ github.sha }} | |
restore-keys: | | |
${{ matrix.os }}-vcpkg-installed-${{ runner.os }}- | |
${{ matrix.os }}-vcpkg-installed- | |
${{ matrix.os }}- | |
save-always: true | |
- name: Configure and build windows | |
if: startsWith(matrix.os, 'windows') | |
shell: pwsh | |
run: | | |
.\scripts\windows\setVsDev.ps1 | |
cmake ` | |
-S . ` | |
-B ./build ` | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ` | |
-G "${{ matrix.generators }}" ` | |
; if (-not $?) { Get-Content ./build/vcpkg_installed/vcpkg/issue_body.md; exit 1 } | |
cmake --build ./build --config ${{ matrix.build_type }} | |
- name: Configure and build macos or ubuntu | |
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') | |
shell: bash | |
run: | | |
cmake \ | |
-S . \ | |
-B ./build \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-G "${{ matrix.generators }}" \ | |
|| (cat ./build/vcpkg_installed/vcpkg/issue_body.md && exit 1) | |
cmake --build ./build --config ${{ matrix.build_type }} | |
- name: Test | |
shell: bash | |
run: cd build && ctest -C ${{ matrix.build_type }} --output-on-failure | |