blob: f24dbed67317077ac1a10c7e609257a31baa0f46 [file] [log] [blame]
# 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
check:
description: What to check for in the PR health check - any of "version,changelog,license,coverage,breaking,do-not-submit,leaking"
type: string
required: true
fail_on:
description: Which checks should lead to failure - any subset of "version,changelog,license,coverage,breaking,do-not-submit,leaking"
default: "version,changelog,do-not-submit"
type: string
required: false
warn_on:
description: Which checks should not fail, but only warn - any subset of "version,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
use-flutter:
description: Whether to setup Flutter in this workflow.
default: false
required: false
type: boolean
ignore_license:
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_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
# These permissions are required for us to create comments on PRs.
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
with:
path: current_repo/
submodules: ${{ inputs.checkout_submodules }}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
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: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
if: ${{ inputs.use-flutter }}
with:
channel: ${{ inputs.sdk }}
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
if: ${{ !inputs.use-flutter }}
with:
sdk: ${{ inputs.sdk }}
- name: Install coverage
run: dart pub global activate coverage
if: ${{ inputs.check == 'coverage' }}
- name: Install firehose
run: dart pub global activate 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: Install api_tool
run: dart pub global activate dart_apitool
if: ${{ inputs.check == 'breaking' || inputs.check == 'leaking' }}
- 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 }} \
--ignore_license ${{ inputs.ignore_license }} \
--ignore_coverage ${{ inputs.ignore_coverage }} \
--ignore_packages ${{ inputs.ignore_packages }} \
--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@643bc377ffa44ace6394b2b5d0d3950076de9f63
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@65462800fd760344b1a7b4382951275a0abb4808
with:
name: comment-${{ inputs.check }}
path: current_repo/output/comment.md