Skip to content

Commit 029a804

Browse files
authored
chore(ci): Add required checks job for lint cocoapods specs (#6007)
1 parent 331dad6 commit 029a804

File tree

2 files changed

+63
-14
lines changed

2 files changed

+63
-14
lines changed

.github/file-filters.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,27 @@ run_api_stability_for_prs: &run_api_stability_for_prs # API-related code
6464
- "Makefile" # Make commands used for API generation
6565
- "sdk_api.json"
6666
- "sdk_api_v9.json"
67+
68+
run_lint_cocoapods_Specs_for_prs: &run_lint_cocoapods_Specs_for_prs # CocoaPods specs linting
69+
- "Sources/**"
70+
- "Tests/**"
71+
- "test-server/**"
72+
- "Samples/**"
73+
74+
# GH Actions
75+
- ".github/workflows/lint-cocoapods-specs.yml"
76+
- ".github/file-filters.yml"
77+
78+
# Scripts
79+
- "scripts/ci-select-xcode.sh"
80+
- "scripts/ci-diagnostics.sh"
81+
82+
# Project files
83+
- "Sentry.xcodeproj/**"
84+
- "*.podspec"
85+
- "Gemfile.lock"
86+
87+
# Other
88+
- "Makefile" # Make commands used for linting setup
89+
- "Brewfile*" # Tools installation affects linting environment
90+
- ".swiftlint.yml"

.github/workflows/lint-cocoapods-specs.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,6 @@ on:
1717
- ".swiftlint.yml"
1818

1919
pull_request:
20-
paths:
21-
- "Sources/**"
22-
- "Tests/**"
23-
- "test-server/**"
24-
- "Samples/**"
25-
- ".github/workflows/lint-cocoapods-specs.yml"
26-
- "scripts/ci-select-xcode.sh"
27-
- "scripts/ci-diagnostics.sh"
28-
- "Sentry.xcodeproj/**"
29-
- "*.podspec"
30-
- "Gemfile.lock"
31-
- "Makefile" # Make commands used for linting setup
32-
- "Brewfile*" # Tools installation affects linting environment
33-
- ".swiftlint.yml"
3420

3521
# Concurrency configuration:
3622
# - We use workflow-specific concurrency groups to prevent multiple lint runs on the same code,
@@ -44,8 +30,25 @@ concurrency:
4430
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
4531

4632
jobs:
33+
files-changed:
34+
name: Detect File Changes
35+
runs-on: ubuntu-latest
36+
outputs:
37+
run_lint_cocoapods_Specs_for_prs: ${{ steps.changes.outputs.run_lint_cocoapods_Specs_for_prs }}
38+
steps:
39+
- uses: actions/checkout@v5
40+
- name: Get changed files
41+
id: changes
42+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
43+
with:
44+
token: ${{ github.token }}
45+
filters: .github/file-filters.yml
46+
4747
lint-podspec:
4848
name: ${{ matrix.podspec}} ${{ matrix.library_type }} ${{ matrix.platform}}
49+
# Run the job only for PRs with related changes or non-PR events.
50+
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_cocoapods_Specs_for_prs == 'true'
51+
needs: files-changed
4952
runs-on: macos-14
5053
strategy:
5154
fail-fast: false
@@ -67,6 +70,9 @@ jobs:
6770

6871
lint-hybrid-sdk-podspec:
6972
name: Sentry/HybridSDK
73+
# Run the job only for PRs with related changes or non-PR events.
74+
if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_cocoapods_Specs_for_prs == 'true'
75+
needs: files-changed
7076
runs-on: macos-14
7177

7278
steps:
@@ -78,3 +84,22 @@ jobs:
7884
- name: Run CI Diagnostics
7985
if: failure()
8086
run: ./scripts/ci-diagnostics.sh
87+
88+
lint_cocoapods_Specs-required-check:
89+
needs:
90+
[
91+
files-changed,
92+
lint-podspec,
93+
lint-hybrid-sdk-podspec,
94+
]
95+
name: Lint CocoaPods Specs
96+
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
97+
if: always()
98+
runs-on: ubuntu-latest
99+
steps:
100+
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
101+
# Skipped jobs are not considered failures.
102+
- name: Check for failures
103+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
104+
run: |
105+
echo "One of the CocoaPods specs linting jobs has failed." && exit 1

0 commit comments

Comments
 (0)