Migrate remaining macOS tests to GHA

gha-migration2
Mike Kruskal 2 years ago
parent 0c89774d0f
commit 9c3a1c0d90
  1. 2
      .github/actions/internal/bazel-setup/action.yml
  2. 4
      .github/actions/internal/setup-runner/action.yml
  3. 43
      .github/workflows/test_objectivec.yml
  4. 50
      .github/workflows/test_php.yml
  5. 49
      .github/workflows/test_python.yml
  6. 30
      .github/workflows/test_ruby.yml
  7. 10
      .github/workflows/test_runner.yml
  8. 18
      objectivec/DevTools/full_mac_build.sh

@ -42,7 +42,7 @@ runs:
run: > run: >
echo "BAZEL_FLAGS=$BAZEL_FLAGS echo "BAZEL_FLAGS=$BAZEL_FLAGS
--google_credentials='${{ inputs.credentials-file }}' --google_credentials='${{ inputs.credentials-file }}'
--remote_cache=https://storage.googleapis.com/protobuf-bazel-cache/protobuf/gha/${{ inputs.bazel-cache }}" >> $GITHUB_ENV --remote_cache='https://storage.googleapis.com/protobuf-bazel-cache/protobuf/gha/${{ inputs.bazel-cache }}'" >> $GITHUB_ENV
- name: Configure Bazel cache writing - name: Configure Bazel cache writing
# External runs should never write to our caches. # External runs should never write to our caches.

@ -1,6 +1,6 @@
name: Setup CI Runner name: Setup CI Runner
# TODO(b/267357823) Consider moving this to it's own repository and include # TODO(b/267357823) Consider moving this to it's own repository so we can
# a call to actions/checkout. # include the call to actions/checkout.
description: Setup any platform-specific adjustments we need to make for CI description: Setup any platform-specific adjustments we need to make for CI
runs: runs:
using: 'composite' using: 'composite'

@ -0,0 +1,43 @@
name: Objective-c Tests
on:
workflow_call:
inputs:
safe-checkout:
required: true
description: "The SHA key for the commit we want to run over"
type: string
jobs:
macos:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
include:
- name: OS X
flags: --core-only --skip-xcode-ios --skip-xcode-tvos
- name: iOS Debug
flags: --core-only --skip-xcode-osx --skip-xcode-tvos --skip-objc-conformance --skip-xcode-release
- name: iOS Release
flags: --core-only --skip-xcode-osx --skip-xcode-tvos --skip-objc-conformance --skip-xcode-debug
name: ${{ matrix.name}}
runs-on: macos-12
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
ref: ${{ inputs.safe-checkout }}
- name: Select pinned Xcode version
uses: maxim-lobanov/setup-xcode@9a697e2b393340c3cacd97468baa318e4c883d98 # v1.5.1
with:
xcode-version: '14.1'
- name: Run tests
uses: ./.github/actions/bazel
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: objectivec_macos/${{ matrix.name }}
bash: |
objectivec/DevTools/full_mac_build.sh ${{ matrix.flags }} --bazel-flags=\"$BAZEL_FLAGS\"

