Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a health checking workflow #115

Merged
merged 49 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
89fe982
add health workflow
mosuem Jun 26, 2023
6e742fd
add health check
mosuem Jun 26, 2023
19a3af0
Add license check
mosuem Jun 26, 2023
1041bcf
Add unified comment
mosuem Jun 26, 2023
6564e35
Add health check
mosuem Jun 26, 2023
48d7ec4
dart pub global run mono_repo generate
mosuem Jun 26, 2023
70ba1f8
Add internal on
mosuem Jun 26, 2023
1a713d5
Add firehose version
mosuem Jun 26, 2023
3155c11
Add health tag
mosuem Jun 26, 2023
d955882
switch to branch name
mosuem Jun 26, 2023
7a62eb1
Switch to different tag to not delete comment
mosuem Jun 26, 2023
d82ef8d
Fix formatting
mosuem Jun 26, 2023
f639c64
Switch to different tag
mosuem Jun 26, 2023
4598ff5
Remove "great..." message
mosuem Jun 26, 2023
8322a86
Details on error
mosuem Jun 26, 2023
61a5b90
fix formatting in details
mosuem Jun 26, 2023
6f8bc33
fix formatting in details 2
mosuem Jun 26, 2023
a354b99
Add changelog check
mosuem Jun 26, 2023
a154ffd
add line breaks to paths in changelog
mosuem Jun 26, 2023
0fd3207
add line breaks to paths in changelog 2
mosuem Jun 26, 2023
1ceb3bd
Add changelog entry
mosuem Jun 26, 2023
73268a7
Add debug info
mosuem Jun 26, 2023
7e4070f
add debug msg
mosuem Jun 26, 2023
45677fc
Remove debug messages
mosuem Jun 26, 2023
d69dae8
Remove debug messages 2
mosuem Jun 26, 2023
fd1b4fc
Remove changelog entry
mosuem Jun 26, 2023
064fecc
Add new file
mosuem Jun 26, 2023
02b4ba4
Add file_licenser to health check
mosuem Jun 26, 2023
8a766ba
Remove license from test file again
mosuem Jun 26, 2023
70a10a4
Remove unnecessary stuff from workflow
mosuem Jun 26, 2023
a369c7f
Add messages for stdout
mosuem Jun 26, 2023
4e4af6a
Switch internal to ref
mosuem Jun 26, 2023
9cb02eb
use local
mosuem Jun 26, 2023
e7a767f
add branch
mosuem Jun 26, 2023
a4ec966
Rename workflow
mosuem Jun 26, 2023
70c675d
Fix typo...
mosuem Jun 26, 2023
7069c47
Make configurable
mosuem Jun 26, 2023
c655a7b
Add stdout
mosuem Jun 26, 2023
87db683
Remove spaces
mosuem Jun 26, 2023
dea4ea6
Add arg
mosuem Jun 26, 2023
eb4f344
Tweak docs
mosuem Jun 26, 2023
2e9105b
Fix copy-paste typo
mosuem Jun 26, 2023
cb4b5ce
Switch `open` to details
mosuem Jun 26, 2023
b77ae4f
dart pub global run mono_repo generate (#116)
devoncarew Jun 27, 2023
18516b6
Changes as per review
mosuem Jun 27, 2023
06ccaba
Add description in readme
mosuem Jun 27, 2023
a52531d
add main to fake test
mosuem Jun 27, 2023
94b1ef1
Add changelog entry + version rev
mosuem Jun 27, 2023
3ebe9d3
Remove empty test
mosuem Jun 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 95 additions & 64 deletions .github/workflows/dart.yml

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions .github/workflows/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# A CI configuration to check PR health.

name: Health

# Callers of this workflow should use it as follows:
#
# name: Health
mosuem marked this conversation as resolved.
Show resolved Hide resolved
# on:
# pull_request:
# branches: [ main ]
# types: [opened, synchronize, reopened, labeled, unlabeled]
# jobs:
# health:
# uses: dart-lang/ecosystem/.github/workflows/health.yaml@main

# Callers may optionally specify the version of the SDK to use when publishing a
mosuem marked this conversation as resolved.
Show resolved Hide resolved
# package. This can be useful if your package has a very recent minimum SDK
# constraint. This is done via the `sdk` input parameter. Note that this
# parameter is not required; it defaults to `stable` - using the most recent
# stable release of the Dart SDK.
# The checks can also be restricted to any subset of version, changelog, and license,
mosuem marked this conversation as resolved.
Show resolved Hide resolved
# if needed.
#
# jobs:
# health:
# uses: dart-lang/ecosystem/.github/workflows/health.yaml@main
# with:
# sdk: beta
# checks: "version,changelog,license"

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
checks:
description: What to check for in the PR health check - any subset of "version,changelog,license"
default: "version,changelog,license"
type: string
required: false

jobs:
health:
# These permissions are required for authentication using OIDC and to enable
mosuem marked this conversation as resolved.
Show resolved Hide resolved
# us to create comments on PRs.
permissions:
pull-requests: write

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
with:
sdk: ${{ inputs.sdk }}

- name: Install firehose
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem.git --git-path pkgs/firehose/ --git-ref=unifiedWorkflow #TODO remove, just for testing

- name: Validate packages
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: dart pub global run firehose --health ${{ inputs.checks }}
12 changes: 12 additions & 0 deletions .github/workflows/health_internal.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# A CI configuration to check PR health.

name: Health
on:
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
health:
uses: ./.github/workflows/health.yaml
with:
checks: "changelog,license"
14 changes: 11 additions & 3 deletions pkgs/firehose/bin/firehose.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ void main(List<String> arguments) async {

var validate = argResults['validate'] == true;
var publish = argResults['publish'] == true;
var health = argResults['health'] != null;
mosuem marked this conversation as resolved.
Show resolved Hide resolved

if (!validate && !publish) {
_usage(argParser,
error: 'Error: one of --validate or --publish must be specified.');
if (!validate && !publish && !health) {
_usage(argParser, error: '''
Error: one of --validate, --publish, or --health must be specified.''');
exit(1);
}

Expand All @@ -41,6 +42,8 @@ void main(List<String> arguments) async {
await firehose.validate();
} else if (publish) {
await firehose.publish();
} else if (health) {
await firehose.healthCheck(argResults['health'] as List);
}
} on ArgParserException catch (e) {
_usage(argParser, error: e.message);
Expand Down Expand Up @@ -73,6 +76,11 @@ ArgParser _createArgs() {
help: 'Validate packages and indicate whether --publish would publish '
'anything.',
)
..addMultiOption(
'health',
defaultsTo: ['version', 'license', 'changelog'],
help: 'Check PR health.',
)
..addFlag(
'publish',
negatable: false,
Expand Down
Loading
Loading