Skip to content

Commit 9cbff30

Browse files
authored
chore(ci): Add required checks job for lint xcode analyze (#5999)
1 parent 0ede342 commit 9cbff30

File tree

2 files changed

+54
-20
lines changed

2 files changed

+54
-20
lines changed

.github/file-filters.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,22 @@ run_lint_dprint_for_prs: &run_lint_dprint_for_prs # dprint formatting
172172
# GH Actions
173173
- ".github/workflows/lint-dprint-formatting.yml"
174174
- ".github/file-filters.yml"
175+
176+
run_lint_xcode_analyze_for_prs: &run_lint_xcode_analyze_for_prs # Xcode linting
177+
- "Sources/**"
178+
- "Tests/**"
179+
- "test-server/**"
180+
- "Samples/**"
181+
182+
# GH Actions
183+
- ".github/workflows/lint-xcode-analyze.yml"
184+
- ".github/file-filters.yml"
185+
186+
# Scripts
187+
- "scripts/ci-select-xcode.sh"
188+
- "scripts/ci-diagnostics.sh"
189+
190+
# Project files
191+
- "Sentry.xcodeproj/**"
192+
- "*.podspec"
193+
- "Gemfile.lock"

.github/workflows/lint-xcode-analyze.yml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
paths:
8-
- "Sources/**"
9-
- "Tests/**"
10-
- "test-server/**"
11-
- "Samples/**"
12-
- ".github/workflows/lint-xcode-analyze.yml"
13-
- "scripts/ci-select-xcode.sh"
14-
- "scripts/ci-diagnostics.sh"
15-
167
pull_request:
17-
paths:
18-
- "Sources/**"
19-
- "Tests/**"
20-
- "test-server/**"
21-
- "Samples/**"
22-
- ".github/workflows/lint-xcode-analyze.yml"
23-
- "scripts/ci-select-xcode.sh"
24-
- "scripts/ci-diagnostics.sh"
25-
- "Sentry.xcodeproj/**"
26-
- "*.podspec"
27-
- "Gemfile.lock"
288

299
# Concurrency configuration:
3010
# - We use workflow-specific concurrency groups to prevent multiple lint runs on the same code,
@@ -38,8 +18,25 @@ concurrency:
3818
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
3919

4020
jobs:
21+
files-changed:
22+
name: Detect File Changes
23+
runs-on: ubuntu-latest
24+
outputs:
25+
run_lint_xcode_analyze_for_prs: ${{ steps.changes.outputs.run_lint_xcode_analyze_for_prs }}
26+
steps:
27+
- uses: actions/checkout@v5
28+
- name: Get changed files
29+
id: changes
30+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
31+
with:
32+
token: ${{ github.token }}
33+
filters: .github/file-filters.yml
34+
4135
lint:
4236
name: Lint
37+
# Run the job only for PRs with related changes or non-PR events.
38+
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_xcode_analyze_for_prs == 'true'
39+
needs: files-changed
4340
runs-on: macos-15
4441
steps:
4542
- uses: actions/checkout@v5
@@ -48,3 +45,21 @@ jobs:
4845
- name: Run CI Diagnostics
4946
if: failure()
5047
run: ./scripts/ci-diagnostics.sh
48+
49+
lint_xcode_analyze-required-check:
50+
needs:
51+
[
52+
files-changed,
53+
lint,
54+
]
55+
name: Lint Xcode
56+
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
57+
if: always()
58+
runs-on: ubuntu-latest
59+
steps:
60+
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
61+
# Skipped jobs are not considered failures.
62+
- name: Check for failures
63+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
64+
run: |
65+
echo "One of the lint check jobs has failed." && exit 1

0 commit comments

Comments
 (0)