Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 50 additions & 12 deletions .github/workflows/native-sdk-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,58 @@ jobs:
detect-changes:
name: Detect Changes
runs-on: ubuntu-latest
# Per-platform change detection so each platform's e2e jobs run only when
# that platform's code (or shared infra) changed, instead of every platform
# running on any native change. `common-changed` covers shared infra that
# affects ALL platforms (the native-bindings test backend that produces the
# spec, and this workflow file itself); when it changes, every platform runs.
# The union of the four outputs equals the previous coarse `source-changed`.
outputs:
source-changed: ${{ steps.check.outputs.source-changed }}
dart-changed: ${{ steps.check.outputs.dart-changed }}
kotlin-changed: ${{ steps.check.outputs.kotlin-changed }}
swift-changed: ${{ steps.check.outputs.swift-changed }}
common-changed: ${{ steps.check.outputs.common-changed }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- id: check
run: |
# On manual dispatch there is no diff base, so run everything: mark
# every platform plus common as changed (matches the old coarse
# "source-changed=true on dispatch" behavior).
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "source-changed=true" >> "$GITHUB_OUTPUT"
elif git diff --name-only origin/main...HEAD | grep -qE '^(native/(dart|kotlin|swift)|test-apps/native-bindings)/|^\.github/workflows/native-sdk-e2e\.yml$'; then
echo "source-changed=true" >> "$GITHUB_OUTPUT"
else
echo "source-changed=false" >> "$GITHUB_OUTPUT"
{
echo "dart-changed=true"
echo "kotlin-changed=true"
echo "swift-changed=true"
echo "common-changed=true"
} >> "$GITHUB_OUTPUT"
exit 0
fi

# Same diff base as before; classify the changed paths per platform.
CHANGED="$(git diff --name-only origin/main...HEAD)"

emit() { echo "$1=$2" >> "$GITHUB_OUTPUT"; echo "$1=$2"; }

if echo "$CHANGED" | grep -qE '^native/dart/'; then emit dart-changed true; else emit dart-changed false; fi
if echo "$CHANGED" | grep -qE '^native/kotlin/'; then emit kotlin-changed true; else emit kotlin-changed false; fi
if echo "$CHANGED" | grep -qE '^native/swift/'; then emit swift-changed true; else emit swift-changed false; fi
if echo "$CHANGED" | grep -qE '^test-apps/native-bindings/|^\.github/workflows/native-sdk-e2e\.yml$'; then emit common-changed true; else emit common-changed false; fi

# Shared setup: build monorepo, generate spec, upload artifact
setup:
name: Build & Generate Spec
needs: [detect-changes]
if: needs.detect-changes.outputs.source-changed == 'true'
# Produces the shared spec artifact all platform jobs consume, so run it
# whenever any platform (or common infra) changed.
if: >-
needs.detect-changes.outputs.dart-changed == 'true' ||
needs.detect-changes.outputs.kotlin-changed == 'true' ||
needs.detect-changes.outputs.swift-changed == 'true' ||
needs.detect-changes.outputs.common-changed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
Expand Down Expand Up @@ -81,7 +111,9 @@ jobs:
dart-e2e:
name: Dart E2E
needs: [detect-changes, setup]
if: needs.detect-changes.outputs.source-changed == 'true'
if: >-
needs.detect-changes.outputs.dart-changed == 'true' ||
needs.detect-changes.outputs.common-changed == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
Expand Down Expand Up @@ -163,13 +195,17 @@ jobs:
# kotlin-e2e:
# name: Kotlin E2E
# needs: [detect-changes, setup]
# if: needs.detect-changes.outputs.source-changed == 'true'
# if: >-
# needs.detect-changes.outputs.kotlin-changed == 'true' ||
# needs.detect-changes.outputs.common-changed == 'true'
# ...

swift-e2e:
name: Swift E2E
needs: [detect-changes, setup]
if: needs.detect-changes.outputs.source-changed == 'true'
if: >-
needs.detect-changes.outputs.swift-changed == 'true' ||
needs.detect-changes.outputs.common-changed == 'true'
runs-on: macos-15
timeout-minutes: 20
steps:
Expand Down Expand Up @@ -255,7 +291,8 @@ jobs:
name: Dart E2E (sandbox)
needs: [detect-changes, dart-e2e]
if: >-
needs.detect-changes.outputs.source-changed == 'true' &&
(needs.detect-changes.outputs.dart-changed == 'true' ||
needs.detect-changes.outputs.common-changed == 'true') &&
(github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
Expand Down Expand Up @@ -388,7 +425,8 @@ jobs:
name: Swift E2E (sandbox)
needs: [detect-changes, swift-e2e]
if: >-
needs.detect-changes.outputs.source-changed == 'true' &&
(needs.detect-changes.outputs.swift-changed == 'true' ||
needs.detect-changes.outputs.common-changed == 'true') &&
(github.event_name == 'workflow_dispatch' ||
github.event.pull_request.head.repo.full_name == github.repository)
runs-on: macos-15
Expand Down
Loading