-
Notifications
You must be signed in to change notification settings - Fork 470
237 lines (213 loc) · 10 KB
/
build-and-test-pr.yml
File metadata and controls
237 lines (213 loc) · 10 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: "[All Platforms] - Build and Test - PR"
on:
merge_group:
types: [checks_requested]
pull_request: ~
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name != 'develop' && github.ref || github.run_id }}
cancel-in-progress: true
permissions:
id-token: write
contents: read
pull-requests: write
actions: write
jobs:
pre_job:
name: "Skip Check"
if: ${{!github.event.pull_request.head.repo.fork}}
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip == 'true' || steps.smartling_check.outputs.should_skip == 'true' }}
env:
IS_SMARTLING: ${{ startsWith(github.event.pull_request.head.ref, 'smartling-content-updated') == true || startsWith(github.event.pull_request.head.ref, 'smartling-translation-completed') == true}}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: "never"
skip_after_successful_duplicate: "true"
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
- id: smartling_check
if: ${{ env.IS_SMARTLING == 'true' }}
run: |
echo "should_skip=true" >> $GITHUB_OUTPUT
gh pr close ${{ github.event.pull_request.number }} -R LedgerHQ/ledger-live
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
determine-affected:
name: "Affected"
needs: pre_job
if: ${{!github.event.pull_request.head.repo.fork && needs.pre_job.outputs.should_skip != 'true'}}
uses: LedgerHQ/ledger-live/.github/workflows/nx-affected-reusable.yml@develop
with:
head_branch: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
base_branch: ${{ github.event.pull_request.base.ref || github.event.merge_group.base_ref }}
# LLD
build-desktop:
name: "Build Desktop"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-desktop') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/build-desktop-reusable.yml@develop
secrets: inherit
test-desktop:
name: "Test Desktop"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-desktop') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-desktop-reusable.yml@develop
secrets: inherit
test-mobile:
name: "Test Mobile"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-mobile') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-mobile-reusable.yml@develop
secrets: inherit
build-test-mobile:
name: "Build & Test Mobile"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'ledger-live-mobile') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-mobile-mock-reusable.yml@develop
secrets: inherit
with:
macos-specificity-runner-label: "performance-pool"
skip-pod-checks: "false"
# Tests
test-libraries:
name: "Test Libraries"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'libs') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-libs-reusable.yml@develop
secrets: inherit
test-features:
name: "Test Features"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'features') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-features-reusable.yml@develop
secrets: inherit
test-shared:
name: "Test Shared"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'shared') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-shared-reusable.yml@develop
secrets: inherit
test-domain:
name: "Test Domain"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'domain') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-domain-reusable.yml@develop
secrets: inherit
test-devtools:
name: "Test DevTools"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'devtools') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-devtools-reusable.yml@develop
secrets: inherit
enforce-boundaries:
name: "Enforce Module Boundaries"
needs: determine-affected
if: ${{(contains(needs.determine-affected.outputs.paths, 'domain') || contains(needs.determine-affected.outputs.paths, 'shared') || contains(needs.determine-affected.outputs.paths, 'features')) && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-boundaries-reusable.yml@develop
secrets: inherit
test-design-system:
name: "Test UI Libs"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'libs/ui') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-design-system-reusable.yml@develop
secrets: inherit
build-web-tools:
name: "Build Web Tools"
needs: determine-affected
if: ${{!github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/build-web-tools-reusable.yml@develop
secrets: inherit
with:
build-web-tools: ${{ contains(needs.determine-affected.outputs.paths, 'apps/web-tools') }}
build-native-storybook: ${{ contains(needs.determine-affected.outputs.paths, 'libs/ui/packages/native') }}
build-react-storybook: ${{ contains(needs.determine-affected.outputs.paths, 'libs/ui/packages/react') }}
test-cli:
name: "Test CLI"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'apps/cli') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-cli-reusable.yml@develop
secrets: inherit
build-wallet-cli:
name: "Build Wallet CLI"
needs: determine-affected
if: ${{contains(needs.determine-affected.outputs.paths, 'wallet-cli') && !github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/build-wallet-cli-reusable.yml@develop
secrets: inherit
test-additional:
name: "Test Additional"
if: ${{!github.event.pull_request.head.repo.fork}}
uses: LedgerHQ/ledger-live/.github/workflows/test-additional.yml@develop
secrets: inherit
test-mobile-e2e-lint:
name: "Mobile E2E Lint & Typecheck"
needs: determine-affected
if: ${{!github.event.pull_request.head.repo.fork && (contains(needs.determine-affected.outputs.paths, 'e2e/mobile') || contains(needs.determine-affected.outputs.paths, 'apps/ledger-live-mobile'))}}
uses: LedgerHQ/ledger-live/.github/workflows/test-mobile-e2e-lint-reusable.yml@develop
secrets: inherit
test-desktop-e2e-lint:
name: "Desktop E2E Lint & Typecheck"
needs: determine-affected
if: ${{!github.event.pull_request.head.repo.fork && contains(needs.determine-affected.outputs.paths, 'e2e/desktop')}}
uses: LedgerHQ/ledger-live/.github/workflows/test-desktop-e2e-lint-reusable.yml@develop
secrets: inherit
notify-e2e-required:
name: "Notify E2E Required"
needs: determine-affected
if: ${{ always() && needs.determine-affected.result == 'success' && github.event_name == 'pull_request' && github.event.pull_request.draft == false && !github.event.pull_request.head.repo.fork }}
uses: LedgerHQ/ledger-live/.github/workflows/notify-e2e-required-reusable.yml@develop
secrets: inherit
with:
affected_paths: ${{ needs.determine-affected.outputs.paths }}
scan-sonar:
name: "Sonar Cloud"
needs:
- test-desktop
- test-mobile
- test-libraries
- test-features
- test-shared
- test-domain
- test-devtools
- build-wallet-cli
- determine-affected
uses: LedgerHQ/ledger-live/.github/workflows/scan-sonar-reusable.yml@develop
if: ${{ always() && !cancelled() && !github.event.pull_request.head.repo.fork && (needs.test-desktop.result == 'success' || needs.test-mobile.result == 'success' || needs.test-libraries.result == 'success' || needs.test-features.result == 'success' || needs.test-shared.result == 'success' || needs.test-domain.result == 'success' || needs.test-devtools.result == 'success' || needs.build-wallet-cli.result == 'success' || contains(needs.determine-affected.outputs.paths, 'e2e')) }}
secrets: inherit
with:
should_download_desktop_coverage: ${{ needs.test-desktop.outputs.coverage_generated }}
should_download_mobile_coverage: ${{ needs.test-mobile.outputs.coverage_generated }}
should_download_libs_coverage: ${{ needs.test-libraries.outputs.coverage_generated }}
should_download_features_coverage: ${{ needs.test-features.outputs.coverage_generated }}
should_download_shared_coverage: ${{ needs.test-shared.outputs.coverage_generated }}
should_download_domain_coverage: ${{ needs.test-domain.outputs.coverage_generated }}
should_download_devtools_coverage: ${{ needs.test-devtools.outputs.coverage_generated }}
should_download_wallet_cli_coverage: ${{ needs.build-wallet-cli.outputs.coverage_generated }}
# Final Check required
ok:
name: "OK"
needs:
- build-desktop
- test-desktop
- test-mobile
- build-test-mobile
- test-libraries
- test-features
- test-shared
- test-domain
- test-devtools
- test-design-system
- build-web-tools
- test-cli
- build-wallet-cli
- test-additional
- test-mobile-e2e-lint
- test-desktop-e2e-lint
- determine-affected
runs-on: ubuntu-22.04
if: always() && !cancelled() && needs.determine-affected.result == 'success'
steps:
- name: Check result
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1