-
Notifications
You must be signed in to change notification settings - Fork 386
291 lines (288 loc) · 9.61 KB
/
macos-cmake.yml
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
name: macOS-CMake-Builds
on:
workflow_call:
inputs:
checkout-ref:
required: true
description: "The ref we want to compile"
type: string
full-matrix:
required: true
description: "Build the full matrix"
type: boolean
sccache-mode:
required: true
description: "READ_WRITE or DISABLED"
type: string
vcpkg-cache-mode:
required: true
description: "read or readwrite"
type: string
execute-integration-tests:
required: true
description: "Integration tests require credentials."
type: boolean
permissions:
contents: read
jobs:
cmake:
name: cmake + ${{ matrix.os }} + ${{ matrix.shard }}
runs-on: ${{ matrix.os }}
permissions:
contents: 'read'
id-token: 'write'
strategy:
# Continue other builds even if one fails
fail-fast: false
matrix:
exclude-from-full-trick: [ true ]
os: [ macos-14 ]
shard: [ Core1, Core2, Compute, AIPlatform, Shard1, Shard2, Shard3, Shard4, Shard5, Other ]
exclude:
# Only full builds include shards with generated code.
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Compute
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: AIPlatform
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Shard1
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Shard2
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Shard3
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Shard4
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Shard5
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Other
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ inputs.checkout-ref }}
- uses: google-github-actions/auth@v2
if: ${{ inputs.sccache-mode == 'READ_WRITE' && inputs.vcpkg-cache-mode == 'readwrite' }}
with:
create_credentials_file: true
credentials_json: ${{ secrets.BUILD_CACHE_KEY }}
- uses: actions/setup-python@v5
id: py311
with:
python-version: '3.11'
- uses: google-github-actions/setup-gcloud@v2
env:
CLOUDSDK_PYTHON: ${{ steps.py311.outputs.python-path }}
- name: Dynamic Configuration
id: dynamic
shell: bash
run: |
echo "vcpkg-version=$(cat ci/etc/vcpkg-version.txt)" >> "${GITHUB_OUTPUT}"
core1_features=(
bigtable
spanner
)
core2_features=(
pubsub
pubsublite
storage
storage_grpc
)
# These are the libraries with the most "clients". To build the list
# run something like this and find the midpoint:
#
# git grep -l 'class.*Client' 'google/cloud/**_client.h' |
# egrep -v "(bigtable/|internal/|pubsub/|pubsublite/|spanner/|storage/|testing_util/)" |
# cut -f -3 -d/| sort | uniq -c | sort -n |
# awk '{ s += $1; print s, $0}'
#
shard1_features=(
dataproc
monitoring
retail
discoveryengine
)
shard2_features=(
servicecontrol
speech
support
video
datacatalog
iam
run
talent
contentwarehouse
dataplex
kms
bigquery
resourcemanager
appengine
)
shard3_features=(
channel
cloudbuild
cloudcontrolspartner
composer
containeranalysis
datastore
eventarc
functions
iap
language
metastore
networkconnectivity
networkservices
policytroubleshooter
profiler
redis
securitycenter
servicedirectory
tpu
trace
vision
workflows
beyondcorp
billing
binaryauthorization
gkemulticloud
logging
notebooks
osconfig
)
shard4_features=(
domains
edgecontainer
edgenetwork
essentialcontacts
filestore
ids
managedidentities
managedkafka
memcache
migrationcenter
netapp
networkmanagement
networksecurity
optimization
orgpolicy
oslogin
policysimulator
privateca
privilegedaccessmanager
publicca
rapidmigrationassessment
recaptchaenterprise
recommender
resourcesettings
scheduler
secretmanager
securesourcemanager
securitycentermanagement
servicehealth
servicemanagement
serviceusage
shell
storagecontrol
storageinsights
storagetransfer
tasks
telcoautomation
texttospeech
timeseriesinsights
translate
videointelligence
vmmigration
vmwareengine
vpcaccess
webrisk
websecurityscanner
workstations
automl
)
shard5_features=(
bigquerycontrol
dialogflow_cx
dialogflow_es
gkebackup
gkeconnect
gkehub
sql
)
if [[ "${{ matrix.shard }}" == "Core1" ]]; then
features="$(printf ",%s" "${core1_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Core2" ]]; then
features="$(printf ",%s" "${core2_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{matrix.shard}}" == "Compute" ]]; then
echo "features=compute" >> "${GITHUB_OUTPUT}"
elif [[ "${{matrix.shard}}" == "AIPlatform" ]]; then
echo "features=aiplatform" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Shard1" ]]; then
features="$(printf ",%s" "${shard1_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Shard2" ]]; then
features="$(printf ",%s" "${shard2_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Shard3" ]]; then
features="$(printf ",%s" "${shard3_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Shard4" ]]; then
features="$(printf ",%s" "${shard4_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Shard5" ]]; then
features="$(printf ",%s" "${shard5_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
else
skipped_features=("${core1_features[@]}")
skipped_features+=("${core2_features[@]}")
skipped_features+=(compute)
skipped_features+=(aiplatform)
skipped_features+=("${shard1_features[@]}")
skipped_features+=("${shard2_features[@]}")
skipped_features+=("${shard3_features[@]}")
skipped_features+=("${shard4_features[@]}")
skipped_features+=("${shard5_features[@]}")
skipped="$(printf ",-%s" "${skipped_features[@]}")"
echo "features=__ga_libraries__,__experimental_libraries__,${skipped:1}" >> "${GITHUB_OUTPUT}"
fi
- name: Install bash >= 5.x and Ninja
run: brew install bash ninja
- name: Pre Tests Disk Space
run: df -m
- name: Install CMake==3.27.2
working-directory: "${{runner.temp}}"
run: |
# Remove the older CMake version
brew unlink cmake
# Download the Homebrew formula for CMake==3.27.2
curl -fsSL -o cmake.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/fd21fcf239bcd0231c9fed5719403ec128151af4/Formula/cmake.rb
brew install cmake.rb
- name: Download and Install sccache
if: ${{ inputs.sccache-mode != 'DISABLED' }}
working-directory: "${{runner.temp}}"
run: |
curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-apple-darwin.tar.gz | \
tar -zxf - --strip-components=1 && \
chmod +x sccache && \
mv sccache /Users/runner/.cargo/bin/sccache
- name: Download and Install vcpkg
working-directory: "${{runner.temp}}"
run: |
mkdir -p vcpkg
curl -fsSL "https://github.com/microsoft/vcpkg/archive/${{ steps.dynamic.outputs.vcpkg-version }}.tar.gz" |
tar -C vcpkg --strip-components=1 -zxf -
vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Build google-cloud-cpp
run: |
export VCPKG_ROOT="${{ runner.temp }}/vcpkg"
export EXECUTE_INTEGRATION_TESTS=${{ inputs.execute-integration-tests }}
/opt/homebrew/bin/bash ci/gha/builds/macos-cmake.sh ${{ steps.dynamic.outputs.features }}
- name: Post Tests Disk Space
run: df -m
env:
SCCACHE_GCS_BUCKET: cloud-cpp-community-gha-cache
SCCACHE_GCS_KEY_PREFIX: sccache/${{ matrix.os }}
SCCACHE_GCS_RW_MODE: ${{ inputs.sccache-mode }}
SCCACHE_IGNORE_SERVER_IO_ERROR: 1
VCPKG_BINARY_SOURCES: x-gcs,gs://cloud-cpp-community-gha-cache/vcpkg-cache/${{ matrix.os }},${{ inputs.vcpkg-cache-mode }}
GHA_TEST_BUCKET: "gcs-grpc-team-cloud-cpp-testing-bucket"