Skip to content

Commit 0ee162c

Browse files
authored
chore(ci): Add required check job for Testflight (#6037)
1 parent 15a6325 commit 0ee162c

File tree

2 files changed

+52
-11
lines changed

2 files changed

+52
-11
lines changed

.github/file-filters.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,21 @@ run_build_for_prs: &run_build_for_prs # Build-related code
311311
- "Makefile" # Make commands used for CI build setup
312312
- "Brewfile*" # Dependency installation affects build environment
313313

314+
run_testflight_for_prs: &run_testflight_for_prs # Testflight-related code
315+
- ".github/workflows/testflight.yml"
316+
317+
run_testflight_for_pushes: &run_testflight_for_pushes # Testflight-related code
318+
- "Sources/**"
319+
- "Samples/iOS-Swift/**"
320+
321+
# GH Actions
322+
- ".github/workflows/testflight.yml"
323+
- ".github/file-filters.yml"
324+
325+
# Scripts
326+
- "scripts/ci-select-xcode.sh"
327+
- "scripts/ci-diagnostics.sh"
328+
314329
run_check_package_diff_for_prs: &run_check_package_diff_for_prs # Package.swift diff checking
315330
# GH Actions
316331
- ".github/workflows/check-package-diff.yml"

.github/workflows/testflight.yml

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,7 @@ on:
55
- main
66
- release/**
77

8-
paths:
9-
- "Sources/**"
10-
- "Samples/iOS-Swift/**"
11-
- ".github/workflows/testflight.yml"
12-
- "fastlane/**"
13-
- "scripts/ci-select-xcode.sh"
14-
- "scripts/ci-diagnostics.sh"
15-
168
pull_request:
17-
paths:
18-
- ".github/workflows/testflight.yml"
19-
- "scripts/ci-diagnostics.sh"
209
workflow_dispatch:
2110

2211
# Concurrency configuration:
@@ -31,7 +20,23 @@ concurrency:
3120
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3221

3322
jobs:
23+
files-changed:
24+
name: Detect File Changes
25+
runs-on: ubuntu-latest
26+
outputs:
27+
run_testflight_for_changes: ${{ github.event_name == 'pull_request' && steps.changes.outputs.run_testflight_for_prs || steps.changes.outputs.run_testflight_for_pushes }}
28+
steps:
29+
- uses: actions/checkout@v5
30+
- name: Get changed files
31+
id: changes
32+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
33+
with:
34+
token: ${{ github.token }}
35+
filters: .github/file-filters.yml
36+
3437
upload_to_testflight:
38+
if: needs.files-changed.outputs.run_testflight_for_changes == 'true'
39+
needs: files-changed
3540
name: Build and Upload iOS-Swift to Testflight
3641
runs-on: macos-15
3742
steps:
@@ -81,3 +86,24 @@ jobs:
8186
- name: Run CI Diagnostics
8287
if: failure()
8388
run: ./scripts/ci-diagnostics.sh
89+
90+
# This check validates that either upload_to_testflight passed or was skipped, which allows us
91+
# to make testflight a required check with only running the upload_to_testflight when required.
92+
# So, we don't have to run upload_to_testflight, for example, for unrelated changes.
93+
testflight-required-check:
94+
needs:
95+
[
96+
files-changed,
97+
upload_to_testflight,
98+
]
99+
name: Testflight
100+
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
101+
if: always()
102+
runs-on: ubuntu-latest
103+
steps:
104+
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
105+
# Skipped jobs are not considered failures.
106+
- name: Check for failures
107+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
108+
run: |
109+
echo "One of the testflight jobs has failed." && exit 1

0 commit comments

Comments
 (0)