-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #137 from codecov/refactor-src
chore: refactor source with new commands subfolder
- Loading branch information
Showing
19 changed files
with
125 additions
and
108 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
description: | | ||
Upload your coverage reports to Codecov without dealing with complex | ||
configurations. This orb helps you get coverage results quickly so that you | ||
can breathe easier and commit your code with confidence. | ||
If running on `alpine` builds, the orb will need `coreutils`, `curl`, and | ||
`gnupg` in order to validate. | ||
parameters: | ||
file: | ||
description: Path to the code coverage data file to upload. | ||
type: string | ||
default: "" | ||
flags: | ||
description: Flag the upload to group coverage metrics (e.g. unittests | ||
| integration | ui,chrome) | ||
type: string | ||
default: "" | ||
token: | ||
description: Set the private repository token as the value of the | ||
variable CODECOV_TOKEN using CircleCI Environment Variables. | ||
type: env_var_name | ||
default: CODECOV_TOKEN | ||
upload_name: | ||
description: Custom defined name of the upload. Visible in Codecov UI | ||
type: string | ||
default: ${CIRCLE_BUILD_NUM} | ||
validate: | ||
description: Validate the uploader before uploading the codecov result. | ||
type: boolean | ||
default: true | ||
when: | ||
description: When should this step run? | ||
type: string | ||
default: "always" | ||
xtra_args: | ||
description: Any extra flags as provided by the bash uploader | ||
(e.g. `-v -Z`). | ||
type: string | ||
default: "" | ||
version: | ||
description: Which version of the Codecov Uploader to use (defaults to | ||
'latest') | ||
type: string | ||
default: "latest" | ||
|
||
steps: | ||
- run: | ||
name: Download Codecov Uploader | ||
command: <<include(scripts/download.sh)>> | ||
when: << parameters.when >> | ||
environment: | ||
PARAM_VERSION: << parameters.version >> | ||
- when: | ||
condition: << parameters.validate >> | ||
steps: | ||
- run: | ||
name: Validate Codecov Uploader | ||
command: <<include(scripts/validate.sh)>> | ||
- run: | ||
name: Upload Coverage Results | ||
command: <<include(scripts/upload.sh)>> | ||
environment: | ||
PARAM_FILE: << parameters.file >> | ||
PARAM_FLAGS: << parameters.flags >> | ||
PARAM_TOKEN: << parameters.token >> | ||
PARAM_UPLOAD_NAME: << parameters.upload_name >> | ||
PARAM_XTRA_ARGS: << parameters.xtra_args >> |
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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
family=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
os="windows" | ||
[[ $family == "darwin" ]] && os="macos" | ||
|
||
[[ $family == "linux" ]] && os="linux" | ||
[[ $os == "linux" ]] && \ | ||
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-) | ||
[[ $osID == "alpine" ]] && os="alpine" | ||
echo "Detected ${os}" | ||
echo "export os=${os}" >> $BASH_ENV | ||
echo "export version=${PARAM_VERSION}" >> $BASH_ENV | ||
|
||
filename="codecov" | ||
[[ $os == "windows" ]] && filename+=".exe" | ||
echo "export filename=${filename}" >> $BASH_ENV | ||
[[ $os == "macos" ]] && \ | ||
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg | ||
codecov_url="https://uploader.codecov.io" | ||
codecov_url="$codecov_url/${PARAM_VERSION}" | ||
codecov_url="$codecov_url/${os}/${filename}" | ||
echo "Downloading ${codecov_url}" | ||
curl -Os $codecov_url -v |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
unset NODE_OPTIONS | ||
# See https://github.com/codecov/uploader/issues/475 | ||
source $BASH_ENV | ||
chmod +x $filename | ||
[ -n "${PARAM_FILE}" ] && \ | ||
set - "${@}" "-f" "${PARAM_FILE}" | ||
[ -n "${PARAM_XTRA_ARGS}" ] && \ | ||
set - "${@}" "${PARAM_XTRA_ARGS}" | ||
# alpine doesn't allow for indirect expansion | ||
./"$filename" \ | ||
-Q "codecov-circleci-orb-3.2.3" \ | ||
-t "$(eval echo \$$PARAM_TOKEN)" \ | ||
-n "${PARAM_UPLOAD_NAME}" \ | ||
-F "${PARAM_FLAGS}" \ | ||
${@} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
source $BASH_ENV | ||
curl https://keybase.io/codecovsecurity/pgp_keys.asc | \ | ||
gpg --no-default-keyring --keyring trustedkeys.gpg --import | ||
# One-time step | ||
sha_url="https://uploader.codecov.io" | ||
sha_url="$sha_url/${version}/${os}" | ||
sha_url="$sha_url/${filename}.SHA256SUM" | ||
echo "Downloading ${sha_url}" | ||
curl -Os $sha_url | ||
curl -Os $sha_url".sig" | ||
gpgv $filename.SHA256SUM.sig $filename.SHA256SUM | ||
shasum -a 256 -c $filename.SHA256SUM || \ | ||
sha256sum -c $filename.SHA256SUM |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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 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