Migrate remaining macOS tests to GHA
diff --git a/.github/actions/internal/bazel-setup/action.yml b/.github/actions/internal/bazel-setup/action.yml
index 2894479..112ee1c 100644
--- a/.github/actions/internal/bazel-setup/action.yml
+++ b/.github/actions/internal/bazel-setup/action.yml
@@ -42,7 +42,7 @@
       run: >
         echo "BAZEL_FLAGS=$BAZEL_FLAGS
         --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
       # External runs should never write to our caches.
diff --git a/.github/actions/internal/setup-runner/action.yml b/.github/actions/internal/setup-runner/action.yml
index 5c4f783..64afdc3 100644
--- a/.github/actions/internal/setup-runner/action.yml
+++ b/.github/actions/internal/setup-runner/action.yml
@@ -1,6 +1,6 @@
 name: Setup CI Runner
-# TODO(b/267357823) Consider moving this to it's own repository and include
-# a call to actions/checkout.
+# TODO(b/267357823) Consider moving this to it's own repository so we can
+# include the call to actions/checkout.
 description: Setup any platform-specific adjustments we need to make for CI
 runs:
   using: 'composite'
diff --git a/.github/workflows/test_objectivec.yml b/.github/workflows/test_objectivec.yml
new file mode 100644
index 0000000..8db8f7d
--- /dev/null
+++ b/.github/workflows/test_objectivec.yml
@@ -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\"
diff --git a/.github/workflows/test_php.yml b/.github/workflows/test_php.yml
index 7023bf5..1e56abf 100644
--- a/.github/workflows/test_php.yml
+++ b/.github/workflows/test_php.yml
@@ -34,7 +34,7 @@
             version: 8.0.5-dbg
             command: composer test_valgrind
 
-    name: Linux PHP ${{ matrix.name}}
+    name: Linux ${{ matrix.name}}
     runs-on: ubuntu-latest
     steps:
       - name: Checkout pending changes
@@ -48,3 +48,51 @@
           image: us-docker.pkg.dev/protobuf-build/containers/test/linux/php:${{ matrix.version }}-6e95c0e221e4bd52e3b4dc1398c6336985196931
           credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
           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
diff --git a/.github/workflows/test_python.yml b/.github/workflows/test_python.yml
index 66a624c..184d768 100644
--- a/.github/workflows/test_python.yml
+++ b/.github/workflows/test_python.yml
@@ -42,3 +42,52 @@
           credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
           bazel-cache: python_linux/${{ matrix.type }}_${{ matrix.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
diff --git a/.github/workflows/test_ruby.yml b/.github/workflows/test_ruby.yml
index 44ee193..edd4204 100644
--- a/.github/workflows/test_ruby.yml
+++ b/.github/workflows/test_ruby.yml
@@ -39,6 +39,36 @@
           bazel-cache: ruby_linux/${{ matrix.ruby }}_${{ matrix.bazel }}
           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:
     strategy:
       fail-fast: false
diff --git a/.github/workflows/test_runner.yml b/.github/workflows/test_runner.yml
index 7524ce6..354d41d 100644
--- a/.github/workflows/test_runner.yml
+++ b/.github/workflows/test_runner.yml
@@ -105,7 +105,7 @@
       safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
     secrets: inherit
 
-  ruby-install:
+  ruby:
     name: Ruby
     needs: [check-tag]
     uses: ./.github/workflows/test_ruby.yml
@@ -128,3 +128,11 @@
     with:
       safe-checkout: ${{ needs.check-tag.outputs.checkout-sha }}
     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
diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh
index 4fed4f5..366b394 100755
--- a/objectivec/DevTools/full_mac_build.sh
+++ b/objectivec/DevTools/full_mac_build.sh
@@ -8,8 +8,6 @@
 # Some base locations.
 readonly ScriptDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
 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.
 readonly BazelBin="${BAZEL:=bazel}"
@@ -32,6 +30,8 @@
    -r, --regenerate-descriptors
          Run generate_descriptor_proto.sh to regenerate all the checked in
          proto sources.
+   --bazel-flags
+         A set of flags to pass to any Bazel instances
    --core-only
          Skip some of the core protobuf build/checks to shorten the build time.
    --skip-xcode
@@ -72,6 +72,8 @@
 DO_XCODE_RELEASE=yes
 DO_OBJC_CONFORMANCE_TESTS=yes
 XCODE_QUIET=no
+BAZEL_FLAGS="--announce_rc --macos_minimum_os=10.9"
+
 while [[ $# != 0 ]]; do
   case "${1}" in
     -h | --help )
@@ -84,6 +86,10 @@
     -r | --regenerate-descriptors )
       REGEN_DESCRIPTORS=yes
       ;;
+    --bazel-flags )
+      BAZEL_FLAGS="$BAZEL_FLAGS $1"
+      shift
+      ;;
     --core-only )
       CORE_ONLY=yes
       ;;
@@ -181,16 +187,16 @@
 
 if [[ "${CORE_ONLY}" == "yes" ]] ; then
   header "Building core Only"
-  "${BazelBin}" build //:protoc //:protobuf //:protobuf_lite $BazelFlags
+  "${BazelBin}" build //:protoc //:protobuf //:protobuf_lite $BAZEL_FLAGS
 else
   header "Building"
   # Can't issue these together, when fully parallel, something sometimes chokes
   # at random.
-  "${BazelBin}" test //src/... $BazelFlags
+  "${BazelBin}" test //src/... $BAZEL_FLAGS
 fi
 
 # 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"
 # Some of the kokoro machines don't have python3 yet, so fall back to python if need be.
@@ -317,7 +323,7 @@
 
 if [[ "${DO_OBJC_CONFORMANCE_TESTS}" == "yes" ]] ; then
   header "Running ObjC Conformance Tests"
-  "${BazelBin}" test //objectivec:conformance_test $BazelFlags
+  "${BazelBin}" test //objectivec:conformance_test $BAZEL_FLAGS
 fi
 
 echo ""