-
Notifications
You must be signed in to change notification settings - Fork 24
200 lines (190 loc) · 7.14 KB
/
build.yaml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: C++ Unit CI
on:
push:
branches: [ main ]
pull_request:
env:
vcpkg_SHA: "2023.06.20"
jobs:
build-ubuntu-focal:
name: ubuntu-22.04
runs-on: ubuntu-22.04
steps:
- name: install ninja
run: sudo apt install ninja-build
- uses: actions/checkout@v4
- name: clone-vcpkg
working-directory: "${{runner.temp}}"
run: >
mkdir -p vcpkg &&
curl -sSL "https://github.com/microsoft/vcpkg/archive/${{env.vcpkg_SHA}}.tar.gz" |
tar -C vcpkg --strip-components=1 -zxf -
- name: cache-vcpkg
id: cache-vcpkg
uses: actions/cache@v4
with:
# Preserve the vcpkg binary *and* the vcpkg binary cache in the build cache
path: |
~/.cache/vcpkg
~/.cache/bin
key: |
vcpkg-${{ env.vcpkg_SHA }}-build-ubuntu-focal-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ env.vcpkg_SHA }}-build-ubuntu-focal-
- name: boostrap-vcpkg
run: ci/restore-vcpkg-from-cache.sh "${{runner.temp}}/vcpkg"
- name: configure
run: >
cmake -S . -B "${{runner.temp}}/build" -GNinja
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v4
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-build-ubuntu-focal-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build "${{runner.temp}}/build"
- name: test
working-directory: "${{runner.temp}}/build"
run: ctest --output-on-failure --timeout=60s
# Verify the howto guides compile correctly, they need a special setup to use the
# current version of `functions-framework-cpp` through vcpkg.
build-ubuntu-focal-howto:
name: ubuntu-22.04
runs-on: ubuntu-22.04
steps:
- name: install ninja
run: sudo apt install ninja-build
- uses: actions/checkout@v4
- name: cache-vcpkg
id: cache-vcpkg
uses: actions/cache@v4
with:
path: |
~/.cache/vcpkg
key: |
vcpkg-${{ env.vcpkg_SHA }}-${{ runner.os }}-${{ github.job }}-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ env.vcpkg_SHA }}-${{ runner.os }}-${{ github.job }}-
- name: create-overlay
# We want to test with the *current* version of
# `functions-framework-cpp`, not with the version published by vcpkg.
# One can do that by creating an vcpkg overlay.
run: >
mkdir -p "${{runner.temp}}/quickstart/vcpkg-overlays" &&
cp build_scripts/vcpkg-overlays/* "${{runner.temp}}/quickstart/vcpkg-overlays" &&
sed -i -e "s;/usr/local/share/gcf;${{github.workspace}};" \
${{runner.temp}}/quickstart/vcpkg-overlays/portfile.cmake
- name: configure-local-development
env:
VCPKG_OVERLAY_PORTS: "${{runner.temp}}/quickstart/vcpkg-overlays"
run: >
cmake -S examples/site/howto_local_development -B "${{runner.temp}}/howto_local_development/build" -GNinja
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake
- uses: actions/cache/save@v4
if: always()
with:
path: |
~/.cache/vcpkg
key: vcpkg-${{ env.vcpkg_SHA }}-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
- name: build-local-development
env:
VCPKG_OVERLAY_PORTS: "${{runner.temp}}/quickstart/vcpkg-overlays"
run: >
cmake --build "${{runner.temp}}/howto_local_development/build"
build-msvc-2019:
if: ${{ false }} # TODO(#366) - disable for now
name: msvc-2019
runs-on: windows-2022
steps:
- name: install-ninja
run: choco install -y --no-progress ninja
- name: clone-vcpkg
working-directory: "${{runner.temp}}"
run: |
$ErrorActionPreference = "Stop"
(New-Object System.Net.WebClient).Downloadfile(
'https://github.com/microsoft/vcpkg/archive/${{env.vcpkg_SHA}}.zip',
'${{env.vcpkg_SHA}}.zip')
7z x '${{env.vcpkg_SHA}}.zip' -aoa -bsp0
if ($LastExitCode) { Write-Host -ForegroundColor Red "error extracting vcpkg zipball: ${LastExitCode}"; Exit 1; }
Rename-Item 'vcpkg-${{env.vcpkg_SHA}}' 'vcpkg'
& vcpkg/bootstrap-vcpkg.bat
- name: cache-vcpkg
id: cache-vcpkg
uses: actions/cache@v4
with:
# Preserve the vcpkg binary cache
path: |
~\AppData\Local\vcpkg\archives
key: |
vcpkg-${{ env.vcpkg_SHA }}-build-msvc-2019-2-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ env.vcpkg_SHA }}-build-msvc-2019-2-
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: configure
run: |
cmake -S . -B '${{runner.temp}}/build' -GNinja `
'-DBUILD_TESTING=ON' `
'-DFUNCTIONS_FRAMEWORK_CPP_TEST_EXAMPLES=OFF' `
'-DCMAKE_TOOLCHAIN_FILE=${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake'
- uses: actions/cache/save@v4
if: always()
with:
path: |
~\AppData\Local\vcpkg\archives
key: vcpkg-${{ env.vcpkg_SHA }}-build-msvc-2019-2-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build "${{runner.temp}}/build"
- name: test
working-directory: "${{runner.temp}}/build"
run: ctest --output-on-failure --timeout=60s
build-macos:
if: ${{ false }} # TODO(#367) - disable for now
name: macos-10
runs-on: macos-10.15
steps:
- name: install ninja
run: brew install ninja
- uses: actions/checkout@v4
- name: clone-vcpkg
working-directory: "${{runner.temp}}"
run: >
mkdir -p vcpkg &&
curl -sSL "https://github.com/microsoft/vcpkg/archive/${{env.vcpkg_SHA}}.tar.gz" |
tar -C vcpkg --strip-components=1 -zxf -
- name: cache-vcpkg
id: cache-vcpkg
uses: actions/cache@v4
with:
# Preserve the vcpkg binary *and* the vcpkg binary cache in the build cache
path: |
~/.cache/vcpkg
~/.cache/bin
key: |
vcpkg-${{ env.vcpkg_SHA }}-build-macos-10-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ env.vcpkg_SHA }}-build-macos-10-
- name: boostrap-vcpkg
run: ci/restore-vcpkg-from-cache.sh "${{runner.temp}}/vcpkg"
- name: configure
run: >
cmake -S . -B "${{runner.temp}}/build" -GNinja
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DCMAKE_TOOLCHAIN_FILE="${{runner.temp}}/vcpkg/scripts/buildsystems/vcpkg.cmake"
- uses: actions/cache/save@v4
if: always()
with:
path: |
~/.cache/vcpkg
~/.cache/bin
key: vcpkg-${{ env.vcpkg_SHA }}-build-macos-10-${{ hashFiles('vcpkg.json') }}
- name: build
run: cmake --build "${{runner.temp}}/build"
- name: test
working-directory: "${{runner.temp}}/build"
run: ctest --output-on-failure --timeout=60s