@ -34,7 +34,7 @@ jobs:
version: 8.0.5-dbg version: 8.0.5-dbg
command: composer test_valgrind command: composer test_valgrind
name: Linux PHP ${{ matrix.name}} name: Linux ${{ matrix.name}}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout pending changes - name: Checkout pending changes
@ -48,3 +48,51 @@ jobs:
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-6e95c0e221e4bd52e3b4dc1398c6336985196931 image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-6e95c0e221e4bd52e3b4dc1398c6336985196931
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
command: ${{ matrix.command }} command: ${{ matrix.command }}
macos:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
version: ['7.4', '8.0']
name: MacOS PHP ${{ matrix.version }}
runs-on: macos-12
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
ref: ${{ inputs.safe-checkout }}
- name: Install dependencies
run: |
brew cleanup
brew install coreutils php@${{ matrix.version }}
brew services restart php@${{ matrix.version }}
# Configure path
PHP_FOLDER=$(find $HOMEBREW_PREFIX -type d -regex ".*php.*/7.4.[0-9_.]*" | sort -n | tail -n 1)
test ! -z "$PHP_FOLDER"
export PATH="$PHP_FOLDER/bin:$PATH"
echo "PATH=$PHP_FOLDER/bin:$PATH" >> $GITHUB_ENV
- name: Check PHP version
run: php --version | grep ${{ matrix.version }} || (echo "Invalid PHP version - $(php --version)" && exit 1)
- name: Run tests
uses: ./.github/actions/bazel
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: php_macos/${{ matrix.version }}
bash: |
pushd php
rm -rf vendor
php -v
php -m
composer update
composer test_c
popd
bazelisk $BAZEL_STARTUP_FLAGS \
test $BAZEL_FLAGS \
--action_env=PATH --test_env=PATH \
//php:conformance_test_c

@ -42,3 +42,52 @@ jobs:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }} bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.version }}
bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION bazel: test ${{ matrix.targets }} ${{ matrix.flags }} --test_env=KOKORO_PYTHON_VERSION
macos:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
type: [ Pure, C++]
version: [ "3.7" ]
include:
- type: Pure
targets: //python/... @upb//python/... //python:python_version
- type: C++
targets: //python/... //python:python_version
flags: --define=use_fast_cpp_protos=true
name: MacOS ${{ matrix.type }} ${{ matrix.version }}
runs-on: macos-12
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
ref: ${{ inputs.safe-checkout }}
- name: Fix Python version
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: ${{ matrix.version }}
cache: pip
- name: Validate version
run: python3 --version | grep ${{ matrix.version }} || (echo "Invalid Python version - $(python3 --version)" && exit 1)
- name: Create and start virtual environment
run: |
python3 -m venv venv
source venv/bin/activate
- name: Run tests
uses: ./.github/actions/bazel
env:
KOKORO_PYTHON_VERSION: ${{ matrix.version }}
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: python_macos/${{ matrix.type }}_${{ matrix.version }}
bazel: >
test ${{ matrix.targets }} ${{ matrix.flags }}
--test_env=KOKORO_PYTHON_VERSION=${{ matrix.version }}
--macos_minimum_os=10.9

@ -39,6 +39,36 @@ jobs:
bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }} bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }}
bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION bazel: test //ruby/... //ruby/tests:ruby_version --test_env=KOKORO_RUBY_VERSION
macos:
strategy:
fail-fast: false # Don't cancel all jobs if one fails.
matrix:
version: [ "2.7", "3.0", "3.1", "3.2" ]
name: MacOS Ruby ${{ matrix.version }}
runs-on: macos-12
steps:
- name: Checkout pending changes
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
submodules: recursive
ref: ${{ inputs.safe-checkout }}
- name: Fix Ruby version
uses: ruby/setup-ruby@ee26e27437bde475b19a6bf8cb73c9fa658876a2 # v1.134.0
with:
ruby-version: ${{ matrix.version }}
- name: Validate version
run: ruby --version | grep ${{ matrix.version }} || (echo "Invalid Ruby version - $(ruby --version)" && exit 1)
- name: Run tests
uses: ./.github/actions/bazel
with:
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
bazel-cache: ruby_macos/${{ matrix.version }}
bazel: test //ruby/... --test_env=KOKORO_RUBY_VERSION=${{ matrix.version }}
test_ruby_gems: test_ruby_gems:
strategy: strategy:
fail-fast: false fail-fast: false

@ -105,7 +105,7 @@ jobs:
safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }} safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
secrets: inherit secrets: inherit
ruby-install: ruby:
name: Ruby name: Ruby
needs: [check-tag] needs: [check-tag]
uses: ./.github/workflows/test_ruby.yml uses: ./.github/workflows/test_ruby.yml
@ -128,3 +128,11 @@ jobs:
with: with:
safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }} safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
secrets: inherit secrets: inherit
objectivec:
name: Objective-c
needs: [check-tag]
uses: ./.github/workflows/test_objectivec.yml
with:
safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
secrets: inherit

