Skip to content

Commit 0bfa654

Browse files
authored
Move publish check to health workflow and use individual package publishing workflows from setup-dart (#454)
1 parent adf7979 commit 0bfa654

17 files changed

Lines changed: 212 additions & 645 deletions

‎.github/workflows/canary.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ jobs:
7373

7474
- name: Install firehose (external)
7575
if: github.repository != 'dart-lang/ecosystem'
76-
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
76+
env:
77+
WORKFLOW_SHA: ${{ job.workflow_sha }}
78+
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/ --git-ref "$WORKFLOW_SHA"
7779

7880
- name: Find Comment
7981
id: fc

‎.github/workflows/health.yaml‎

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ on:
6161
required: false
6262
type: string
6363
checks:
64-
description: What to check for in the PR health check - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies"
65-
default: "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies"
64+
description: What to check for in the PR health check - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies,publish"
65+
default: "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies,publish"
6666
type: string
6767
required: false
6868
fail_on:
69-
description: Which checks should lead to failure - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies"
69+
description: Which checks should lead to failure - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies,publish"
7070
default: "changelog,do-not-submit"
7171
type: string
7272
required: false
7373
warn_on:
74-
description: Which checks should not fail, but only warn - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies"
75-
default: "license,coverage,breaking,leaking,unused-dependencies"
74+
description: Which checks should not fail, but only warn - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies,publish"
75+
default: "license,coverage,breaking,leaking,unused-dependencies,publish"
7676
type: string
7777
required: false
7878
local_debug:
@@ -125,6 +125,11 @@ on:
125125
default: ''
126126
required: false
127127
type: string
128+
ignore_publish:
129+
description: A glob describing which packages to ignore for the publish check.
130+
default: ''
131+
required: false
132+
type: string
128133
ignore_packages:
129134
description: A glob describing which packages to ignore for all checks.
130135
default: ''
@@ -174,7 +179,9 @@ jobs:
174179
run: dart pub global activate --source git "$GIT_URL" --git-path pkgs/firehose/ --git-ref "$GIT_REF"
175180
- name: Install firehose (external)
176181
if: github.repository != 'dart-lang/ecosystem'
177-
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
182+
env:
183+
WORKFLOW_SHA: ${{ job.workflow_sha }}
184+
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/ --git-ref "$WORKFLOW_SHA"
178185
- name: Find Comment
179186
id: fc
180187
env:
@@ -207,6 +214,7 @@ jobs:
207214
with:
208215
sdk: ${{ inputs.sdk }}
209216
check: changelog
217+
order: '02'
210218
fail_on: ${{ inputs.fail_on }}
211219
warn_on: ${{ inputs.warn_on }}
212220
local_debug: ${{ inputs.local_debug }}
@@ -224,6 +232,7 @@ jobs:
224232
with:
225233
sdk: ${{ inputs.sdk }}
226234
check: license
235+
order: '06'
227236
fail_on: ${{ inputs.fail_on }}
228237
warn_on: ${{ inputs.warn_on }}
229238
local_debug: ${{ inputs.local_debug }}
@@ -243,6 +252,7 @@ jobs:
243252
with:
244253
sdk: ${{ inputs.sdk }}
245254
check: coverage
255+
order: '08'
246256
fail_on: ${{ inputs.fail_on }}
247257
warn_on: ${{ inputs.warn_on }}
248258
coverage_web: ${{ inputs.coverage_web }}
@@ -262,6 +272,7 @@ jobs:
262272
with:
263273
sdk: ${{ inputs.sdk }}
264274
check: breaking
275+
order: '03'
265276
fail_on: ${{ inputs.fail_on }}
266277
warn_on: ${{ inputs.warn_on }}
267278
local_debug: ${{ inputs.local_debug }}
@@ -279,6 +290,7 @@ jobs:
279290
with:
280291
sdk: ${{ inputs.sdk }}
281292
check: do-not-submit
293+
order: '07'
282294
fail_on: ${{ inputs.fail_on }}
283295
warn_on: ${{ inputs.warn_on }}
284296
local_debug: ${{ inputs.local_debug }}
@@ -296,6 +308,7 @@ jobs:
296308
with:
297309
sdk: ${{ inputs.sdk }}
298310
check: leaking
311+
order: '04'
299312
fail_on: ${{ inputs.fail_on }}
300313
warn_on: ${{ inputs.warn_on }}
301314
local_debug: ${{ inputs.local_debug }}
@@ -313,16 +326,35 @@ jobs:
313326
with:
314327
sdk: ${{ inputs.sdk }}
315328
check: unused-dependencies
329+
order: '05'
330+
fail_on: ${{ inputs.fail_on }}
331+
warn_on: ${{ inputs.warn_on }}
332+
local_debug: ${{ inputs.local_debug }}
333+
flutter_packages: ${{ inputs.flutter_packages }}
334+
ignore_packages: ${{ inputs.ignore_packages }}
335+
checkout_submodules: ${{ inputs.checkout_submodules }}
336+
health_yaml_name: ${{ inputs.health_yaml_name }}
337+
338+
publish:
339+
if: ${{ contains(inputs.checks, 'publish') }}
340+
permissions:
341+
pull-requests: write
342+
uses: ./.github/workflows/health_base.yaml
343+
with:
344+
sdk: ${{ inputs.sdk }}
345+
check: publish
346+
order: '01'
316347
fail_on: ${{ inputs.fail_on }}
317348
warn_on: ${{ inputs.warn_on }}
318349
local_debug: ${{ inputs.local_debug }}
319350
flutter_packages: ${{ inputs.flutter_packages }}
351+
ignore_publish: ${{ inputs.ignore_publish }}
320352
ignore_packages: ${{ inputs.ignore_packages }}
321353
checkout_submodules: ${{ inputs.checkout_submodules }}
322354
health_yaml_name: ${{ inputs.health_yaml_name }}
323355

324356
comment:
325-
needs: [changelog, license, coverage, breaking, do-not-submit, leaking, unused-dependencies]
357+
needs: [changelog, license, coverage, breaking, do-not-submit, leaking, unused-dependencies, publish]
326358
if: always()
327359
# These permissions are required for us to create comments on PRs.
328360
permissions:
@@ -340,7 +372,9 @@ jobs:
340372
run: dart pub global activate --source git "$GIT_URL" --git-path pkgs/firehose/ --git-ref "$GIT_REF"
341373
- name: Install firehose (external)
342374
if: github.repository != 'dart-lang/ecosystem'
343-
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
375+
env:
376+
WORKFLOW_SHA: ${{ job.workflow_sha }}
377+
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/ --git-ref "$WORKFLOW_SHA"
344378
- name: Download All Artifacts
345379
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
346380
with:
@@ -361,10 +395,12 @@ jobs:
361395
env:
362396
ISSUE_NUMBER: ${{ github.event.number }}
363397
run: |
364-
mkdir output
365-
echo $'## PR Health\n\n' >> output/comment.md
366-
find single-comments -name '*.md' -exec cat {} + >> output/comment.md
367-
echo "$ISSUE_NUMBER" > output/issueNumber
398+
mkdir -p output
399+
echo $'## PR Health\n\n' >> output/comment.md
400+
for file in $(find single-comments -name '*.md' | sort); do
401+
cat "$file" >> output/comment.md
402+
done
403+
echo "$ISSUE_NUMBER" > output/issueNumber
368404
369405
- name: Write comment id to file
370406
if: ${{ steps.fc.outputs.comment-id != 0 }}

‎.github/workflows/health_base.yaml‎

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ on:
6666
default: ''
6767
required: false
6868
type: string
69+
ignore_publish:
70+
default: ''
71+
required: false
72+
type: string
6973
ignore_packages:
7074
default: ''
7175
required: false
@@ -90,6 +94,10 @@ on:
9094
default: ''
9195
required: false
9296
type: string
97+
order:
98+
default: '99'
99+
required: false
100+
type: string
93101

94102
jobs:
95103
health:
@@ -151,7 +159,9 @@ jobs:
151159

152160
- name: Install firehose (external)
153161
if: ${{ !inputs.local_debug && github.repository != 'dart-lang/ecosystem' }}
154-
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
162+
env:
163+
WORKFLOW_SHA: ${{ job.workflow_sha }}
164+
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/ --git-ref "$WORKFLOW_SHA"
155165

156166
- name: Install local firehose
157167
run: dart pub global activate --source path current_repo/pkgs/firehose/
@@ -189,6 +199,7 @@ jobs:
189199
INPUTS_IGNORE_LEAKING: ${{ inputs.ignore_leaking }}
190200
INPUTS_IGNORE_DONOTSUBMIT: ${{ inputs.ignore_donotsubmit }}
191201
INPUTS_IGNORE_UNUSEDDEPENDENCIES: ${{ inputs.ignore_unuseddependencies }}
202+
INPUTS_IGNORE_PUBLISH: ${{ inputs.ignore_publish }}
192203
INPUTS_EXPERIMENTS: ${{ inputs.experiments }}
193204
INPUTS_HEALTH_YAML_NAME: ${{ inputs.health_yaml_name }}
194205
INPUTS_LICENSE: ${{ inputs.license }}
@@ -215,21 +226,33 @@ jobs:
215226
--ignore_leaking "${INPUTS_IGNORE_LEAKING}" \
216227
--ignore_donotsubmit "${INPUTS_IGNORE_DONOTSUBMIT}" \
217228
--ignore_unuseddependencies "${INPUTS_IGNORE_UNUSEDDEPENDENCIES}" \
229+
--ignore_publish "${INPUTS_IGNORE_PUBLISH}" \
218230
--experiments "${INPUTS_EXPERIMENTS}" \
219231
--health_yaml_name "${INPUTS_HEALTH_YAML_NAME}" \
220232
--no-local \
221233
--license "${INPUTS_LICENSE}" \
222234
--license_test_string "${INPUTS_LICENSE_TEST_STRING}"
223235
236+
- name: Rename comment file with order prefix
237+
if: success() || failure()
238+
run: |
239+
if [ -f current_repo/output/comment-${INPUTS_CHECK}.md ]; then
240+
mv current_repo/output/comment-${INPUTS_CHECK}.md current_repo/output/comment-${INPUTS_ORDER}-${INPUTS_CHECK}.md
241+
fi
242+
env:
243+
INPUTS_CHECK: ${{ inputs.check }}
244+
INPUTS_ORDER: ${{ inputs.order }}
245+
224246
- name: Ensure comment file exists
225-
run: test -f current_repo/output/comment-${INPUTS_CHECK}.md || echo $'The ${INPUTS_CHECK} workflow has encountered an exception and did not complete.' >> current_repo/output/comment-${INPUTS_CHECK}.md
247+
run: test -f current_repo/output/comment-${INPUTS_ORDER}-${INPUTS_CHECK}.md || echo $'The ${INPUTS_CHECK} workflow has encountered an exception and did not complete.' >> current_repo/output/comment-${INPUTS_ORDER}-${INPUTS_CHECK}.md
226248
if: failure()
227249
env:
228250
INPUTS_CHECK: ${{ inputs.check }}
251+
INPUTS_ORDER: ${{ inputs.order }}
229252

230253
- name: Upload markdown
231254
if: success() || failure()
232255
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
233256
with:
234-
name: comment-${{ inputs.check }}
235-
path: current_repo/output/comment-${{ inputs.check }}.md
257+
name: comment-${{ inputs.order }}-${{ inputs.check }}
258+
path: current_repo/output/comment-${{ inputs.order }}-${{ inputs.check }}.md

‎.github/workflows/health_internal.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
sdk: dev
1515
local_debug: true
1616
coverage_web: false
17-
checks: changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies
17+
checks: changelog,license,coverage,breaking,do-not-submit,leaking,unused-dependencies,publish
1818
fail_on: changelog,do-not-submit
19-
warn_on: license,coverage,breaking,leaking,unused-dependencies
19+
warn_on: license,coverage,breaking,leaking,unused-dependencies,publish
2020
ignore_license: 'pkgs/firehose/test_data'
2121
ignore_coverage: 'pkgs/firehose/bin,pkgs/firehose/test_data'
2222
ignore_donotsubmit: 'pkgs/firehose/README.md,pkgs/firehose/test_data'

‎.github/workflows/post_summaries.yaml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
workflow_call:
77
workflow_run: # zizmor: ignore[dangerous-triggers]
88
workflows:
9-
- Publish:Internal
109
- Health:Internal
1110
- Canary:Internal
1211
types:

0 commit comments

Comments
 (0)