Compare commits

..

2 Commits

Author SHA1 Message Date
Thomas Hu
7de38c9dc9 Add logging 2020-08-18 22:24:45 -04:00
Thomas Hu
6145016ec0 Update name default 2020-08-18 22:16:42 -04:00
11 changed files with 3804 additions and 5073 deletions

View File

@@ -10,6 +10,11 @@ jobs:
run: npm install run: npm install
- name: Run tests and collect coverage - name: Run tests and collect coverage
run: yarn run test-all run: yarn run test-all
- name: Echo env variables
run: |
echo $GITHUB_RUN_ID
echo $GITHUB_RUN_NUMBER
echo $GITHUB_ACTION
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: ./ uses: ./
with: with:
@@ -17,11 +22,3 @@ jobs:
file: ./coverage/coverage-final.json file: ./coverage/coverage-final.json
flags: unittest flags: unittest
name: codecov-1 name: codecov-1
- name: Upload coverage to Codecov (verbose)
uses: ./
with:
files: ./coverage/calculator/coverage-final.json,./coverage/index/coverage-final.json
file: ./coverage/coverage-final.json
flags: unittest
name: codecov-1
verbose: true

View File

@@ -1,19 +0,0 @@
### 1.1.1
#### Fixes
- #184 Add automations ensure proper builds and deployments
- #184 Fixes verbose flag
### 1.1.0
#### Features
- #110 Add "working-directory:" input
- #174 Support Xcode specificed parameters
#### Fixes
- #172 File is saved as text
#### Dependencies and Misc
- #166 Bump requestretry from 4.1.1 to 4.1.2
- #169 Bump typescript from 4.0.5 to 4.1.2
- #178 Bump @types/jest from 26.0.15 to 26.0.19

View File

View File

@@ -1,7 +1,6 @@
# Codecov GitHub Action # Codecov GitHub Action
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov) [![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action?ref=badge_shield)
### Easily upload coverage reports to Codecov from GitHub Actions ### Easily upload coverage reports to Codecov from GitHub Actions
>The latest release of this Action adds support for tokenless uploads from GitHub Actions! >The latest release of this Action adds support for tokenless uploads from GitHub Actions!
@@ -25,7 +24,6 @@ steps:
flags: unittests # optional flags: unittests # optional
name: codecov-umbrella # optional name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false) fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
``` ```
>**Note**: This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io). Keep in mind that secrets are *not* available to forks of repositories. >**Note**: This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io). Keep in mind that secrets are *not* available to forks of repositories.
@@ -33,6 +31,8 @@ steps:
Codecov's Action currently supports five inputs from the user: `token`, `file`, `flags`,`name`, and `fail_ci_if_error`. These inputs, along with their descriptions and usage contexts, are listed in the table below: Codecov's Action currently supports five inputs from the user: `token`, `file`, `flags`,`name`, and `fail_ci_if_error`. These inputs, along with their descriptions and usage contexts, are listed in the table below:
>**Update**: We've removed the `yml` parameter with the latest release of this action. Please put your custom codecov yaml file at the root of the repo because other locations will no longer be supported in the future.
| Input | Description | Usage | | Input | Description | Usage |
| :---: | :---: | :---: | | :---: | :---: | :---: |
| `token` | Used to authorize coverage report uploads | *Required for private repos* | | `token` | Used to authorize coverage report uploads | *Required for private repos* |
@@ -44,10 +44,6 @@ Codecov's Action currently supports five inputs from the user: `token`, `file`,
| `name` | Custom defined name for the upload | Optional | `name` | Custom defined name for the upload | Optional
| `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional | `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional
| `path_to_write_report` | Write upload file to path before uploading | Optional | `path_to_write_report` | Write upload file to path before uploading | Optional
| `verbose` | Specify whether the Codecov output should be verbose | Optional
| `working-directory` | Directory in which to execute `codecov.sh` | Optional
| `xcode_derived_data` | Custom Derived Data Path for Coverage.profdata and gcov processing | Optional
| `xcode_package` | Specify packages to build coverage. Uploader will only build these packages. This can significantly reduces time to build coverage reports. -J 'MyAppName' Will match "MyAppName" and "MyAppNameTests" -J '^ExampleApp$' Will match only "ExampleApp" not "ExampleAppTests" | Optional
### Example `workflow.yml` with Codecov Action ### Example `workflow.yml` with Codecov Action
@@ -85,8 +81,7 @@ jobs:
env_vars: OS,PYTHON env_vars: OS,PYTHON
name: codecov-umbrella name: codecov-umbrella
fail_ci_if_error: true fail_ci_if_error: true
path_to_write_report: ./coverage/codecov_report.txt path_to_write_report: ./coverage/codecov_report.gz
verbose: true
``` ```
## Contributing ## Contributing
@@ -95,6 +90,3 @@ Contributions are welcome! Check out the [Contribution Guide](CONTRIBUTING.md).
## License ## License
The code in this project is released under the [MIT License](LICENSE). The code in this project is released under the [MIT License](LICENSE).
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action?ref=badge_large)

View File

