Use GitHub actions cache as vcpkg binary cache #36
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: Build Pipeline | |
on: | |
push: | |
branches: | |
- development | |
paths-ignore: | |
- ".clang-format" | |
- ".clang-tidy" | |
- ".editorconfig" | |
- ".gitignore" | |
- "README.md" | |
pull_request: | |
branches: | |
- development | |
paths-ignore: | |
- ".clang-format" | |
- ".clang-tidy" | |
- ".editorconfig" | |
- ".gitignore" | |
- "README.md" | |
jobs: | |
build: | |
env: | |
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite' | |
VCPKG_DISABLE_METRICS: ON | |
strategy: | |
matrix: | |
os: [ macos-latest, ubuntu-latest, windows-latest ] | |
include: | |
- install_prereqs_cmd: "brew update && brew install doxygen ninja" | |
mono: "mono" | |
os: "macos-latest" | |
triplet: "x64-osx" | |
- install_prereqs_cmd: "sudo apt-get update && sudo apt-get install doxygen ninja-build" | |
mono: "mono" | |
os: "ubuntu-latest" | |
triplet: "x64-linux" | |
- install_prereqs_cmd: "choco install doxygen.install ninja" | |
mono: "" | |
os: "windows-latest" | |
triplet: "x64-windows" | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Install prerequisites | |
run: ${{ matrix.install_prereqs_cmd }} | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure GitHub Actions cache for vcpkg | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Setup MSVC environment | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Restore vcpkg | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.VCPKG_INSTALLATION_ROOT }} | |
!${{ env.VCPKG_INSTALLATION_ROOT }}/buildtrees | |
!${{ env.VCPKG_INSTALLATION_ROOT }}/packages | |
!${{ env.VCPKG_INSTALLATION_ROOT }}/downloads | |
!${{ env.VCPKG_INSTALLATION_ROOT }}/installed | |
key: | | |
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}} | |
- name: Configure | |
env: | |
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} | |
run: cmake --preset "ninja-multi-config" -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake | |
- name: Build | |
run: cmake --build --preset "ninja-multi-config-release" | |
- name: Test | |
run: ctest --preset "ninja-multi-config-release" |