-
Notifications
You must be signed in to change notification settings - Fork 128
363 lines (348 loc) · 14.1 KB
/
shopify-cli.yml
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
name: shopify-cli
on:
workflow_dispatch:
inputs:
branch-name:
type: string
description: 'Branch'
required: true
default: 'main'
node-version:
description: 'Node version'
required: true
default: '18.20.3'
type: choice
options:
- 18.20.3
- 20.14.0
- 22.2.0
os:
description: 'Operating system'
required: true
default: 'ubuntu-latest'
type: choice
options:
- ubuntu-latest
- windows-latest
- macos-latest
debug-enabled:
type: boolean
description: 'Enable tmate debugging'
required: true
default: true
push:
branches:
- main
- stable/3.*
pull_request:
merge_group:
concurrency:
group: shopify-cli-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DEBUG: '1'
SHOPIFY_CLI_ENV: development
SHOPIFY_CONFIG: debug
PNPM_VERSION: '8.15.7'
BUNDLE_WITHOUT: 'test:development'
SHOPIFY_FLAG_CLIENT_ID: ${{ secrets.SHOPIFY_FLAG_CLIENT_ID }}
SHOPIFY_CLI_PARTNERS_TOKEN: ${{ secrets.SHOPIFY_CLI_PARTNERS_TOKEN }}
GH_TOKEN: ${{ secrets.SHOPIFY_GH_READ_CONTENT_TOKEN }}
jobs:
main:
name: '[Main] Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node: ['18.20.3', '20.14.0', '22.2.0']
steps:
- uses: actions/checkout@v3
name: Checkout [${{ github.ref_name }}]
with:
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Build
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Lint
run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Type-check
run: pnpm nx run-many --all --skip-nx-cache --target=type-check --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Bundle
run: pnpm nx run-many --all --skip-nx-cache --target=bundle --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Unit tests
run: pnpm nx run-many --all --skip-nx-cache --target=test --exclude=features --output-style=stream
- name: Acceptance tests
if: ${{ matrix.node == '18.20.3' }}
run: pnpm nx run features:test
- name: Send Slack notification on failure
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # pin@v1.23.0
if: failure()
with:
payload: |
{
"build_url": "https://github.com/Shopify/cli/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Run and save test coverage
uses: ./.github/actions/run-and-save-test-coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
with:
branch-name: ${{ github.ref_name }}
pr-platform-agnostic:
name: '[PR] Run ${{ matrix.target }} with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
target: ['build', 'type-check']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: ${{ matrix.target }}
run: pnpm nx run-many --all --skip-nx-cache --target=${{ matrix.target }} --output-style=stream
pr-platform-agnostic-lint:
name: '[PR] Run lint with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Lint
run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream --format=json -o eslint-report.json
continue-on-error: true
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@21a1ba0738d8b732639999029c4ff40b6e121bb4 # pin@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
report-json: "packages/*/eslint-report.json"
pr-platform-agnostic-bundle:
name: '[PR] Run bundle with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: 'Build'
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
- name: 'Bundle'
run: pnpm nx run-many --all --skip-nx-cache --target=bundle --output-style=stream
pr-platform-agnostic-knip:
name: '[PR] Run knip with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Post the knip results
uses: codex-/knip-reporter@1ccefdf649b847793412fbfba286dc0b05defc1e # pin@v2
with:
verbose: true
pr-platform-agnostic-graphql-schema:
name: '[PR] Check graphql-codegen has been run'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 30
strategy:
matrix:
os: ['macos-latest'] # Codegen uses a find command that needs to work on CI and macOS; using the same env keeps this simple
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Get schemas for codegen
run: pnpm graphql-codegen:get-graphql-schemas
- name: Run graphql-codegen
run: pnpm graphql-codegen
- name: Fail if any changes were made
run: 'test -z "$(git status --porcelain)" || { echo -e "Run pnpm graphql-codegen when queries are changed, committing any fixes and generated files" ; exit 1; }'
oclif-checks:
name: '[PR] Check OCLIF manifests & readme & docs'
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: 18.20.3
- name: Build
run: pnpm build --output-style=stream
- name: Refresh manifests
run: pnpm refresh-manifests
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "**/oclif.manifest.json" )" || { echo -e "Run pnpm refresh-manifests before pushing new commands or flags. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Refresh readme
run: pnpm refresh-readme
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "packages/cli/README.md" )" || { echo -e "Run pnpm refresh-readme before pushing new commands or flags. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Refresh documentation
run: pnpm refresh-documentation
- name: Check if there are changes
run: 'test -z "$(git status --porcelain)" || { echo -e "Run pnpm refresh-documentation when you update functions with autogenerated examples. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Build shopify.dev docs
run: pnpm update-docs
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "docs-shopify.dev/generated/*.json" )" || { echo -e "Run (pnpm update-docs) before pushing new commands or flags." ; exit 1; }'
pr-platform-dependent:
name: '[PR] Test with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node: ['18.20.3', '20.14.0', '22.2.0']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Unit tests
run: pnpm test:unit --output-style=stream
pr-acceptance-tests:
name: '[PR] Accept. Test with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Acceptance tests
run: pnpm test:features --output-style=stream
pr-test-coverage:
name: '[PR] Run Test Coverage with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'merge_group') && github.event.pull_request.user.login != 'dependabot[bot]' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Build
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
- name: Run and save test coverage
uses: ./.github/actions/run-and-save-test-coverage
with:
branch-name: '${{ github.head_ref }}'
- name: Download and publish test coverage
uses: ./.github/actions/download-and-publish-test-coverage
with:
base-branch-name: '${{ github.base_ref }}'
manually-triggered:
name: '[Manual] Test with Node ${{ inputs.node-version }} in ${{ inputs.os }}'
runs-on: ${{ inputs.os }}
if: ${{ github.event_name == 'workflow_dispatch' }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch-name }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ inputs.node-version }}
- name: Unit tests
run: pnpm test:unit --output-style=stream
- name: Acceptance tests
run: pnpm test:features --output-style=stream
- name: Setup tmate session
if: ${{ failure() && inputs.debug-enabled }}
uses: mxschmitt/action-tmate@1005f9c9db5f1b055a495e72c6e589764984baf6 # pin@v3
with:
limit-access-to-actor: true