about summary refs log tree commit diff stats
path: root/.github/workflows
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 23:10:11 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-05-02 23:10:11 -0400
commite55c6a4b46708233a6016a253156a8967442f3a8 (patch)
treeb370cbbe1e40feaac8f824283bfcfe3d44e9506d /.github/workflows
parent52be8468d29788e1952db0f89263a111fa15394a (diff)
downloadlingo-ap-tracker-e55c6a4b46708233a6016a253156a8967442f3a8.tar.gz
lingo-ap-tracker-e55c6a4b46708233a6016a253156a8967442f3a8.tar.bz2
lingo-ap-tracker-e55c6a4b46708233a6016a253156a8967442f3a8.zip
Does this work
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/build-binaries.yml93
1 files changed, 93 insertions, 0 deletions
diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml new file mode 100644 index 0000000..0ecff40 --- /dev/null +++ b/.github/workflows/build-binaries.yml
@@ -0,0 +1,93 @@
1# Copyright (c) 2021-2022-2023 Luca Cappa
2# Released under the term specified in file LICENSE.txt
3# SPDX short identifier: MIT
4
5# A "pure" GitHub workflow using CMake, Ninja and vcpkg to build a C/C++ codebase.
6# It leverages both CMakePresets.json and vcpkg.json.
7# It is called "pure workflow" because it is an example which minimizes the usage of
8# custom GitHub Actions, but leverages directly the tools that could be easily run on
9# your development machines (i.e. CMake, vcpkg, Ninja) to ensure a perfectly identical
10# and reproducible local build (on your development machine) and a remote build on
11# build agents.
12name: build-binaries
13on:
14 workflow_dispatch:
15
16jobs:
17 job:
18 name: ${{ matrix.os }}-${{ github.workflow }}
19 runs-on: ${{ matrix.os }}
20 strategy:
21 fail-fast: false
22 matrix:
23 os: [ubuntu-latest, macos-latest, windows-latest]
24 include:
25 - os: windows-latest
26 triplet: x64-windows
27 - os: ubuntu-latest
28 triplet: x64-linux
29 - os: macos-latest
30 triplet: x64-osx
31 env:
32 # Indicates the location of the vcpkg as a Git submodule of the project repository.
33 VCPKG_ROOT: ${{ github.workspace }}/vendor/vcpkg
34 # Tells vcpkg where binary packages are stored.
35 VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vendor/vcpkg/bincache
36 # Let's use GitHub Action cache as storage for the vcpkg Binary Caching feature.
37 VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
38
39 steps:
40 # Set env vars needed for vcpkg to leverage the GitHub Action cache as a storage
41 # for Binary Caching.
42 - uses: actions/github-script@v6
43 with:
44 script: |
45 core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
46 core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
47
48 - uses: actions/checkout@v3
49 with:
50 submodules: true
51 - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'"
52 run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
53 shell: bash
54
55 # Setup the build machine with the most recent versions of CMake and Ninja. Both are cached if not already: on subsequent runs both will be
56quickly restored from GitHub cache service.
57 - uses: lukka/get-cmake@latest
58
59 # Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
60 # when it is being run afterwards by CMake.
61 - name: Restore vcpkg
62 uses: actions/cache@v3
63 with:
64 # The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
65 # built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
66 # The other paths starting with '!' are exclusions: they contain termporary files generated during the build of the installed packages.
67 path: |
68 ${{ env.VCPKG_ROOT }}
69 !${{ env.VCPKG_ROOT }}/buildtrees
70 !${{ env.VCPKG_ROOT }}/packages
71 !${{ env.VCPKG_ROOT }}/downloads
72 !${{ env.VCPKG_ROOT }}/installed
73 # The key is composed in a way that it gets properly invalidated whenever a different version of vcpkg is being used.
74 key: |
75 ${{ hashFiles( '.git/modules/vcpkg/HEAD' )}}
76
77 # On Windows runners, let's ensure to have the Developer Command Prompt environment setup correctly.
78 # As used here the Developer Command Prompt created is targeting x64 and using the default the Windows SDK.
79 - uses: ilammy/msvc-dev-cmd@v1
80
81 # Run CMake to generate Ninja project files, using the vcpkg's toolchain file to resolve and install
82 # the dependencies as specified in vcpkg.json. Note that the vcpkg's toolchain is specified
83 # in the CMakePresets.json file.
84 # This step also runs vcpkg with Binary Caching leveraging GitHub Action cache to
85 # store the built packages artifacts.
86 - name: Restore from cache the dependencies and generate project files
87 run: |
88 cmake --preset lingo-ap-tracker-preset
89
90 # Build (Release configuration only) the whole project with Ninja (which is spawn by CMake).
91 - name: Build (Release configuration)
92 run: |
93 cmake --build --preset lingo-ap-tracker-preset --config Release