coverage #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is part of Astarte. | |
# | |
# Copyright 2024 SECO Mind Srl | |
# | |
# SPDX-License-Identifier: Apache-2.0 | |
name: coverage | |
defaults: | |
run: | |
shell: bash | |
on: | |
workflow_run: | |
workflows: ["ci"] | |
types: [completed] | |
permissions: | |
contents: read | |
actions: read | |
jobs: | |
upload: | |
runs-on: ubuntu-latest | |
# Run only if originated from a PR | |
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.workflow_run.head_sha }} | |
# Checkout codecov.yaml config from master | |
- uses: actions/checkout@v4 | |
with: | |
path: master | |
sparse-checkout: | | |
.github/codecov.yaml | |
sparse-checkout-cone-mode: false | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
github-token: ${{ github.token }} | |
run-id: ${{ github.event.workflow_run.id }} | |
- name: Get PR number | |
run: | | |
echo "PR_NUMBER=$(cat ./pr_number)" >> "$GITHUB_ENV" | |
- name: Upload to codecov.io | |
uses: codecov/codecov-action@v4 | |
with: | |
codecov_yml_path: master/.github/codecov.yaml | |
token: ${{secrets.CODECOV_TOKEN}} | |
fail_ci_if_error: true | |
override_branch: ${{ github.event.workflow_run.head_branch }} | |
override_commit: ${{ github.event.workflow_run.head_sha }} | |
override_pr: ${{ env.PR_NUMBER }} |