@@ -3,7 +3,7 @@ description: 'GitHub Action that uploads coverage reports for your repository to
author: 'Ibrahim Ali <@ibrahim0814> & Thomas Hu <@thomasrockhu> | Codecov' author: 'Ibrahim Ali <@ibrahim0814> & Thomas Hu <@thomasrockhu> | Codecov'
inputs: inputs:
name: name:
description: 'User defined upload name. Visible in Codecov UI' description: 'User defined upload name. Visible in Codecov UI. Defaults to ${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}'
required: false required: false
token: token:
description: 'Repository upload token - get it from codecov.io. Required only for private repositories' description: 'Repository upload token - get it from codecov.io. Required only for private repositories'
@@ -29,12 +29,6 @@ inputs:
fail_ci_if_error: fail_ci_if_error:
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload' description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
required: false required: false
verbose:
description: 'Specify whether the Codecov output should be verbose'
required: false
working-directory:
description: 'Directory in which to execute codecov.sh'
required: false
branding: branding:
color: 'red' color: 'red'
icon: 'umbrella' icon: 'umbrella'

6390
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
#!/usr/bin/env bash
npm i --package-lock-only
npm run build
git add dist/index.js

View File

@@ -4,7 +4,6 @@ const fs = require("fs");
const request = require('requestretry'); const request = require('requestretry');
let fail_ci; let fail_ci;
let verbose;
try { try {
const name = core.getInput("name"); const name = core.getInput("name");
const token = core.getInput("token"); const token = core.getInput("token");
@@ -14,12 +13,8 @@ try {
const env_vars = core.getInput("env_vars"); const env_vars = core.getInput("env_vars");
const dir = core.getInput("directory"); const dir = core.getInput("directory");
const write_path = core.getInput("path_to_write_report"); const write_path = core.getInput("path_to_write_report");
const working_dir = core.getInput("working-directory");
const xcode_derived_data = core.getInput("xcode_derived_data");
const xcode_package = core.getInput("xcode_package");
fail_ci = core.getInput("fail_ci_if_error").toLowerCase(); fail_ci = core.getInput("fail_ci_if_error").toLowerCase();
verbose = core.getInput("verbose").toLowerCase();
if ( if (
fail_ci === "yes" || fail_ci === "yes" ||
@@ -33,18 +28,6 @@ try {
fail_ci = false; fail_ci = false;
} }
if (
verbose === "yes" ||
verbose === "y" ||
verbose === "true" ||
verbose === "t" ||
verbose === "1"
) {
verbose = true;
} else {
verbose = false;
}
request({ request({
json: false, json: false,
maxAttempts: 10, maxAttempts: 10,
@@ -80,6 +63,7 @@ try {
options.env = Object.assign(process.env, { options.env = Object.assign(process.env, {
GITHUB_ACTION: process.env.GITHUB_ACTION, GITHUB_ACTION: process.env.GITHUB_ACTION,
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID, GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
GITHUB_RUN_NUMBER: process.env.GITHUB_RUN_NUMBER,
GITHUB_REF: process.env.GITHUB_REF, GITHUB_REF: process.env.GITHUB_REF,
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY, GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
GITHUB_SHA: process.env.GITHUB_SHA, GITHUB_SHA: process.env.GITHUB_SHA,
@@ -100,8 +84,6 @@ try {
} }
const execArgs = ["codecov.sh"]; const execArgs = ["codecov.sh"];
execArgs.push("-Q", "github-action");
if (file) { if (file) {
execArgs.push( execArgs.push(
"-f", `${file}` "-f", `${file}`
@@ -122,8 +104,17 @@ try {
); );
} }
if (name) {
execArgs.push(
"-n", `${name}`
);
} else {
execArgs.push(
"-n", `${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}`
);
}
execArgs.push( execArgs.push(
"-n", `${name}`,
"-F", `${flags}` "-F", `${flags}`
); );
@@ -145,28 +136,6 @@ try {
); );
} }
if (verbose) {
execArgs.push(
"-v"
);
}
if (working_dir) {
options.cwd = working_dir;
}
if (xcode_derived_data) {
execArgs.push(
"-D", `${xcode_derived_data}`
);
}
if (xcode_package) {
execArgs.push(
"-J", `${xcode_package}`
);
}
exec.exec("bash", execArgs, options) exec.exec("bash", execArgs, options)
.catch(err => { .catch(err => {
if (fail_ci) { if (fail_ci) {

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
if ! [ -e .git ]; then
echo "Please run this from repo root directory"
exit 1
fi
cd .git/hooks
for i in pre-commit; do
rm -fv $i
ln -sv ../../hooks/$i
done

2339
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "codecov-action", "name": "codecov-action",
"version": "1.1.1", "version": "1.0.14",
"description": "Upload coverage reports to Codecov from GitHub Actions", "description": "Upload coverage reports to Codecov from GitHub Actions",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@@ -22,18 +22,18 @@
}, },
"homepage": "https://github.com/codecov/codecov-action#readme", "homepage": "https://github.com/codecov/codecov-action#readme",
"dependencies": { "dependencies": {
"@actions/core": "^1.2.6", "@actions/core": "^1.2.0",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.1",
"@types/jest": "^26.0.19", "@types/jest": "^26.0.4",
"@zeit/ncc": "^0.22.3", "@zeit/ncc": "^0.22.3",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"jest": "^26.6.3", "jest": "^26.1.0",
"jest-junit": "^12.0.0", "jest-junit": "^10.0.0",
"request": "^2.88.2", "request": "^2.88.0",
"requestretry": "^4.1.2", "requestretry": "^4.1.1",
"ts-jest": "^26.4.4", "ts-jest": "^26.1.1",
"typescript": "^4.1.2", "typescript": "^3.9.6",
"yarn": "^1.22.10" "yarn": "^1.22.4"
}, },
"devDependencies": {} "devDependencies": {}
} }