Repository navigation
93 lines (75 loc) · 3.15 KB
/
Copy pathci.yml
File metadata and controls
93 lines (75 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
build-and-test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release, Debug]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# This job covers the modular-Boost path (Boost::asio from boost_asio-config.cmake);
# the system-boost job below covers the header-only fallback.
# vcpkg is preinstalled on all GitHub-hosted runners, but the macOS image
# does not set VCPKG_INSTALLATION_ROOT - bootstrap our own copy if missing.
- name: Set up vcpkg
shell: bash
run: |
if [ -z "${VCPKG_INSTALLATION_ROOT:-}" ]; then
git clone --depth 1 https://github.com/microsoft/vcpkg.git "$RUNNER_TEMP/vcpkg"
"$RUNNER_TEMP/vcpkg/bootstrap-vcpkg.sh" -disableMetrics
echo "VCPKG_INSTALLATION_ROOT=$RUNNER_TEMP/vcpkg" >> "$GITHUB_ENV"
echo "$RUNNER_TEMP/vcpkg" >> "$GITHUB_PATH"
fi
# vcpkg stores built packages in VCPKG_DEFAULT_BINARY_CACHE; cache entries are
# content-addressed by vcpkg's ABI hash, keyed on the vcpkg checkout commit so
# the cache is rebuilt exactly when the runner image updates its vcpkg baseline.
- name: Prepare vcpkg binary cache
id: vcpkg-info
shell: bash
run: |
echo "VCPKG_DEFAULT_BINARY_CACHE=$RUNNER_TEMP/vcpkg-binary-cache" >> "$GITHUB_ENV"
mkdir -p "$RUNNER_TEMP/vcpkg-binary-cache"
git config --global --add safe.directory "$VCPKG_INSTALLATION_ROOT"
echo "commit=$(git -C "$VCPKG_INSTALLATION_ROOT" rev-parse --short HEAD || echo unknown)" >> "$GITHUB_OUTPUT"
- name: Restore vcpkg binary cache
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ steps.vcpkg-info.outputs.commit }}
restore-keys: |
vcpkg-${{ runner.os }}-${{ runner.arch }}-
- name: Install Boost.Asio (vcpkg)
shell: bash
run: vcpkg install boost-asio
- name: Configure CMake
shell: bash
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
- name: Build
run: cmake --build build --config ${{ matrix.build_type }}
- name: Run Tests
working-directory: build
run: ctest -C ${{ matrix.build_type }} --output-on-failure
# Distribution Boost without a boost_asio-config.cmake: proves the header-only
# fallback in the Boost ladder works, for the build and for the installed package
# config (exercised by the install-and-consume test).
build-and-test-system-boost:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Boost headers (apt)
run: sudo apt-get update && sudo apt-get install -y libboost-dev
- name: Configure CMake
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
- name: Build
run: cmake --build build --config Release
- name: Run Tests
working-directory: build
run: ctest -C Release --output-on-failure