Skip to content

Commit c9976e2

Browse files
itaybredenrase
andauthored
chore: Add dedicated CI workflow for 3rd-party integrations (#6945)
* Add `SenrtySwiftLog` integration * Add default `swift package init` .gitignore * chore: Add test workflow for swift log * Add macOS version * Remove file-filter * Update integration's package to use local path * Add ci job to run test * Add files-changed gate * Fix example commands * Add SPM test to required checks * update folder structure * update name * Update `sentry-xcodebuild.sh` to be compatible with SPM packages * Add `--update-path-to-sentry-cocoa` to prepare-package.sh * Improve script * Reuse existing `unit-test-common.yml` * Fix path * Update GitHub Actions workflow to use 'runs-on' for macOS version * Remove unnecesary files * Add missing parameters * Update GitHub Actions workflow to correct script path for package preparation * Add debugging steps to unit-test-common.yml for improved visibility during testing * Update paths * Update path * Update path in prepare-package.sh for Sentry Cocoa package reference * Add support for testing SPM packages in CI workflows * Add comment * delete old/unused fils from previous merge * Changed the working directory for SwiftLog integration to SentrySwiftLog in CI workflows. Removed the option to update the path to sentry-cocoa from the prepare-package.sh script and use `swift package edit` directly. * - Introduced a new workflow for testing 3rd-party integrations, consolidating tests for SentrySwiftLog, SentrySwiftyBeaver, SentryCocoaLumberjack, and SentryPulse. - Updated file filters to trigger tests based on changes in the 3rd-party integrations directory - Removed outdated unit test jobs from the main test workflow to streamline CI processes. * Updated the variable name from `path_to_scripts_folder` to `scripts_directory` in both the 3rd-party integrations and unit test workflows for consistency and clarity. Adjusted script execution commands to utilize the new variable name. * Update actions/checkout version in 3rd-party integrations workflow to improve consistency across jobs. * Add tests for SentrySwiftyBeaver, SentryCocoaLumberjack, and SentryPulse in the 3rd-party integrations workflow with scheme/xcode * Rename and update the Xcode integration test job to `test-integrations-xcodebuild` for clarity, reflecting its focus on SPM packages using xcodebuild. Adjusted job dependencies accordingly. * Update SPM project option handling in sentry-xcodebuild.sh to accept a value instead of a boolean flag, improving flexibility in script usage. * Add default working directory to unit test workflow configuration for improved test execution. * Fix call for --spm-project to use missing param * Inherit secrets in the 3rd-party integrations workflow * Enhance unit test workflow by specifying working directory for code coverage and enable code coverage for SPM projects in the build script. * diable slather for spm xcodebuild, as we don't have xcodeproj files * dont upload codecov * bump to 18.5 * bump rest to 18.5 * Update artifact naming in unit test workflow to include scheme for better identification and no re-uploading atrifacts with same name * use working dir in Run CI Diagnostics * Update name groupings * UPdate name job grouping * update naming * trigger 3rd-party integration tests on source changes * reduce number of runs * test third-party integrations against pre-build artefacts instead of current release * Only build one static target * handle local artifacts in shared workflow * fix path * build sim slice * use inputs.working_directory for raw logs and archiving test results * add build-xcframeworks to required check * remove install + create (like on main) * revert SKIP_SWIFTLINT * add simulatorAndmacOSOnly to build-xcframework-local.sh * use sed intead of swift package edit swift package edit would pull in all dependencies, which would fail on release * include all related scripts to file filter * minor improvements * remove unneeded scripts dir argument * don’t install slather for som build * only run spm tests, revert changes to shared tests workflow and build script * use macOSOnly * Remove 3rd-party-integrations filter from unit test in file-filters.yml --------- Co-authored-by: Denis Andrasec <denrase@gmail.com>
1 parent d492bc8 commit c9976e2

File tree

3 files changed

+150
-133
lines changed

3 files changed

+150
-133
lines changed

.github/file-filters.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ run_unit_tests_for_prs: &run_unit_tests_for_prs
2525
- "SentryTestUtils/**"
2626
- "SentryTestUtilsDynamic/**"
2727
- "SentryTestUtilsTests/**"
28-
- "3rd-party-integrations/**"
2928

3029
# GH Actions
3130
- ".github/workflows/test.yml"
@@ -528,3 +527,21 @@ run_size_analysis_for_prs: &run_size_analysis_for_prs
528527
# Build configuration
529528
- "Makefile"
530529
- "Brewfile*"
530+
531+
run_3rd_party_integrations_tests_for_prs: &run_3rd_party_integrations_tests_for_prs
532+
- "Sources/**"
533+
- "3rd-party-integrations/**"
534+
535+
# GH Actions
536+
- ".github/workflows/test-3rd-party-integrations.yml"
537+
- ".github/file-filters.yml"
538+
539+
# Scripts
540+
- "scripts/ci-select-xcode.sh"
541+
- "scripts/ci-utils.sh"
542+
- "scripts/ci-diagnostics.sh"
543+
- "scripts/prepare-package.sh"
544+
- "scripts/build-xcframework-local.sh"
545+
546+
# Project files
547+
- "Package*.swift"
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
name: Test 3rd Party Integrations
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- release/**
7+
8+
pull_request:
9+
types: [opened, synchronize, reopened, labeled]
10+
11+
# Concurrency configuration:
12+
# - We use workflow-specific concurrency groups to allow independent test runs across different workflows
13+
# while preventing multiple runs of the same test suite on the same branch/commit.
14+
# - For pull requests, we cancel in-progress runs when new commits are pushed to save CI resources
15+
# and provide faster feedback on the latest changes.
16+
# - For main branch pushes and scheduled runs, we never cancel in-progress runs to ensure the complete
17+
# test suite always finishes, maintaining the integrity of our main branch quality gates.
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
21+
22+
jobs:
23+
ready-to-merge-gate:
24+
name: Ready-to-merge gate
25+
uses: ./.github/workflows/ready-to-merge-workflow.yml
26+
27+
# This job detects if the PR contains changes that require running tests for 3rd-party integrations.
28+
# If yes, the job will output a flag that will be used by the next job to run the tests for 3rd-party integrations.
29+
# If no, the job will output a flag that will be used by the next job to skip running the tests for 3rd-party integrations.
30+
# At the end of this workflow, we run a check that validates that either all tests for 3rd-party integrations passed or were
31+
# called unit-tests-required-check.
32+
files-changed:
33+
name: Detect File Changes
34+
runs-on: ubuntu-latest
35+
needs: ready-to-merge-gate
36+
# Map a step output to a job output
37+
outputs:
38+
run_3rd_party_integrations_tests_for_prs: ${{ steps.changes.outputs.run_3rd_party_integrations_tests_for_prs }}
39+
steps:
40+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
41+
- name: Get changed files
42+
id: changes
43+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
44+
with:
45+
token: ${{ github.token }}
46+
filters: .github/file-filters.yml
47+
48+
# Build xcframeworks from source code once for all integration tests.
49+
# This ensures tests use the current source code instead of the latest GitHub release.
50+
# We only build the Static variant since 3rd-party integrations only use the "Sentry" product.
51+
# Intentionally skipped on release branches.
52+
build-xcframeworks:
53+
name: Build XCFrameworks
54+
needs: files-changed
55+
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_3rd_party_integrations_tests_for_prs == 'true')
56+
runs-on: ["ghcr.io/cirruslabs/macos-runner:sequoia", "runner_group_id:10"]
57+
timeout-minutes: 30
58+
steps:
59+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
60+
- name: Select Xcode
61+
run: ./scripts/ci-select-xcode.sh 16.4
62+
- name: Build XCFramework (Static)
63+
run: ./scripts/build-xcframework-local.sh macOSOnly StaticOnly --not-signed
64+
- name: Upload XCFrameworks
65+
uses: actions/upload-artifact@v6
66+
with:
67+
name: xcframeworks-for-3rd-party-integration-tests
68+
path: "XCFrameworkBuildPath/*.xcframework.zip"
69+
retention-days: 1
70+
71+
# SPM tests for all 3rd-party integrations
72+
test-integrations-spm:
73+
name: SPM Tests | ${{matrix.integration_dir}}
74+
needs: [files-changed, build-xcframeworks]
75+
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_3rd_party_integrations_tests_for_prs == 'true')
76+
runs-on: ["ghcr.io/cirruslabs/macos-runner:sequoia", "runner_group_id:10"]
77+
timeout-minutes: 30
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
include:
82+
- integration_dir: SentrySwiftLog
83+
- integration_dir: SentrySwiftyBeaver
84+
- integration_dir: SentryCocoaLumberjack
85+
- integration_dir: SentryPulse
86+
steps:
87+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
88+
- name: Select Xcode
89+
run: ./scripts/ci-select-xcode.sh 16.4
90+
- name: Download XCFrameworks
91+
uses: actions/download-artifact@v7
92+
with:
93+
name: xcframeworks-for-3rd-party-integration-tests
94+
- name: Modify Package.swift to use local xcframeworks
95+
run: ./scripts/prepare-package.sh --package-file Package.swift --is-pr true --remove-duplicate true --change-path true
96+
- name: Use local sentry-cocoa
97+
working-directory: 3rd-party-integrations/${{matrix.integration_dir}}
98+
run: |
99+
sed -i '' 's|\.package(url: "https://github\.com/getsentry/sentry-cocoa", from: "[^"]*")|.package(name: "sentry-cocoa", path: "../..")|g' Package.swift
100+
- name: Run SPM Tests
101+
working-directory: 3rd-party-integrations/${{matrix.integration_dir}}
102+
run: swift test
103+
- name: Archiving Raw Logs
104+
uses: actions/upload-artifact@v6
105+
if: ${{ failure() || cancelled() }}
106+
with:
107+
name: raw-output-${{matrix.integration_dir}}-integration
108+
path: |
109+
3rd-party-integrations/${{matrix.integration_dir}}/.build/**/*.log
110+
- name: Run CI Diagnostics
111+
if: failure()
112+
run: ./scripts/ci-diagnostics.sh
113+
114+
unit-tests-required-check:
115+
needs:
116+
[
117+
ready-to-merge-gate,
118+
files-changed,
119+
build-xcframeworks,
120+
test-integrations-spm,
121+
]
122+
name: 3rd Party Integration Tests - Required Check
123+
# This is necessary since a failed/skipped dependent job would cause this job to be skipped
124+
if: always()
125+
runs-on: ubuntu-latest
126+
steps:
127+
# If any jobs we depend on fails gets cancelled or times out, this job will fail.
128+
# Skipped jobs are not considered failures.
129+
- name: Check for failures
130+
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
131+
run: |
132+
echo "One of the 3rd party integration test jobs has failed." && exit 1

.github/workflows/test.yml

Lines changed: 0 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -360,134 +360,6 @@ jobs:
360360
device: "Apple Vision Pro"
361361
timeout: 30
362362

363-
# This will be replaced once #6945 is merged.
364-
swiftlog-integration-unit-tests:
365-
name: SentrySwiftLog Unit Tests
366-
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_unit_tests_for_prs == 'true')
367-
needs: files-changed
368-
runs-on: ["ghcr.io/cirruslabs/macos-runner:sequoia", "runner_group_id:10"]
369-
steps:
370-
- uses: actions/checkout@v6
371-
372-
- name: Select Xcode
373-
run: ./scripts/ci-select-xcode.sh 16.4
374-
375-
- name: Setup local sentry-cocoa dependency
376-
working-directory: 3rd-party-integrations/SentrySwiftLog
377-
run: swift package edit sentry-cocoa --path ../..
378-
379-
- name: Run SwiftLog tests
380-
working-directory: 3rd-party-integrations/SentrySwiftLog
381-
run: swift test
382-
383-
- name: Archiving Raw Logs
384-
uses: actions/upload-artifact@v6
385-
if: ${{ failure() || cancelled() }}
386-
with:
387-
name: raw-output-swiftlog-integration
388-
path: |
389-
3rd-party-integrations/SentrySwiftLog/.build/**/*.log
390-
391-
- name: Run CI Diagnostics
392-
if: failure()
393-
run: ./scripts/ci-diagnostics.sh
394-
395-
# This will be replaced once #6945 is merged.
396-
swiftybeaver-integration-unit-tests:
397-
name: SentrySwiftyBeaver Unit Tests
398-
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_unit_tests_for_prs == 'true')
399-
needs: files-changed
400-
runs-on: ["ghcr.io/cirruslabs/macos-runner:sequoia", "runner_group_id:10"]
401-
steps:
402-
- uses: actions/checkout@v6
403-
404-
- name: Select Xcode
405-
run: ./scripts/ci-select-xcode.sh 16.4
406-
407-
- name: Setup local sentry-cocoa dependency
408-
working-directory: 3rd-party-integrations/SentrySwiftyBeaver
409-
run: swift package edit sentry-cocoa --path ../..
410-
411-
- name: Run SwiftyBeaver tests
412-
working-directory: 3rd-party-integrations/SentrySwiftyBeaver
413-
run: swift test
414-
415-
- name: Archiving Raw Logs
416-
uses: actions/upload-artifact@v6
417-
if: ${{ failure() || cancelled() }}
418-
with:
419-
name: raw-output-swiftybeaver-integration
420-
path: |
421-
3rd-party-integrations/SentrySwiftyBeaver/.build/**/*.log
422-
423-
- name: Run CI Diagnostics
424-
if: failure()
425-
run: ./scripts/ci-diagnostics.sh
426-
427-
# This will be replaced once #6945 is merged.
428-
cocoalumberjack-integration-unit-tests:
429-
name: SentryCocoaLumberjack Unit Tests
430-
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_unit_tests_for_prs == 'true')
431-
needs: files-changed
432-
runs-on: ["ghcr.io/cirruslabs/macos-runner:sequoia", "runner_group_id:10"]
433-
steps:
434-
- uses: actions/checkout@v6
435-
436-
- name: Select Xcode
437-
run: ./scripts/ci-select-xcode.sh 16.4
438-
439-
- name: Setup local sentry-cocoa dependency
440-
working-directory: 3rd-party-integrations/SentryCocoaLumberjack
441-
run: swift package edit sentry-cocoa --path ../..
442-
443-
- name: Run CocoaLumberjack tests
444-
working-directory: 3rd-party-integrations/SentryCocoaLumberjack
445-
run: swift test
446-
447-
- name: Archiving Raw Logs
448-
uses: actions/upload-artifact@v6
449-
if: ${{ failure() || cancelled() }}
450-
with:
451-
name: raw-output-cocoalumberjack-integration
452-
path: |
453-
3rd-party-integrations/SentryCocoaLumberjack/.build/**/*.log
454-
455-
- name: Run CI Diagnostics
456-
if: failure()
457-
run: ./scripts/ci-diagnostics.sh
458-
459-
# This will be replaced once #6945 is merged.
460-
pulse-integration-unit-tests:
461-
name: SentryPulse Unit Tests
462-
if: startsWith(github.ref, 'refs/heads/release/') == false && (github.event_name != 'pull_request' || needs.files-changed.outputs.run_unit_tests_for_prs == 'true')
463-
needs: files-changed
464-
runs-on: ["ghcr.io/cirruslabs/macos-runner:sequoia", "runner_group_id:10"]
465-
steps:
466-
- uses: actions/checkout@v6
467-
468-
- name: Select Xcode
469-
run: ./scripts/ci-select-xcode.sh 16.4
470-
471-
- name: Setup local sentry-cocoa dependency
472-
working-directory: 3rd-party-integrations/SentryPulse
473-
run: swift package edit sentry-cocoa --path ../..
474-
475-
- name: Run Pulse tests
476-
working-directory: 3rd-party-integrations/SentryPulse
477-
run: swift test
478-
479-
- name: Archiving Raw Logs
480-
uses: actions/upload-artifact@v6
481-
if: ${{ failure() || cancelled() }}
482-
with:
483-
name: raw-output-pulse-integration
484-
path: |
485-
3rd-party-integrations/SentryPulse/.build/**/*.log
486-
487-
- name: Run CI Diagnostics
488-
if: failure()
489-
run: ./scripts/ci-diagnostics.sh
490-
491363
# This check validates that either all unit tests passed or were skipped, which allows us
492364
# to make unit tests a required check with only running the unit tests when required.
493365
# So, we don't have to run unit tests, for example, for Changelog or ReadMe changes.
@@ -499,10 +371,6 @@ jobs:
499371
build-test-server,
500372
distribution-tests,
501373
unit-tests,
502-
swiftlog-integration-unit-tests,
503-
swiftybeaver-integration-unit-tests,
504-
cocoalumberjack-integration-unit-tests,
505-
pulse-integration-unit-tests,
506374
ready-to-merge-gate,
507375
unit-tests-with-test-server,
508376
]

0 commit comments

Comments
 (0)