From 6f8c616606b5de1432d913b13765fff6595cdbeb Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Fri, 17 Nov 2023 16:24:11 -0800 Subject: [PATCH] ci: Enable coverage on main and all PRs (#2533) In preparation for some larger changes to the proxy, this change enables codecov on main and on PRs that change code. We need to run coverage on main so that PRs have a meaningful comparison point. We use the styfle/cancel-workflow-action to prevent multiple runs from clogging up Actions Runners. We can adapt this configuration if it's too annoying, but it seems low risk to add for now. --- .codecov.yml | 34 ++++++++++++++++++++++++++++++---- .github/workflows/coverage.yml | 23 ++++++++++++++++++++--- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/.codecov.yml b/.codecov.yml index 97697e132f..38facf2e17 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,8 +1,34 @@ +codecov: + ignore: + - "linkerd/app/integration/src/**" + - "**/src/gen/**" + - "tools/**" + coverage: - # Disable statuses until we sort out coverage more broadly. This is noisy as - # it is. + precision: 2 + round: down + range: "70...100" + status: project: - default: false + default: + target: auto + threshold: 2% + if_not_found: success + if_ci_failed: error + paths: + - "!linkerd/app/integration/src/**" + - "!**/src/gen/**" + - "!tools/**" + patch: - default: false + default: + target: auto + threshold: 1% + if_not_found: success + if_ci_failed: error + +comment: + layout: "header, diff, files, footer" + behavior: default + require_changes: false diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index dced3f5aed..197bd28aff 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -4,13 +4,18 @@ permissions: contents: read on: + # We run coverage on main so that PRs can have a meaninful comparison that + # doesn't lag a whole day. + push: + branches: + - main + + # Coverage runs on all code changes (as well as changes to the workflow). pull_request: paths: - .codecov.yml - .github/workflows/coverage.yml - schedule: - # Run daily at 11AM UTC (3AM PST). - - cron: '0 11 * * *' + - '**/*.rs' env: CARGO_INCREMENTAL: 0 @@ -19,6 +24,18 @@ env: RUSTUP_MAX_RETRIES: 10 jobs: + # Cancel any previous runs of this workflow so coverage runs don't back up, + # especially on main (i.e. after merging several PRs). + cleanup: + runs-on: ubuntu-latest + permissions: + actions: write + steps: + - uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 + with: + all_but_latest: true + access_token: ${{ github.token }} + test: name: codecov runs-on: ubuntu-latest