Skip to content

Increase CI script portability around xcbeautify #5981

Increase CI script portability around xcbeautify

Increase CI script portability around xcbeautify #5981

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
# ready_for_review starts CI when a draft PR becomes ready; converted_to_draft
# creates a skipped run that cancels any in-progress CI for the same PR ref.
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
workflow_dispatch:
# Default token permissions — dorny/paths-filter calls the PR Files API to
# compute the diff, which needs pull-requests: read. contents: read covers
# actions/checkout for both push and pull_request events.
permissions:
contents: read
pull-requests: read
# Cancel superseded runs on the same ref (PR pushes, branch updates).
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
changes:
name: Detect Changed Areas
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
android: ${{ steps.platform.outputs.android == 'true' || steps.platform.outputs.protocolKotlin == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.android == 'true' }}
swift: ${{ steps.platform.outputs.swift == 'true' || steps.platform.outputs.protocolSwift == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.swift == 'true' }}
reactNative: ${{ steps.platform.outputs.reactNative == 'true' || steps.platform.outputs.protocolTypescript == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.reactNativeCommon == 'true' || steps.infra.outputs.reactNativeIos == 'true' || steps.infra.outputs.reactNativeAndroid == 'true' }}
reactNativeIos: ${{ steps.platform.outputs.reactNative == 'true' || steps.platform.outputs.protocolTypescript == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.reactNativeCommon == 'true' || steps.infra.outputs.reactNativeIos == 'true' }}
reactNativeAndroid: ${{ steps.platform.outputs.reactNative == 'true' || steps.platform.outputs.protocolTypescript == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.reactNativeCommon == 'true' || steps.infra.outputs.reactNativeAndroid == 'true' }}
web: ${{ steps.platform.outputs.web == 'true' || steps.platform.outputs.protocolTypescript == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.web == 'true' }}
protocol: ${{ steps.platform.outputs.protocolTypescript == 'true' || steps.platform.outputs.protocolShared == 'true' || steps.infra.outputs.protocol == 'true' }}
scripts: ${{ steps.infra.outputs.scripts == 'true' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
id: platform
with:
predicate-quantifier: every
filters: .ci/changed-file-filters.yml
- uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2
id: infra
with:
filters: |
android:
- '.github/workflows/android-publish.yml'
- '.github/workflows/android-protocol-publish.yml'
- '.github/workflows/android-test.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/release.yml'
- '.github/scripts/validate-release-version'
- '.ci/changed-file-filters.yml'
- '.github/workflows/ci.yml'
swift:
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/swift-test-package.yml'
- '.github/workflows/swift-build-and-test-samples.yml'
- '.github/workflows/swift-test-workflow.yml'
- '.github/workflows/swift-lint.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/actions/setup-mint/**'
- '.ci/changed-file-filters.yml'
- '.github/workflows/ci.yml'
# Common React Native infra: JS-level jobs (jest, lint, packed
# files) and shared config that should trigger all RN jobs.
reactNativeCommon:
- '.github/workflows/rn-test.yml'
- '.github/workflows/rn-check-packed-files.yml'
- '.github/workflows/rn-lint.yml'
- '.github/workflows/rn-publish.yml'
- '.github/workflows/release.yml'
- '.github/scripts/package-json-version'
- '.github/scripts/validate-release-version'
- '.github/actions/setup/**'
- '.github/actions/setup-mint/**'
- '.ci/changed-file-filters.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
# iOS-only RN infra: gates the macOS build/test jobs.
reactNativeIos:
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/rn-test-ios.yml'
- '.github/workflows/rn-build-ios.yml'
- '.github/actions/setup-mint/**'
# Android-only RN infra: gates the gradle build/test jobs.
reactNativeAndroid:
- '.github/workflows/rn-test-android.yml'
- '.github/workflows/rn-build-android.yml'
web:
- '.github/workflows/web.yml'
- '.github/actions/setup/**'
- '.ci/changed-file-filters.yml'
- '.github/workflows/ci.yml'
protocol:
- '.github/workflows/protocol-test.yml'
- '.github/actions/setup/**'
- '.ci/changed-file-filters.yml'
- '.github/workflows/ci.yml'
scripts:
- 'scripts/lib/**'
- 'scripts/test_ruby'
- 'scripts/test/**'
- 'e2e/lib/**'
- 'e2e/test/**'
- 'e2e/scripts/**'
- 'e2e/flows/**'
- 'e2e/tests/**'
- 'e2e/config.yaml'
- 'e2e/config/matrix.yml'
- '.ci/changed-file-filters.yml'
- '.github/workflows/ci.yml'
android-test:
name: Android
needs: changes
if: needs.changes.outputs.android == 'true'
uses: ./.github/workflows/android-test.yml
swift-test-package:
name: Swift
needs: changes
if: needs.changes.outputs.swift == 'true'
uses: ./.github/workflows/swift-test-package.yml
swift-build-and-test-samples:
name: Swift
needs: changes
if: needs.changes.outputs.swift == 'true'
uses: ./.github/workflows/swift-build-and-test-samples.yml
swift-lint:
name: Swift
needs: changes
if: needs.changes.outputs.swift == 'true'
uses: ./.github/workflows/swift-lint.yml
swift-sample-package-paths:
name: Swift Sample Package Paths
needs: changes
if: needs.changes.outputs.swift == 'true'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: platforms/swift/Scripts/check_sample_package_paths
rn-test:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/rn-test.yml
rn-test-android:
name: React Native
needs: changes
if: needs.changes.outputs.reactNativeAndroid == 'true'
uses: ./.github/workflows/rn-test-android.yml
rn-test-ios:
name: React Native
needs: changes
if: needs.changes.outputs.reactNativeIos == 'true'
uses: ./.github/workflows/rn-test-ios.yml
rn-build-android:
name: React Native
needs: changes
if: needs.changes.outputs.reactNativeAndroid == 'true'
uses: ./.github/workflows/rn-build-android.yml
rn-build-ios:
name: React Native
needs: changes
if: needs.changes.outputs.reactNativeIos == 'true'
uses: ./.github/workflows/rn-build-ios.yml
rn-check-packed-files:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-check-packed-files.yml
rn-lint:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-lint.yml
web:
name: Web
needs: changes
if: needs.changes.outputs.web == 'true'
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/web.yml
protocol-test:
name: Protocol
needs: changes
if: needs.changes.outputs.protocol == 'true'
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/protocol-test.yml
scripts-test:
name: Scripts
needs: changes
if: needs.changes.outputs.scripts == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: .ruby-version
- run: ./scripts/test_ruby
breaking-changes:
name: Breaking Changes
needs: changes
if: |
needs.changes.outputs.swift == 'true' ||
needs.changes.outputs.android == 'true' ||
needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/breaking-changes.yml
with:
swift: ${{ needs.changes.outputs.swift }}
android: ${{ needs.changes.outputs.android }}
react-native: ${{ needs.changes.outputs.reactNative }}
# Single required status check for branch protection.
# Passes when every relevant platform job either succeeded or was skipped
# because no files in that platform's tree changed.
ci-required:
name: CI Required
if: always() && (github.event_name != 'pull_request' || github.event.pull_request.draft == false)
needs:
- changes
- android-test
- swift-test-package
- swift-build-and-test-samples
- swift-lint
- swift-sample-package-paths
- rn-test
- rn-test-android
- rn-test-ios
- rn-build-android
- rn-build-ios
- rn-check-packed-files
- rn-lint
- web
- protocol-test
- scripts-test
- breaking-changes
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Verify all upstream jobs succeeded or were skipped
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
echo "Upstream job results:"
echo "$NEEDS_JSON" | jq '.'
failed=$(echo "$NEEDS_JSON" | jq -r '
to_entries
| map(select(.value.result == "failure" or .value.result == "cancelled"))
| .[].key
')
if [ -n "$failed" ]; then
echo "::error::Required jobs failed or were cancelled:"
echo "$failed" | sed 's/^/ - /'
exit 1
fi
echo "All required jobs passed (or were skipped because no relevant files changed)."