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 : Install libltdl-dev
42+ if : matrix.os == 'ubuntu-latest'
43+ run : sudo apt-get install libltdl-dev
44+ shell : bash
45+
46+ - name : Setup vcpkg
47+ uses : lukka/run-vcpkg@v11
48+ id : runvcpkg
49+ with :
50+ vcpkgArguments : ' @vcpkg.json'
51+
52+ - name : List $RUNNER_WORKSPACE before build
53+ run : find $RUNNER_WORKSPACE
54+ shell : bash
55+ - name : Prints output of run-vcpkg's action.
56+ run : echo "root='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_ROOT_OUT }}', triplet='${{ steps.runvcpkg.outputs.RUNVCPKG_VCPKG_DEFAULT_TRIPLET_OUT }}' "
57+ - name : Run CMake+vcpkg+Ninja
58+ uses : lukka/run-cmake@v10
59+ id : runcmake
60+ with :
61+ cmakeListsTxtPath : ' CMakeLists.txt'
62+ configurePreset : ' ninja-multi-vcpkg'
63+ buildPreset : ' ninja-multi-vcpkg'
64+ - name : List $RUNNER_WORKSPACE after build
65+ run : find $RUNNER_WORKSPACE
66+ shell : bash
67+ - name : Upload build directory
68+ uses : actions/upload-artifact@v4
69+ with :
70+ name : build-${{ matrix.os }}-${{ github.workflow }}
71+ path : builds
0 commit comments