-
Notifications
You must be signed in to change notification settings - Fork 7
198 lines (179 loc) · 7.08 KB
/
health_base.yaml
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
# A CI configuration to check PR health.
name: Health:Base
# The workflow doing the checks for `health.yaml`. Not meant to be used externally.
on:
workflow_call:
inputs:
sdk:
description: >-
The channel, or a specific version from a channel, to install
('2.19.0','stable', 'beta', 'dev'). Using one of the three channels
will give you the latest version published to that channel.
default: "stable"
required: false
type: string
channel:
description: >-
The channel, or a specific version from a channel, to install
('2.19.0','stable', 'beta', 'dev'). Using one of the three named channels
will give you the latest version published to that channel.
default: "stable"
required: false
type: string
check:
description: What to check for in the PR health check - any of "changelog,license,coverage,breaking,do-not-submit,leaking"
type: string
required: true
fail_on:
description: Which checks should lead to failure - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking"
default: "changelog,do-not-submit"
type: string
required: false
warn_on:
description: Which checks should not fail, but only warn - any subset of "changelog,license,coverage,breaking,do-not-submit,leaking"
default: "license,coverage,breaking,leaking"
type: string
required: false
local_debug:
description: Whether to use a local copy of package:firehose - only for debug
default: false
type: boolean
required: false
upload_coverage:
description: Whether to upload the coverage to coveralls
default: true
type: boolean
required: false
coverage_web:
description: Whether to run `dart test -p chrome` for coverage
default: false
type: boolean
required: false
flutter_packages:
description: List of packages depending on Flutter.
default: "\"\""
required: false
type: string
ignore_license:
description: Which files to ignore for the license check.
default: "\"\""
required: false
type: string
ignore_changelog:
description: Which files to ignore for the license check.
default: "\"\""
required: false
type: string
ignore_coverage:
description: Which files to ignore for the coverage check.
default: "\"\""
required: false
type: string
ignore_breaking:
description: Which files to ignore for the license check.
default: "\"\""
required: false
type: string
ignore_leaking:
description: Which files to ignore for the license check.
default: "\"\""
required: false
type: string
ignore_donotsubmit:
description: Which files to ignore for the license check.
default: "\"\""
required: false
type: string
ignore_packages:
description: Which packages to ignore.
default: "\"\""
required: false
type: string
checkout_submodules:
description: Whether to checkout submodules of git repositories.
default: false
required: false
type: boolean
experiments:
description: Which experiments should be enabled for Dart.
default: "\"\""
type: string
required: false
jobs:
health:
name: run ${{ inputs.check }} health check
# These permissions are required for us to create comments on PRs.
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
path: current_repo/
submodules: ${{ inputs.checkout_submodules }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
ref: ${{ github.event.pull_request.base.ref }}
path: base_repo/
submodules: ${{ inputs.checkout_submodules }}
if: ${{ inputs.check == 'coverage' }} || ${{ inputs.check == 'breaking' }}
- run: mkdir -p current_repo/output/
- uses: dart-lang/setup-dart@e51d8e571e22473a2ddebf0ef8a2123f0ab2c02c
with:
sdk: ${{ inputs.sdk }}
- uses: subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff
if: ${{ inputs.flutter_packages != '' }}
with:
channel: ${{ inputs.channel }}
- name: Check Dart installs whereis
run: whereis dart
- name: Check Dart installs which
run: which dart
- name: Install coverage
run: dart pub global activate coverage
if: ${{ inputs.check == 'coverage' }}
- name: Install firehose
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
if: ${{ !inputs.local_debug }}
- name: Install local firehose
run: dart pub global activate --source path current_repo/pkgs/firehose/
if: ${{ inputs.local_debug }}
- name: Check PR health
id: healthstep
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.number }}
PR_LABELS: "${{ join(github.event.pull_request.labels.*.name) }}"
run: |
cd current_repo/
dart pub global run firehose:health \
--check ${{ inputs.check }} \
${{ fromJSON('{"true":"--coverage_web","false":""}')[inputs.coverage_web] }} \
--fail_on ${{ inputs.fail_on }} \
--warn_on ${{ inputs.warn_on }} \
--flutter_packages ${{ inputs.flutter_packages }} \
--ignore_packages ${{ inputs.ignore_packages }} \
--ignore_license ${{ inputs.ignore_license }} \
--ignore_changelog ${{ inputs.ignore_changelog }} \
--ignore_coverage ${{ inputs.ignore_coverage }} \
--ignore_breaking ${{ inputs.ignore_breaking }} \
--ignore_leaking ${{ inputs.ignore_leaking }} \
--ignore_donotsubmit ${{ inputs.ignore_donotsubmit }} \
--experiments ${{ inputs.experiments }}
- run: test -f current_repo/output/comment.md || echo $'The ${{ inputs.check }} workflow has encountered an exception and did not complete.' >> current_repo/output/comment.md
if: ${{ '$action_state' == 1 }}
- name: Upload coverage to Coveralls
if: ${{ inputs.upload_coverage && inputs.check == 'coverage' }}
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b
with:
format: lcov
base-path: current_repo/
compare-sha: ${{ github.event.pull_request.base.ref }}
allow-empty: true
- name: Upload markdown
if: success() || failure()
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
with:
name: comment-${{ inputs.check }}
path: current_repo/output/comment.md