Skip to content

retake work on fabko #28

retake work on fabko

retake work on fabko #28

Workflow file for this run

# https://github.com/marketplace/actions/run-vcpkg#use-vcpkg-as-a-submodule-of-your-repository
# https://github.com/lukka/CppCMakeVcpkgTemplate/blob/v11/.github/workflows/hosted-pure-workflow.yml
name: "Build Windows"
on:
pull_request:
push:
jobs:
build:
name: ${{ matrix.os }}-${{ github.workflow }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ windows-latest ]
include:
- os: windows-latest
triplet: x64-windows
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
steps:
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
# for Binary Caching.
- 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 || '');
- uses: actions/checkout@v3
with:
submodules: true
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
shell: bash
- uses: lukka/get-cmake@latest
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg binary caching
# when it is being run afterward by CMake.
- name: Restore vcpkg
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}
!${{ env.VCPKG_ROOT }}/buildtrees
!${{ env.VCPKG_ROOT }}/packages
!${{ env.VCPKG_ROOT }}/downloads
!${{ env.VCPKG_ROOT }}/installed
# The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
key: |
${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
# On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly.
# As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
- uses: ilammy/msvc-dev-cmd@v1
# Run CMake to generate Ninja project files, using the vcpkg toolchain file to resolve and install
# the dependencies as specified in vcpkg.json. Note that the vcpkg toolchain is specified
# in the CMakePresets.json file.
# This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to
# store the built packages artifacts.
- name: Restore from cache the dependencies and generate project files
run: |
cmake --preset x64-Debug-Windows
- name: Build
run: |
cmake --build --preset x64-Debug-Windows
- name: Test
run: |
ctest --preset x64-Debug-Windows