From 53de8b3eeb1b85d5c190d36b9381cd189c8d7931 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 27 Aug 2025 17:31:40 +0000 Subject: [PATCH 1/2] Add file filter and workflow for conditional CocoaPods specs linting Co-authored-by: phil.niedertscheider --- .github/file-filters.yml | 24 +++++++++ .github/workflows/lint-cocoapods-specs.yml | 61 +++++++++++++++++----- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/.github/file-filters.yml b/.github/file-filters.yml index f1862e54fe..549f9ce02a 100644 --- a/.github/file-filters.yml +++ b/.github/file-filters.yml @@ -64,3 +64,27 @@ run_api_stability_for_prs: &run_api_stability_for_prs # API-related code - "Makefile" # Make commands used for API generation - "sdk_api.json" - "sdk_api_v9.json" + +run_lint_cocoapods_Specs_for_prs: &run_lint_cocoapods_Specs_for_prs # CocoaPods specs linting + - "Sources/**" + - "Tests/**" + - "test-server/**" + - "Samples/**" + + # GH Actions + - ".github/workflows/lint-cocoapods-specs.yml" + - ".github/file-filters.yml" + + # Scripts + - "scripts/ci-select-xcode.sh" + - "scripts/ci-diagnostics.sh" + + # Project files + - "Sentry.xcodeproj/**" + - "*.podspec" + - "Gemfile.lock" + + # Other + - "Makefile" # Make commands used for linting setup + - "Brewfile*" # Tools installation affects linting environment + - ".swiftlint.yml" diff --git a/.github/workflows/lint-cocoapods-specs.yml b/.github/workflows/lint-cocoapods-specs.yml index 883309363e..c583cb2d60 100644 --- a/.github/workflows/lint-cocoapods-specs.yml +++ b/.github/workflows/lint-cocoapods-specs.yml @@ -17,20 +17,6 @@ on: - ".swiftlint.yml" pull_request: - paths: - - "Sources/**" - - "Tests/**" - - "test-server/**" - - "Samples/**" - - ".github/workflows/lint-cocoapods-specs.yml" - - "scripts/ci-select-xcode.sh" - - "scripts/ci-diagnostics.sh" - - "Sentry.xcodeproj/**" - - "*.podspec" - - "Gemfile.lock" - - "Makefile" # Make commands used for linting setup - - "Brewfile*" # Tools installation affects linting environment - - ".swiftlint.yml" # Concurrency configuration: # - We use workflow-specific concurrency groups to prevent multiple lint runs on the same code, @@ -44,8 +30,30 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: + # This job detects if the PR contains changes that require running CocoaPods specs linting. + # If yes, the job will output a flag that will be used by the next jobs to run the linting. + # If no, the job will output a flag that will be used by the next jobs to skip running the linting. + # At the end of this workflow, we run a check that validates that either all linting jobs passed or were + # skipped, called lint_cocoapods_Specs-required-check. + files-changed: + name: Detect File Changes + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + run_lint_cocoapods_Specs_for_prs: ${{ steps.changes.outputs.run_lint_cocoapods_Specs_for_prs }} + steps: + - uses: actions/checkout@v5 + - name: Get changed files + id: changes + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + with: + token: ${{ github.token }} + filters: .github/file-filters.yml + lint-podspec: name: ${{ matrix.podspec}} ${{ matrix.library_type }} ${{ matrix.platform}} + if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_cocoapods_Specs_for_prs == 'true' + needs: files-changed runs-on: macos-14 strategy: fail-fast: false @@ -67,6 +75,8 @@ jobs: lint-hybrid-sdk-podspec: name: Sentry/HybridSDK + if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_cocoapods_Specs_for_prs == 'true' + needs: files-changed runs-on: macos-14 steps: @@ -78,3 +88,26 @@ jobs: - name: Run CI Diagnostics if: failure() run: ./scripts/ci-diagnostics.sh + + # This check validates that either all linting jobs passed or were skipped, which allows us + # to make linting a required check with only running the linting when required. + # So, we don't have to run linting, for example, for Changelog or ReadMe changes. + + lint_cocoapods_Specs-required-check: + needs: + [ + files-changed, + lint-podspec, + lint-hybrid-sdk-podspec, + ] + name: Lint CocoaPods Specs + # This is necessary since a failed/skipped dependent job would cause this job to be skipped + if: always() + runs-on: ubuntu-latest + steps: + # If any jobs we depend on fails gets cancelled or times out, this job will fail. + # Skipped jobs are not considered failures. + - name: Check for failures + if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: | + echo "One of the CocoaPods specs linting jobs has failed." && exit 1 From 97f968db63687d21c3a46a5e57eedd2c9fb3753d Mon Sep 17 00:00:00 2001 From: Philip Niedertscheider Date: Wed, 27 Aug 2025 20:13:58 +0200 Subject: [PATCH 2/2] fix run condition --- .github/workflows/lint-cocoapods-specs.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint-cocoapods-specs.yml b/.github/workflows/lint-cocoapods-specs.yml index c583cb2d60..23fee63a5b 100644 --- a/.github/workflows/lint-cocoapods-specs.yml +++ b/.github/workflows/lint-cocoapods-specs.yml @@ -30,15 +30,9 @@ concurrency: cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - # This job detects if the PR contains changes that require running CocoaPods specs linting. - # If yes, the job will output a flag that will be used by the next jobs to run the linting. - # If no, the job will output a flag that will be used by the next jobs to skip running the linting. - # At the end of this workflow, we run a check that validates that either all linting jobs passed or were - # skipped, called lint_cocoapods_Specs-required-check. files-changed: name: Detect File Changes runs-on: ubuntu-latest - # Map a step output to a job output outputs: run_lint_cocoapods_Specs_for_prs: ${{ steps.changes.outputs.run_lint_cocoapods_Specs_for_prs }} steps: @@ -52,6 +46,7 @@ jobs: lint-podspec: name: ${{ matrix.podspec}} ${{ matrix.library_type }} ${{ matrix.platform}} + # Run the job only for PRs with related changes or non-PR events. if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_cocoapods_Specs_for_prs == 'true' needs: files-changed runs-on: macos-14 @@ -75,6 +70,7 @@ jobs: lint-hybrid-sdk-podspec: name: Sentry/HybridSDK + # Run the job only for PRs with related changes or non-PR events. if: github.event_name != 'pull_request' || needs.files-changed.outputs.run_lint_cocoapods_Specs_for_prs == 'true' needs: files-changed runs-on: macos-14 @@ -89,10 +85,6 @@ jobs: if: failure() run: ./scripts/ci-diagnostics.sh - # This check validates that either all linting jobs passed or were skipped, which allows us - # to make linting a required check with only running the linting when required. - # So, we don't have to run linting, for example, for Changelog or ReadMe changes. - lint_cocoapods_Specs-required-check: needs: [