@ -8,8 +8,6 @@ set -eu
# Some base locations. # Some base locations.
readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")") readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
readonly ProtoRootDir="${ScriptDir}/../.." readonly ProtoRootDir="${ScriptDir}/../.."
readonly BazelFlags="--announce_rc --macos_minimum_os=10.9 \
$(${ScriptDir}/../../kokoro/common/bazel_flags.sh)"
# Invoke with BAZEL=bazelisk to use that instead. # Invoke with BAZEL=bazelisk to use that instead.
readonly BazelBin="${BAZEL:=bazel}" readonly BazelBin="${BAZEL:=bazel}"
@ -32,6 +30,8 @@ OPTIONS:
-r, --regenerate-descriptors -r, --regenerate-descriptors
Run generate_descriptor_proto.sh to regenerate all the checked in Run generate_descriptor_proto.sh to regenerate all the checked in
proto sources. proto sources.
--bazel-flags
A set of flags to pass to any Bazel instances
--core-only --core-only
Skip some of the core protobuf build/checks to shorten the build time. Skip some of the core protobuf build/checks to shorten the build time.
--skip-xcode --skip-xcode
@ -72,6 +72,8 @@ DO_XCODE_DEBUG=yes
DO_XCODE_RELEASE=yes DO_XCODE_RELEASE=yes
DO_OBJC_CONFORMANCE_TESTS=yes DO_OBJC_CONFORMANCE_TESTS=yes
XCODE_QUIET=no XCODE_QUIET=no
BAZEL_FLAGS="--announce_rc --macos_minimum_os=10.9"
while [[ $# != 0 ]]; do while [[ $# != 0 ]]; do
case "${1}" in case "${1}" in
-h | --help ) -h | --help )
@ -84,6 +86,10 @@ while [[ $# != 0 ]]; do
-r | --regenerate-descriptors ) -r | --regenerate-descriptors )
REGEN_DESCRIPTORS=yes REGEN_DESCRIPTORS=yes
;; ;;
--bazel-flags )
BAZEL_FLAGS="$BAZEL_FLAGS $1"
shift
;;
--core-only ) --core-only )
CORE_ONLY=yes CORE_ONLY=yes
;; ;;
@ -181,16 +187,16 @@ fi
if [[ "${CORE_ONLY}" == "yes" ]] ; then if [[ "${CORE_ONLY}" == "yes" ]] ; then
header "Building core Only" header "Building core Only"
"${BazelBin}" build //:protoc //:protobuf //:protobuf_lite $BazelFlags "${BazelBin}" build //:protoc //:protobuf //:protobuf_lite $BAZEL_FLAGS
else else
header "Building" header "Building"
# Can't issue these together, when fully parallel, something sometimes chokes # Can't issue these together, when fully parallel, something sometimes chokes
# at random. # at random.
"${BazelBin}" test //src/... $BazelFlags "${BazelBin}" test //src/... $BAZEL_FLAGS
fi fi
# Ensure the WKT sources checked in are current. # Ensure the WKT sources checked in are current.
BAZEL="${BazelBin}" objectivec/generate_well_known_types.sh --check-only $BazelFlags BAZEL="${BazelBin}" objectivec/generate_well_known_types.sh --check-only $BAZEL_FLAGS
header "Checking on the ObjC Runtime Code" header "Checking on the ObjC Runtime Code"
# Some of the kokoro machines don't have python3 yet, so fall back to python if need be. # Some of the kokoro machines don't have python3 yet, so fall back to python if need be.
@ -317,7 +323,7 @@ fi
if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then
header "Running ObjC Conformance Tests" header "Running ObjC Conformance Tests"
"${BazelBin}" test //objectivec:conformance_test $BazelFlags "${BazelBin}" test //objectivec:conformance_test $BAZEL_FLAGS
fi fi
echo "" echo ""

Loading…
Cancel
Save