Merge pull request #853 from stephengtuggy/fix/844-on-0.8.x #753
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: Windows-CI | |
# Controls when the action will run. | |
on: | |
push: | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-2019 | |
cmake-generator: VS2019Win64 | |
enable-pie: 1 | |
build-type: Release | |
- os: windows-2022 | |
cmake-generator: VS2022Win64 | |
enable-pie: 1 | |
build-type: Debug | |
env: | |
# Indicates the location of vcpkg | |
VCPKG_ROOT: '${{ github.workspace }}/v' | |
# Tells vcpkg where binary packages are stored. | |
VCPKG_DEFAULT_BINARY_CACHE: '${{ github.workspace }}/vbincache' | |
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. | |
VCPKG_BINARY_SOURCES: 'x-gha,readwrite' | |
VCPKG_DEFAULT_TRIPLET: x64-windows | |
VCPKG_DEFAULT_HOST_TRIPLET: x64-windows | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage | |
# for Binary Caching. | |
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: checkout | |
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f #v4.1.3 | |
- name: Setup Python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d #v5.1.0 | |
with: | |
python-version: 3.11 | |
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" | |
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE | |
shell: bash | |
- name: install-cmake | |
uses: lukka/get-cmake@4931ab1fc1604964c055eb330edb3f6b26ba0cfa #v3.29.2 | |
with: | |
cmakeVersion: 3.29.2 | |
ninjaVersion: 1.11.1 | |
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching | |
# when it is being run afterward by CMake. | |
- name: restore-vcpkg | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 #v4.0.2 | |
with: | |
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the | |
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var. | |
# The other paths starting with '!' are exclusions: they contain temporary files generated during the build of the installed packages. | |
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: | | |
${{ matrix.os }}-${{ hashFiles( './engine/vcpkg.json' )}} | |
- name: install-vcpkg | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
git clone https://github.com/Microsoft/vcpkg.git ${{ env.VCPKG_ROOT }} | |
${{ env.VCPKG_ROOT }}\bootstrap-vcpkg.bat -disableMetrics | |
- name: run-build-script | |
working-directory: ${{ github.workspace }} | |
run: .\script\build.ps1 -Generator ${{ matrix.cmake-generator }} -EnablePIE ${{ matrix.enable-pie }} -BuildType ${{ matrix.build-type }} |