Update README.md #10
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: MSBuild | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_dispatch: | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: . | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: ReleaseWithSpoofer | |
# Indicates the location of the vcpkg as a Git submodule of the project repository. | |
# Not using "VCPKG_ROOT" because a variable with the same name is defined in the VS's | |
# Developer Command Prompt environment in VS 2022 17.6, which would override this one | |
# if it had the same name. | |
_VCPKG_: ${{ github.workspace }}/vcpkg | |
# Tells vcpkg where binary packages are stored. | |
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/bincache | |
# Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature. | |
VCPKG_BINARY_SOURCES: 'clear' | |
VCPKG_DEFAULT_TRIPLET: 'x64-windows-static' | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: windows-2022 | |
steps: | |
- name: Add MSBuild to PATH | |
uses: microsoft/[email protected] | |
# Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage | |
# for Binary Caching. | |
- uses: actions/github-script@v7 | |
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@v4 | |
with: | |
submodules: true | |
- name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" | |
shell: cmd | |
run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE | |
- name: Run vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
runVcpkgInstall : true | |
vcpkgGitCommitId: '3426db05b996481ca31e95fff3734cf23e0f51bc' | |
vcpkgDirectory: '${{ github.workspace }}/vcpkg' | |
vcpkgJsonGlob: 'D:/a/SKLib/SKLib/vcpkg.json' | |
runVcpkgFormatString: '[`install`, `--recurse`, `--clean-after-build`, `--x-install-root`, `$[env.VCPKG_INSTALLED_DIR]`, `--feature-flags`, `manifests,versions`]' | |
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching | |
# when it is being run afterwards by CMake. | |
- name: Restore vcpkg | |
uses: actions/cache@v4 | |
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 termporary files generated during the build of the installed packages. | |
path: | | |
${{ env._VCPKG_ }} | |
!${{ env._VCPKG_ }}/buildtrees | |
!${{ env._VCPKG_ }}/packages | |
!${{ env._VCPKG_ }}/downloads | |
!${{ env._VCPKG_ }}/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' )}} | |
- name: Compile Visual Studio project with MSBuild | |
shell: cmd | |
run: ${{ '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" && vcpkg integrate install && msbuild /p:Configuration=ReleaseWithSpoofer' }} | |
working-directory: ${{env.SOLUTION_FILE_PATH}} | |
- uses: actions/upload-artifact@v4 | |
with: | |
# Name of the artifact to upload. | |
# Optional. Default is 'artifact' | |
name: 'SKLib' | |
# A file, directory or wildcard pattern that describes what to upload | |
# Required. | |
path: '${{env.SOLUTION_FILE_PATH}}/x64/${{env.BUILD_CONFIGURATION}}' | |
# The desired behavior if no files are found using the provided path. | |
# Available Options: | |
# warn: Output a warning but do not fail the action | |
# error: Fail the action with an error message | |
# ignore: Do not output any warnings or errors, the action does not fail | |
# Optional. Default is 'warn' | |
if-no-files-found: 'error' |