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