-
Notifications
You must be signed in to change notification settings - Fork 0
215 lines (193 loc) · 6.49 KB
/
ci.yml
File metadata and controls
215 lines (193 loc) · 6.49 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# Default token permissions — dorny/paths-filter calls the PR Files API to
# compute the diff, which needs pull-requests: read. contents: read covers
# actions/checkout for both push and pull_request events.
permissions:
contents: read
pull-requests: read
# Cancel superseded runs on the same ref (PR pushes, branch updates).
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
changes:
name: Detect Changed Areas
runs-on: ubuntu-latest
outputs:
android: ${{ steps.filter.outputs.android }}
swift: ${{ steps.filter.outputs.swift }}
reactNative: ${{ steps.filter.outputs.reactNative }}
web: ${{ steps.filter.outputs.web }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: filter
with:
filters: |
android:
- 'platforms/android/**'
- 'protocol/**'
- '.github/workflows/android-test.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
swift:
- 'platforms/swift/**'
- 'protocol/**'
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/swift-test-package.yml'
- '.github/workflows/swift-build-samples.yml'
- '.github/workflows/swift-test-workflow.yml'
- '.github/workflows/swift-lint.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
reactNative:
- 'platforms/react-native/**'
- 'platforms/swift/**'
- 'platforms/android/**'
- 'protocol/**'
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/rn-test.yml'
- '.github/workflows/rn-test-android.yml'
- '.github/workflows/rn-test-ios.yml'
- '.github/workflows/rn-build-android.yml'
- '.github/workflows/rn-build-ios.yml'
- '.github/workflows/rn-check-packed-files.yml'
- '.github/workflows/rn-lint.yml'
- '.github/workflows/rn-publish.yml'
- '.github/workflows/release.yml'
- '.github/scripts/package-json-version'
- '.github/scripts/validate-release-version'
- '.github/actions/setup/**'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
web:
- 'platforms/web/**'
- '.github/workflows/web.yml'
- '.github/actions/setup/**'
- '.github/workflows/ci.yml'
android-test:
name: Android
needs: changes
if: needs.changes.outputs.android == 'true'
uses: ./.github/workflows/android-test.yml
swift-test-package:
name: Swift
needs: changes
if: needs.changes.outputs.swift == 'true'
uses: ./.github/workflows/swift-test-package.yml
swift-build-samples:
name: Swift
needs: changes
if: needs.changes.outputs.swift == 'true'
uses: ./.github/workflows/swift-build-samples.yml
swift-lint:
name: Swift
needs: changes
if: needs.changes.outputs.swift == 'true'
uses: ./.github/workflows/swift-lint.yml
rn-test:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/rn-test.yml
rn-test-android:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-test-android.yml
rn-test-ios:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-test-ios.yml
rn-build-android:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-build-android.yml
rn-build-ios:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-build-ios.yml
rn-check-packed-files:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-check-packed-files.yml
rn-lint:
name: React Native
needs: changes
if: needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/rn-lint.yml
web:
name: Web
needs: changes
if: needs.changes.outputs.web == 'true'
permissions:
contents: read
pull-requests: write
uses: ./.github/workflows/web.yml
breaking-changes:
name: Breaking Changes
needs: changes
if: |
needs.changes.outputs.swift == 'true' ||
needs.changes.outputs.android == 'true' ||
needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/breaking-changes.yml
with:
swift: ${{ needs.changes.outputs.swift }}
android: ${{ needs.changes.outputs.android }}
react-native: ${{ needs.changes.outputs.reactNative }}
# Single required status check for branch protection.
# Passes when every relevant platform job either succeeded or was skipped
# because no files in that platform's tree changed.
ci-required:
name: CI Required
if: always()
needs:
- changes
- android-test
- swift-test-package
- swift-build-samples
- swift-lint
- rn-test
- rn-test-android
- rn-test-ios
- rn-build-android
- rn-build-ios
- rn-check-packed-files
- rn-lint
- web
- breaking-changes
runs-on: ubuntu-latest
steps:
- name: Verify all upstream jobs succeeded or were skipped
env:
NEEDS_JSON: ${{ toJSON(needs) }}
run: |
echo "Upstream job results:"
echo "$NEEDS_JSON" | jq '.'
failed=$(echo "$NEEDS_JSON" | jq -r '
to_entries
| map(select(.value.result == "failure" or .value.result == "cancelled"))
| .[].key
')
if [ -n "$failed" ]; then
echo "::error::Required jobs failed or were cancelled:"
echo "$failed" | sed 's/^/ - /'
exit 1
fi
echo "All required jobs passed (or were skipped because no relevant files changed)."