1+ # Copyright (c) 2019-2020-2021-2022-2023 Luca Cappa
2+ # Released under the term specified in file LICENSE.txt
3+ # SPDX short identifier: MIT
4+ #
5+ # The peculiarity of this workflow is that assumes vcpkg stored as a submodule of
6+ # this repository.
7+ # The workflow does the following:
8+ # - Sets up vcpkg if needed, then run CMake with CMakePreset.json using a configuration
9+ # that leverages the vcpkg's toolchain file. This will automatically run vcpkg to install
10+ # dependencies described by the vcpkg.json manifest file.
11+ # vcpkg's Binary Caching backed by GH Action cache is being used. It will be a no-op if
12+ # dependencies are restored from GH Action cache.
13+ # - Finally builds the sources with Ninja.
14+ name : hosted-ninja-vcpkg_submod-cacheoff
15+ on : [push, workflow_dispatch]
16+
17+ jobs :
18+ job :
19+ name : ${{ matrix.os }}-${{ github.workflow }}
20+ runs-on : ${{ matrix.os }}
21+ strategy :
22+ fail-fast : false
23+ matrix :
24+ os : [ubuntu-latest, macos-latest, windows-latest]
25+
26+ steps :
27+ - uses : actions/checkout@v3
28+ with :
29+ submodules : true
30+ # This is useful to avoid https://github.com/microsoft/vcpkg/issues/25349
31+ # which is caused by missing Git history on the vcpkg submodule which ports
32+ # try to access.
33+ # Do not use if not needed, since it slows down the checkout of sources.
34+ fetch-depth : 0
35+
36+ - uses : lukka/get-cmake@latest
37+ - name : List $RUNNER_WORKSPACE before vcpkg is setup
38+ run : find $RUNNER_WORKSPACE
39+ shell : bash
40+
41+ - name : Setup vcpkg
42+ uses : lukka/run-vcpkg@v11
43+ id : runvcpkg
44+ with :
45+ # This one is not needed, as it is the default value anyway.
46+ # vcpkgDirectory: '${{ github.workspace }}/vcpkg'
47+ vcpkgJsonGlob : ' **/cmakepresets/vcpkg.json'
48+
49+ - name : List $RUNNER_WORKSPACE before build
50+ run : find $RUNNER_WORKSPACE
51+ shell : bash
52+ - name : Prints output of run-vcpkg's action.
53+ run : echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
54+ - name : Run CMake+vcpkg+Ninja
55+ uses : lukka/run-cmake@v10
56+ id : runcmake
57+ with :
58+ cmakeListsTxtPath : ' ${{ github.workspace }}/cmakepresets/CMakeLists.txt'
59+ configurePreset : ' ninja-multi-vcpkg'
60+ buildPreset : ' ninja-multi-vcpkg'
61+ - name : List $RUNNER_WORKSPACE after build
62+ run : find $RUNNER_WORKSPACE
63+ shell : bash
64+ - name : Upload build directory
65+ uses : actions/upload-artifact@v3
66+ with :
67+ name : build-${{ matrix.os }}-${{ github.workflow }}
68+ path : $RUNNER_WORKSPACE/build
0 commit comments