mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-09 00:26:25 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b1354a6c4 | ||
|
|
2e2a9c6d58 | ||
|
|
cfc521b7a1 | ||
|
|
06425412c8 | ||
|
|
968872560f | ||
|
|
2112eaec1b | ||
|
|
193421c5b3 | ||
|
|
6018df70b0 | ||
|
|
eff1a643d6 | ||
|
|
4582d54fd3 |
22
.github/workflows/main.yml
vendored
22
.github/workflows/main.yml
vendored
@@ -32,8 +32,7 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
|
||||||
flags: demo,${{ matrix.os }}
|
flags: demo,${{ matrix.os }}
|
||||||
name: codecov-demo
|
name: codecov-demo
|
||||||
verbose: true
|
verbose: true
|
||||||
@@ -42,8 +41,7 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
|
||||||
flags: version,${{ matrix.os }}
|
flags: version,${{ matrix.os }}
|
||||||
name: codecov-version
|
name: codecov-version
|
||||||
version: v0.8.0
|
version: v0.8.0
|
||||||
@@ -75,8 +73,7 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
|
||||||
flags: demo,macos-latest-xlarge
|
flags: demo,macos-latest-xlarge
|
||||||
name: codecov-demo
|
name: codecov-demo
|
||||||
verbose: true
|
verbose: true
|
||||||
@@ -85,11 +82,10 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
|
||||||
flags: version,maxos-latest-xlarge
|
flags: version,maxos-latest-xlarge
|
||||||
name: codecov-version
|
name: codecov-version
|
||||||
version: v0.6.0
|
version: v0.8.0
|
||||||
verbose: true
|
verbose: true
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
@@ -115,8 +111,7 @@ jobs:
|
|||||||
- name: Upload coverage to Codecov (demo)
|
- name: Upload coverage to Codecov (demo)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
|
||||||
flags: demo,${{ matrix.os }}
|
flags: demo,${{ matrix.os }}
|
||||||
name: codecov-demo
|
name: codecov-demo
|
||||||
verbose: true
|
verbose: true
|
||||||
@@ -124,10 +119,9 @@ jobs:
|
|||||||
- name: Upload coverage to Codecov (version)
|
- name: Upload coverage to Codecov (version)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json,./coverage/coverage-final.json
|
||||||
file: ./coverage/coverage-final.json
|
|
||||||
flags: version,${{ matrix.os }}
|
flags: version,${{ matrix.os }}
|
||||||
name: codecov-version
|
name: codecov-version
|
||||||
version: v0.6.0
|
version: v0.8.0
|
||||||
verbose: true
|
verbose: true
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -1,10 +1,34 @@
|
|||||||
# Codecov GitHub Action
|
# Codecov GitHub Action
|
||||||
|
|
||||||
[](https://github.com/marketplace/actions/codecov)
|
[](https://github.com/marketplace/actions/codecov)
|
||||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action?ref=badge_shield)
|
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action?ref=badge_shield)
|
||||||
[](https://github.com/codecov/codecov-action/actions/workflows/main.yml)
|
[](https://github.com/codecov/codecov-action/actions/workflows/main.yml)
|
||||||
### Easily upload coverage reports to Codecov from GitHub Actions
|
### Easily upload coverage reports to Codecov from GitHub Actions
|
||||||
|
|
||||||
|
## v5 Release
|
||||||
|
`v5` of the Codecov GitHub Action will use the [Codecov Wrapper](https://github.com/codecov/wrapper) to encapsulate the [CLI](https://github.com/codecov/codecov-cli). This will help ensure that the Action gets updates quicker.
|
||||||
|
|
||||||
|
### Migration Guide
|
||||||
|
The `v5` release also coincides with the opt-out feature for tokens for public repositories. In the `Global Upload Token` section of the settings page of an organization in codecov.io, you can set the ability for Codecov to receive a coverage reports from any source. This will allow contributors or other members of a repository to upload without needing access to the Codecov token. For more details see [how to upload without a token](https://docs.codecov.com/docs/codecov-tokens#uploading-without-a-token).
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> **The following arguments have been changed**
|
||||||
|
> - `file` (this has been deprecated in favor of `files`)
|
||||||
|
> - `plugin` (this has been deprecated in favor of `plugins`)
|
||||||
|
|
||||||
|
The following arguments have been added:
|
||||||
|
|
||||||
|
- `binary`
|
||||||
|
- `gcov_args`
|
||||||
|
- `gcov_executable`
|
||||||
|
- `gcov_ignore`
|
||||||
|
- `gcov_include`
|
||||||
|
- `report_type`
|
||||||
|
- `skip_validation`
|
||||||
|
- `swift_project`
|
||||||
|
|
||||||
|
You can see their usage in the `action.yml` [file](https://github.com/codecov/codecov-action/blob/main/action.yml).
|
||||||
|
|
||||||
## v4 Release
|
## v4 Release
|
||||||
`v4` of the Codecov GitHub Action will use the [Codecov CLI](https://github.com/codecov/codecov-cli) to upload coverage reports to Codecov.
|
`v4` of the Codecov GitHub Action will use the [Codecov CLI](https://github.com/codecov/codecov-cli) to upload coverage reports to Codecov.
|
||||||
|
|
||||||
|
|||||||
35
action.yml
35
action.yml
@@ -7,6 +7,9 @@ inputs:
|
|||||||
binary:
|
binary:
|
||||||
description: 'The file location of a pre-downloaded version of the CLI. If specified, integrity checking will be bypassed.'
|
description: 'The file location of a pre-downloaded version of the CLI. If specified, integrity checking will be bypassed.'
|
||||||
required: false
|
required: false
|
||||||
|
codecov_yml_path:
|
||||||
|
description: 'The location of the codecov.yml file. This is crrently ONLY used for automated test selection (https://docs.codecov.com/docs/getting-started-with-ats). Note that for all other cases, the Codecov yaml will need to be located as described here: https://docs.codecov.com/docs/codecov-yaml#can-i-name-the-file-codecovyml'
|
||||||
|
required: false
|
||||||
commit_parent:
|
commit_parent:
|
||||||
description: 'SHA (with 40 chars) of what should be the parent of this commit.'
|
description: 'SHA (with 40 chars) of what should be the parent of this commit.'
|
||||||
required: false
|
required: false
|
||||||
@@ -105,7 +108,7 @@ inputs:
|
|||||||
report_type:
|
report_type:
|
||||||
description: 'The type of file to upload, coverage by default. Possible values are "testing", "coverage".'
|
description: 'The type of file to upload, coverage by default. Possible values are "testing", "coverage".'
|
||||||
required: false
|
required: false
|
||||||
root_folder:
|
root_dir:
|
||||||
description: 'Root folder from which to consider paths on the network section. Defaults to current working directory.'
|
description: 'Root folder from which to consider paths on the network section. Defaults to current working directory.'
|
||||||
required: false
|
required: false
|
||||||
skip_validation:
|
skip_validation:
|
||||||
@@ -144,14 +147,10 @@ inputs:
|
|||||||
description: 'Directory in which to execute codecov.sh'
|
description: 'Directory in which to execute codecov.sh'
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Upload to Codecov
|
|
||||||
command: <<include(scripts/dist/codecov.sh)>>
|
|
||||||
when: << parameters.when >>
|
|
||||||
branding:
|
branding:
|
||||||
color: 'red'
|
color: 'red'
|
||||||
icon: 'umbrella'
|
icon: 'umbrella'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -176,13 +175,32 @@ runs:
|
|||||||
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> $GITHUB_ENV
|
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> $GITHUB_ENV
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Override branch for forks
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ -z "$CC_BRANCH" ] && [ -z "$CODECOV_TOKEN" ] && [ "${GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME}" != "$GITHUB_REPOSITORY" ];
|
||||||
|
then
|
||||||
|
echo -e "\033[0;32m==>\033[0m Fork detected, tokenless uploading used"
|
||||||
|
TOKENLESS="$GITHUB_EVENT_PULL_REQUEST_HEAD_LABEL"
|
||||||
|
CC_BRANCH="$GITHUB_EVENT_PULL_REQUEST_HEAD_LABEL"
|
||||||
|
echo "TOKENLESS=$TOKENLESS" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "CC_BRANCH=$CC_BRANCH" >> $GITHUB_ENV
|
||||||
|
env:
|
||||||
|
CC_BRANCH: ${{ inputs.override_branch }}
|
||||||
|
GITHUB_EVENT_PULL_REQUEST_HEAD_LABEL: ${{ github.event.pull_request.head.label }}
|
||||||
|
GITHUB_EVENT_PULL_REQUEST_REPO_FULL_NAME: ${{ github.event.pull_request.repo.full_name }}
|
||||||
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
run: ./dist/codecov.sh
|
run: ${GITHUB_ACTION_PATH}/dist/codecov.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{ inputs.working-directory }}
|
working-directory: ${{ inputs.working-directory }}
|
||||||
env:
|
env:
|
||||||
CC_BINARY: ${{ inputs.binary }}
|
CC_BINARY: ${{ inputs.binary }}
|
||||||
CC_BRANCH: ${{ inputs.override_branch }}
|
CC_BRANCH: $CC_BRANCH
|
||||||
CC_BUILD: ${{ inputs.override_build }}
|
CC_BUILD: ${{ inputs.override_build }}
|
||||||
CC_BUILD_URL: ${{ inputs.override_build_url }}
|
CC_BUILD_URL: ${{ inputs.override_build_url }}
|
||||||
CC_CODE: ${{ inputs.report_code }}
|
CC_CODE: ${{ inputs.report_code }}
|
||||||
@@ -220,3 +238,4 @@ runs:
|
|||||||
CC_TOKEN: $CODECOV_TOKEN
|
CC_TOKEN: $CODECOV_TOKEN
|
||||||
CC_VERBOSE: ${{ inputs.verbose }}
|
CC_VERBOSE: ${{ inputs.verbose }}
|
||||||
CC_VERSION: ${{ inputs.version }}
|
CC_VERSION: ${{ inputs.version }}
|
||||||
|
CC_YML_PATH: ${{ inputs.codecov_yml_path }}
|
||||||
|
|||||||
9
dist/codecov.sh
vendored
9
dist/codecov.sh
vendored
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
CC_WRAPPER_VERSION="0.0.22"
|
CC_WRAPPER_VERSION="0.0.24"
|
||||||
set +u
|
set +u
|
||||||
say() {
|
say() {
|
||||||
echo -e "$1"
|
echo -e "$1"
|
||||||
@@ -80,13 +80,16 @@ else
|
|||||||
say "$g ->$x Downloading $b${cc_url}$x"
|
say "$g ->$x Downloading $b${cc_url}$x"
|
||||||
curl -Os $cc_url
|
curl -Os $cc_url
|
||||||
say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x"
|
say "$g==>$x Finishing downloading $b${cc_os}:${CC_VERSION}$x"
|
||||||
|
version_url="https://cli.codecov.io/${cc_os}/${CC_VERSION}"
|
||||||
|
version=$(curl -s $version_url -H "Accept:application/json" | jq -r '.version')
|
||||||
|
say " Version: $b$version$x"
|
||||||
say " "
|
say " "
|
||||||
fi
|
fi
|
||||||
if [ "$CC_SKIP_VALIDATION" = "true" ] || [ -n "$CC_BINARY" ];
|
if [ "$CC_SKIP_VALIDATION" = "true" ] || [ -n "$CC_BINARY" ];
|
||||||
then
|
then
|
||||||
say "$r==>$x Bypassing validation as requested by user"
|
say "$r==>$x Bypassing validation as requested by user"
|
||||||
else
|
else
|
||||||
CC_PUBLIC_PGP_KEY=$(curl https://keybase.io/codecovsecurity/pgp_keys.asc)
|
CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
|
||||||
echo "${CC_PUBLIC_PGP_KEY}" | \
|
echo "${CC_PUBLIC_PGP_KEY}" | \
|
||||||
gpg --no-default-keyring --import
|
gpg --no-default-keyring --import
|
||||||
# One-time step
|
# One-time step
|
||||||
@@ -131,6 +134,7 @@ cc_cr_args+=( $(write_existing_args CC_PR) )
|
|||||||
cc_cr_args+=( $(write_existing_args CC_SHA) )
|
cc_cr_args+=( $(write_existing_args CC_SHA) )
|
||||||
cc_cr_args+=( $(write_existing_args CC_SLUG) )
|
cc_cr_args+=( $(write_existing_args CC_SLUG) )
|
||||||
cc_du_args=()
|
cc_du_args=()
|
||||||
|
cc_du_args+=( $(write_existing_args CC_ENV) )
|
||||||
OLDIFS=$IFS;IFS=,
|
OLDIFS=$IFS;IFS=,
|
||||||
cc_du_args+=( $(write_existing_args CC_BRANCH) )
|
cc_du_args+=( $(write_existing_args CC_BRANCH) )
|
||||||
cc_du_args+=( $(write_existing_args CC_BUILD) )
|
cc_du_args+=( $(write_existing_args CC_BUILD) )
|
||||||
@@ -140,7 +144,6 @@ cc_du_args+=( $(write_existing_args CC_DIR) )
|
|||||||
cc_du_args+=( $(write_truthy_args CC_DISABLE_FILE_FIXES) )
|
cc_du_args+=( $(write_truthy_args CC_DISABLE_FILE_FIXES) )
|
||||||
cc_du_args+=( $(write_truthy_args CC_DISABLE_SEARCH) )
|
cc_du_args+=( $(write_truthy_args CC_DISABLE_SEARCH) )
|
||||||
cc_du_args+=( $(write_truthy_args CC_DRY_RUN) )
|
cc_du_args+=( $(write_truthy_args CC_DRY_RUN) )
|
||||||
cc_du_args+=( $(write_existing_args CC_ENV) )
|
|
||||||
if [ -n "$CC_EXCLUDES" ];
|
if [ -n "$CC_EXCLUDES" ];
|
||||||
then
|
then
|
||||||
for directory in $CC_EXCLUDES; do
|
for directory in $CC_EXCLUDES; do
|
||||||
|
|||||||
Submodule src/scripts updated: 44fa6396f4...25f50b4c5b
@@ -1 +1 @@
|
|||||||
CODECOV_ACTION_VERSION="5.0.0"
|
CODECOV_ACTION_VERSION="5.0.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user