| name: Objective-C Tests | |
| on: | |
| workflow_call: | |
| inputs: | |
| continuous-run: | |
| required: true | |
| description: "Boolean string denoting whether this run is continuous -- | |
| empty string for presubmit, non-empty string for continuous." | |
| type: string | |
| safe-checkout: | |
| required: true | |
| description: "The SHA key for the commit we want to run over" | |
| type: string | |
| continuous-prefix: | |
| required: true | |
| description: "The string continuous-only tests should be prefixed with when displaying test | |
| results." | |
| type: string | |
| permissions: | |
| contents: read | |
| jobs: | |
| xcode: | |
| strategy: | |
| fail-fast: false # Don't cancel all jobs if one fails. | |
| matrix: | |
| platform: ["macOS", "iOS"] | |
| xc_config: ["Debug", "Release"] | |
| # The "destination" entries need to match what is available for the selected Xcode. | |
| # See `.github/BUILD.bazel` for the Xcode info. | |
| include: | |
| - platform: "macOS" | |
| destination: "platform=macOS" | |
| xc_project: "ProtocolBuffers_OSX.xcodeproj" | |
| - platform: "iOS" | |
| destination: "platform=iOS Simulator,name=iPhone 16" | |
| xc_project: "ProtocolBuffers_iOS.xcodeproj" | |
| # We run presubmits on all "Debug" entries, but not on "Release" entries | |
| - xc_config: "Debug" | |
| - xc_config: "Release" | |
| continuous-only: true | |
| name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} Xcode ${{ matrix.platform}} ${{ matrix.xc_config }} | |
| runs-on: macos-15 | |
| env: | |
| DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer | |
| steps: | |
| - name: Checkout pending changes | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/checkout@v7 | |
| with: | |
| ref: ${{ inputs.safe-checkout }} | |
| - name: Setup ccache | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/ccache@v7 | |
| with: | |
| cache-prefix: objectivec_${{ matrix.platform }}_${{ matrix.xc_config }} | |
| support-modules: true | |
| - name: Run tests | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/bash@v7 | |
| env: | |
| CC: ${{ github.workspace }}/ci/clang_wrapper | |
| CXX: ${{ github.workspace }}/ci/clang_wrapper++ | |
| CODE_SIGN_IDENTITY: "-" | |
| with: | |
| credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} | |
| bazel-version: 9.2.0 | |
| command: | | |
| if [[ "${{ matrix.platform }}" == "iOS" ]]; then | |
| # Only iOS tests run in a simulator (macOS tests run directly on the host). | |
| # Xcode 16's xcodebuild only waits about a minute for CoreSimulatorService to | |
| # start. On a freshly started runner that is sometimes not enough, and it fails | |
| # with "Unable to find a device matching the provided destination specifier". | |
| # `simctl` blocks until the service is up, so talk to it first. | |
| # See https://github.com/actions/runner-images/issues/12777 | |
| xcrun simctl list devices available | |
| fi | |
| xcodebuild \ | |
| -project "objectivec/${{ matrix.xc_project }}" \ | |
| -scheme ProtocolBuffers \ | |
| -configuration ${{ matrix.xc_config }} \ | |
| -destination "${{ matrix.destination }}" \ | |
| test | |
| - name: Report ccache stats | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| shell: bash | |
| run: ccache -s -v | |
| pod-lib-lint: | |
| strategy: | |
| fail-fast: false # Don't cancel all jobs if one fails. | |
| matrix: | |
| # Disabling visionOS for now: https://github.com/actions/runner-images/issues/10559 | |
| PLATFORM: ["ios", "macos", "tvos", "watchos"] | |
| CONFIGURATION: ["Debug", "Release"] | |
| include: | |
| - OS: macos-15 | |
| XCODE: "16.4" | |
| # We run presubmits on all "Debug" entries, but not on "Release" entries | |
| - CONFIGURATION: "Debug" | |
| - CONFIGURATION: "Release" | |
| continuous-only: true | |
| name: ${{ matrix.continuous-only && inputs.continuous-prefix || '' }} CocoaPods ${{ matrix.PLATFORM }} ${{ matrix.CONFIGURATION }} | |
| runs-on: ${{ matrix.OS }} | |
| steps: | |
| - name: Checkout pending changes | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/checkout@v7 | |
| with: | |
| ref: ${{ inputs.safe-checkout }} | |
| - name: Xcode version | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| run: sudo xcode-select -switch /Applications/Xcode_${{ matrix.XCODE }}.app | |
| - name: Pod lib lint | |
| if: ${{ !matrix.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/bazel@v7 | |
| with: | |
| version: 9.2.0 # Bazel version | |
| credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} | |
| bazel-cache: cocoapods/${{ matrix.XCODE }} | |
| bash: | | |
| ./regenerate_stale_files.sh $BAZEL_FLAGS --xcode_version="${{ matrix.XCODE }}" | |
| pod lib lint --verbose \ | |
| --configuration=${{ matrix.CONFIGURATION }} \ | |
| --platforms=${{ matrix.PLATFORM }} \ | |
| Protobuf.podspec | |
| bazel: | |
| strategy: | |
| fail-fast: false # Don't cancel all jobs if one fails. | |
| matrix: | |
| config: | |
| - name: Optimized | |
| flags: --config=opt | |
| bazel_action: test | |
| continuous-only: true | |
| - name: Debug | |
| flags: --config=dbg | |
| bazel_action: test | |
| # Current github runners are all Intel based, so just build/compile | |
| # for Apple Silicon to detect issues there. | |
| - name: Apple_Silicon_Optimized | |
| flags: --config=opt --cpu=darwin_arm64 | |
| bazel_action: build | |
| continuous-only: true | |
| - name: Apple_Silicon_Debug | |
| flags: --config=dbg --cpu=darwin_arm64 | |
| bazel_action: build | |
| # TODO: Could add iOS to atleast build the objc_library targets for that. | |
| platform: ["macOS"] | |
| include: | |
| - platform: "macOS" | |
| bazel_targets: //objectivec/... | |
| name: ${{ matrix.config.continuous-only && inputs.continuous-prefix || '' }} Bazel ${{ matrix.platform }} ${{ matrix.config.name }} | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout pending changes | |
| if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/checkout@v7 | |
| with: | |
| ref: ${{ inputs.safe-checkout }} | |
| - name: bazel ${{ matrix.config.bazel_action }} | |
| if: ${{ !matrix.config.continuous-only || inputs.continuous-run }} | |
| uses: protocolbuffers/protobuf-ci/bazel@v7 | |
| with: | |
| version: 9.2.0 # Bazel version | |
| credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }} | |
| bazel: ${{ matrix.config.bazel_action }} ${{ matrix.config.flags }} ${{ matrix.bazel_targets }} | |
| bazel-cache: objc_${{ matrix.platform }}_${{ matrix.config.name }} |