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

ci: Fix codecov uploads #27278

Merged
merged 14 commits into from
Feb 14, 2024
57 changes: 42 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -373,35 +373,48 @@ jobs:
./coverage/lcov
./coverage/json

coverage:
codecov:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 3
if: (success() || failure()) && github.event.pull_request.draft != true
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
sparse-checkout: ${{ env.SPARSE_CHECKOUT }}

- name: Download coverage reports
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: coverage
path: coverage

- name: Codecov
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
viceice marked this conversation as resolved.
Show resolved Hide resolved
with:
directory: coverage/lcov
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
viceice marked this conversation as resolved.
Show resolved Hide resolved

coverage-threshold:
needs: [test]
viceice marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
timeout-minutes: 3
if: (success() || failure()) && github.event.pull_request.draft != true
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
sparse-checkout: ${{ env.SPARSE_CHECKOUT }}
zharinov marked this conversation as resolved.
Show resolved Hide resolved

- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
node-version: ${{ env.NODE_VERSION }}
os: ${{ runner.os }}

- name: Download coverage reports
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: coverage
path: coverage

- name: Merge coverage reports
run: pnpm nyc merge ./coverage/json ./coverage/nyc/coverage.json

Expand All @@ -418,7 +431,7 @@ jobs:

# Catch-all required check for test matrix and coverage
test-success:
needs: [setup, test, coverage]
needs: [setup, test, codecov, coverage-threshold]
viceice marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
timeout-minutes: 1
if: always()
Expand All @@ -436,17 +449,30 @@ jobs:
needs.test.result == 'skipped'
run: exit 1

- name: Fail for failed or cancelled coverage
- name: Fail for failed or cancelled codecov
if: |
needs.codecov.result == 'failure' ||
needs.codecov.result == 'cancelled'
run: exit 1

- name: Fail for skipped codecov when PR is ready for review
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.draft != true &&
needs.codecov.result == 'skipped'
run: exit 1

- name: Fail for failed or cancelled coverage-threshold
if: |
needs.coverage.result == 'failure' ||
needs.coverage.result == 'cancelled'
needs.coverage-threshold.result == 'failure' ||
needs.coverage-threshold.result == 'cancelled'
run: exit 1

- name: Fail for skipped coverage when PR is ready for review
- name: Fail for skipped coverage-threshold when PR is ready for review
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.draft != true &&
needs.coverage.result == 'skipped'
needs.coverage-threshold.result == 'skipped'
run: exit 1

build:
Expand Down Expand Up @@ -546,7 +572,8 @@ jobs:
- test-e2e
- test-success
- build-docs
- coverage
- codecov
- coverage-threshold

if: github.repository == 'renovatebot/renovate' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
Expand Down
Loading