Skip to content

Commit

Permalink
ci: Enable coverage on main and all PRs (#2533)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
olix0r authored Nov 18, 2023
1 parent 8da6421 commit 6f8c616
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
34 changes: 30 additions & 4 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 20 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6f8c616

Please sign in to comment.