uses run-vcpkg@v11 #193
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
# Copyright (c) 2019-2020-2021-2022-2023 Luca Cappa | |
# Released under the term specified in file LICENSE.txt | |
# SPDX short identifier: MIT | |
# | |
# The peculiarity of this workflow is that runs `vcpkg install` at `run-vcpkg`, | |
# rather than with `run-cmake. | |
# Also, it does not assume that vcpkg is a submodule of this repository. | |
# | |
# The workflow does the following: | |
# - Download and setup vcpkg (which is stored NOT in a Git submodule), then run | |
# `vcpkg install` to install the packages described in vcpkg.json manifest file. | |
# - Note: at this point, all the vcpkg dependencies specified in vcpkg.json are installed, | |
# and it is possible to run anything that is needed to build the C++ application as. | |
# long the paths to headers and libraries are correctly set. | |
# | |
# - _Warning:_ in this sample, CMake is going to be used to build the application, | |
# but anything else could be used. This means that vcpkg will be run again and | |
# it will quickly realize that all dependencies are already installed. | |
# In short: *it is not needed to run vcpkg* in the step before if you build with CMake, | |
# since CMake will run it for you already! | |
# Look to (hosted-ninja-vcpkg_submod.yml)[./hosted-ninja-vcpkg_submod.yml] sample. | |
# | |
# - Finally, it runs CMake with CMakePreset.json and vcpkg's toolchain file to build | |
# the C++ sources with Ninja. | |
name: hosted-ninja-vcpkg-install-cacheoff | |
on: [push, workflow_dispatch] | |
jobs: | |
job: | |
name: ${{ matrix.os }}-${{ github.workflow }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: windows-latest | |
vcpkgCommitId: 'a42af01b72c28a8e1d7b48107b33e4f286a55ef6' | |
- os: ubuntu-latest | |
vcpkgCommitId: 'a42af01b72c28a8e1d7b48107b33e4f286a55ef6' | |
- os: macos-latest | |
vcpkgCommitId: 'a42af01b72c28a8e1d7b48107b33e4f286a55ef6' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: lukka/get-cmake@latest | |
- name: List $RUNNER_WORKSPACE before build | |
run: find $RUNNER_WORKSPACE | |
shell: bash | |
- name: Setup vcpkg | |
uses: lukka/run-vcpkg@v11 | |
id: runvcpkg | |
with: | |
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' | |
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId }}' | |
# Run vcpkg with the command specified by the `runVcpkgFormatString` input. | |
runVcpkgInstall: true | |
vcpkgJsonGlob: '**/cmakepresets/vcpkg.json' | |
- name: Prints output of run-vcpkg's action. | |
run: echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' " | |
- name: Run CMake with Ninja | |
uses: lukka/run-cmake@v10 | |
with: | |
cmakeListsTxtPath: '${{ github.workspace }}/cmakepresets/CMakeLists.txt' | |
configurePreset: 'ninja-multi-vcpkg' | |
buildPreset: 'ninja-multi-vcpkg' | |
- name: List $RUNNER_WORKSPACE after build | |
run: find $RUNNER_WORKSPACE | |
shell: bash | |