Adds caching to CI workflow #62
Workflow file for this run
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 on multiple platforms | |
on: | |
push: | |
branches: | |
- master | |
- main | |
- dev | |
pull_request: | |
branches: | |
- master | |
- main | |
- dev | |
jobs: | |
Cloning-Job: | |
runs-on: [self-hosted, x64] | |
steps: | |
- name: Cloning | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
Self-Hosted-Windows-Job: | |
runs-on: [self-hosted, Windows, x64] | |
needs: Cloning-Job | |
strategy: | |
fail-fast: true | |
matrix: | |
compiler: | |
- msvc | |
- clang | |
build_type: | |
- debug | |
- dev | |
- release | |
steps: | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/vcpkg | |
./build/vcpkg_installed | |
${{ env.HOME }}/.cache/vcpkg/archives | |
${{ env.XDG_CACHE_HOME }}/vcpkg/archives | |
${{ env.LOCALAPPDATA }}\vcpkg\archives | |
${{ env.APPDATA }}\vcpkg\archives | |
key: windows-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}} | |
restore-keys: | | |
windows-${{ matrix.build_type }}- | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
vcvarsall: true | |
- name: Configuring | |
run: | | |
echo "[cmake-multi-platform][TRACE] Configuring" | |
cmake -S ${{ github.workspace }} --preset windows-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Building | |
run: | | |
echo "[cmake-multi-platform][TRACE] Building" | |
cmake --build ${{ github.workspace }}/out/build/windows-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Testing | |
run: | | |
echo "[cmake-multi-platform][TRACE] Testing" | |
ctest --test-dir ${{ github.workspace }}/out/build/windows-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Installing | |
run: echo "[cmake-multi-platform][TRACE] Installing" | |
- name: Packaging | |
run: echo "[cmake-multi-platform][TRACE] Packaging" | |
Self-Hosted-Linux-Job: | |
runs-on: [self-hosted, Linux, x64] | |
needs: Cloning-Job | |
strategy: | |
fail-fast: true | |
matrix: | |
compiler: | |
- gcc | |
- clang | |
build_type: | |
- debug | |
- dev | |
- release | |
steps: | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/vcpkg | |
./build/vcpkg_installed | |
${{ env.HOME }}/.cache/vcpkg/archives | |
${{ env.XDG_CACHE_HOME }}/vcpkg/archives | |
${{ env.LOCALAPPDATA }}\vcpkg\archives | |
${{ env.APPDATA }}\vcpkg\archives | |
key: linux-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}} | |
restore-keys: | | |
linux-${{ matrix.build_type }}- | |
- name: Configuring | |
run: | | |
echo "[cmake-multi-platform][TRACE] Configuring" | |
cmake -S ${{ github.workspace }} --preset linux-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Building | |
run: | | |
echo "[cmake-multi-platform][TRACE] Building" | |
cmake --build ${{ github.workspace }}/out/build/linux-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Testing | |
run: | | |
echo "[cmake-multi-platform][TRACE] Testing" | |
ctest --test-dir ${{ github.workspace }}/out/build/linux-${{matrix.compiler}}-${{matrix.build_type}} | |
- name: Installing | |
run: echo "[cmake-multi-platform][TRACE] Installing" | |
- name: Packaging | |
run: echo "[cmake-multi-platform][TRACE] Packaging" | |
GitHub-Hosted-Matrix-Job: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: | |
- windows-latest | |
- ubuntu-latest | |
compiler: | |
- llvm-15 | |
- gcc-11 | |
generator: | |
- "Ninja" | |
build_type: | |
- Release | |
- Debug | |
include: | |
- os: "windows-latest" | |
compiler: "msvc" | |
build_type: | |
- Release | |
- Debug | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/vcpkg | |
./build/vcpkg_installed | |
${{ env.HOME }}/.cache/vcpkg/archives | |
${{ env.XDG_CACHE_HOME }}/vcpkg/archives | |
${{ env.LOCALAPPDATA }}\vcpkg\archives | |
${{ env.APPDATA }}\vcpkg\archives | |
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}-${{ hashFiles('./vcpkg.json')}} | |
restore-keys: | | |
${{ runner.os }}-${{ env.BUILD_TYPE }}- | |
- name: Setup LCOV | |
uses: hrishikesh-kadam/setup-lcov@v1 | |
- name: Setup Cpp | |
uses: aminya/setup-cpp@v1 | |
with: | |
# compiler and analyzers (llvm, gcc, msvc, vcvarsall, cppcheck, clangtidy, clangformat) | |
compiler: ${{ matrix.compiler }} | |
vcvarsall: ${{ contains(matrix.os, 'windows') }} | |
cppcheck: true | |
clangtidy: 15 | |
clangformat: 15 | |
# build system (cmake, ninja, meson, make, task, bazel) | |
cmake: true | |
ninja: true | |
# package manager (vcpkg, conan, nala) | |
vcpkg: true | |
# cache (ccache, sccache) | |
ccache: true | |
# documentation (doxygen, graphviz) | |
# coverage (gcovr, opencppcoverage, kcov) | |
lcov: true | |
# other (python, powershell, sevenzip) | |
- name: Configure CMake | |
run: | | |
cmake -S . -B ./build -DCMAKE_TOOLCHAIN_FILE:STRING=./tools/BuildTools/vcpkg/scripts/buildsystems/vcpkg.cmake | |
- name: Build | |
run: | | |
cmake --build ./build --config ${{matrix.build_type}} | |
- name: Test | |
run: | | |
ctest --test-dir ./build --config ${{matrix.build_type}} |