Skip to content

ci: reduce number of GHA builds #1

ci: reduce number of GHA builds

ci: reduce number of GHA builds #1

Workflow file for this run

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'
strategy:
# Continue other builds even if one fails
fail-fast: false
matrix:
exclude-from-full-trick: [ true ]
os: [ macos-14 ]
shard: [ Core2 ]
# 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 }}

Check failure on line 77 in .github/workflows/macos-cmake.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/macos-cmake.yml

Invalid workflow file

You have an error in your yaml syntax on line 77
- 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
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"