-
Notifications
You must be signed in to change notification settings - Fork 361
153 lines (150 loc) · 5.47 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
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: [ Core, Compute, Shard1, 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: Shard1
- exclude-from-full-trick: ${{ ! inputs.full-matrix }}
shard: Other
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # 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: google-github-actions/setup-gcloud@v2
- name: Dynamic Configuration
id: dynamic
shell: bash
run: |
echo "vcpkg-version=$(cat ci/etc/vcpkg-version.txt)" >> "${GITHUB_OUTPUT}"
core_features=(
bigtable
pubsub
pubsublite
spanner
storage
)
# 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/|spanner/|storage/)" |
# cut -f -3 -d/| sort | uniq -c | sort -n |
# awk '{ s += $1; print s, $0}'
#
shard1_features=(
servicecontrol
support
video
datacatalog
iam
kms
beyondcorp
contentwarehouse
dataproc
talent
retail
bigquery
appengine
monitoring
sql
dialogflow_cx
aiplatform
dialogflow_es
)
if [[ "${{ matrix.shard }}" == "Core" ]]; then
features="$(printf ",%s" "${core_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
elif [[ "${{matrix.shard}}" == "Compute" ]]; then
echo "features=compute" >> "${GITHUB_OUTPUT}"
elif [[ "${{ matrix.shard }}" == "Shard1" ]]; then
features="$(printf ",%s" "${shard1_features[@]}")"
echo "features=${features:1}" >> "${GITHUB_OUTPUT}"
else
skipped_features=("${core_features[@]}")
skipped_features+=(compute)
skipped_features+=("${shard1_features[@]}")
skipped="$(printf ",-%s" "${skipped_features[@]}")"
echo "features=__ga_libraries__,__experimental_libraries__,${skipped:2}" >> "${GITHUB_OUTPUT}"
fi
- name: Install bash >= 5.x and Ninja
run: brew install bash ninja
- 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.5.4/sccache-v0.5.4-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 }}
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"