Compare commits

..
Author SHA1 Message Date
ibrahim0814 49c86d6a5f remove mention of yaml parameter 2020-03-04 18:02:42 -08:00
Armano 6ec347819d chore: set GITHUB_HEAD_REF to empty string if not present 2020-02-09 23:38:15 +01:00
Armano 44ca3d2c84 simplify code and add missing GITHUB_HEAD_REF 2020-02-07 22:24:55 +01:00
Ibrahim Ali 66879ff350 add forked repo secrets notice to readme 2019-12-18 18:50:35 -08:00
ibrahim0814 797e92895e del workflow file 2019-12-05 22:50:23 -08:00
ibrahim0814 a6337803aa del workflow file 2019-12-05 22:48:47 -08:00
Ibrahim Ali 2613f978c9 update marketplace version 2019-12-05 22:45:35 -08:00
Ibrahim Ali 4c6a7296af comment out for now 2019-12-05 22:45:10 -08:00
Ibrahim Ali 4fec3dfa96 Merge pull request #41 from codecov/add-fail-input
Add input to fail ci build
2019-12-05 22:27:09 -08:00
ibrahim0814 355d574b25 add release yml, add build script in pkg json 2019-12-05 22:19:41 -08:00
ibrahim0814 a497b16d77 fix action yaml description 2019-12-05 21:42:20 -08:00
ibrahim0814 ab46201142 run ncc build again 2019-12-05 21:40:52 -08:00
ibrahim0814 ecf5f576a0 prettify 2019-12-05 20:18:23 -08:00
ibrahim0814 8c950ae5c5 add additional catch blocks, correct link func 2019-12-05 20:15:25 -08:00
ibrahim0814 3d303911df add additional catch blocks, correct link func 2019-12-05 20:10:44 -08:00
ibrahim0814 eb1ea256cb test bad unlink 2019-12-05 19:54:02 -08:00
ibrahim0814 5f55456d46 remove catch block 2019-12-05 19:44:49 -08:00
ibrahim0814 ade1ebf812 add catch block 2019-12-05 18:38:48 -08:00
ibrahim0814 31d7d88849 test bad request 2019-12-05 18:31:47 -08:00
ibrahim0814 d608de8763 ncc build 2019-12-05 18:25:41 -08:00
ibrahim0814 08a0ecb0f3 set ci fail conditions 2019-12-05 18:25:24 -08:00
ibrahim0814 3dfea70b3f prettify rem extra catch block 2019-12-05 16:43:29 -08:00
ibrahim0814 f291e7ca9d revert back to set failed 2019-12-05 16:05:56 -08:00
ibrahim0814 78d806df69 replace set fail with warning 2019-12-05 15:48:29 -08:00
ibrahim0814 dd4242c61d add warning instead of fail condition 2019-12-05 14:01:30 -08:00
ibrahim0814 fc0e9fde50 add catch block 2019-12-05 13:46:50 -08:00
ibrahim0814 cf0e744e2c const to let 2019-12-05 01:20:56 -08:00
ibrahim0814 fd07c5fc0c redo dist cmd 2019-12-05 01:18:40 -08:00
ibrahim0814 3d11715b9e initial 2019-12-05 00:57:51 -08:00
Ibrahim Ali cec654a0a7 Merge pull request #39 from bendichter/patch-1
fix python-version in example workflow.yml
2019-12-01 21:15:04 -08:00
Ben Dichter 41a31f1ccf fix python-version in example workflow.yml
I had to change this
2019-12-01 13:41:06 -05:00
Ibrahim Ali d073b23c28 Merge pull request #38 from dguo/remove-ds-store
Remove the .DS_Store file
2019-11-30 16:59:15 -08:00
Danny Guo 11d69070bf Remove the .DS_Store file 2019-11-30 14:14:06 -05:00
Ibrahim Ali dd2a59ac10 update readme 2019-11-20 13:00:29 -08:00
Ibrahim Ali 3ec2345d08 update readme 2019-11-19 11:26:54 -08:00
Ibrahim Ali aea83764c6 Merge pull request #33 from codecov/node-action
Convert action from docker to javascript
2019-11-19 04:29:27 -08:00
9 changed files with 175 additions and 34047 deletions
Vendored
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
name: Example workflow for Codecov
on: [push]
on: [push, pull_request]
jobs:
run:
runs-on: ubuntu-latest
+5 -2
View File
@@ -76,7 +76,7 @@ typings/
# nuxt.js build output
.nuxt
# react / gatsby
# react / gatsby
public/
# vuepress build output
@@ -89,4 +89,7 @@ public/
.fusebox/
# DynamoDB Local files
.dynamodb/
.dynamodb/
# macOS Finder metadata
.DS_Store
+11 -10
View File
@@ -1,7 +1,9 @@
# Codecov GitHub Action
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1.0.4-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov)
### Easily upload coverage reports to Codecov from GitHub Actions
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1.0.5-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov)
### Easily upload coverage reports to Codecov from GitHub Actions
>The latest release of this Action adds support for macOS and Windows builds!
## Usage
@@ -18,24 +20,23 @@ steps:
file: ./coverage.xml #optional
flags: unittests #optional
name: codecov-umbrella #optional
yml: ./codecov.yml #optional
fail_ci_if_error: 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).
>**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.
## Arguments
Codecov's Action currently supports five inputs from the user: `token`, `file`, `flags`,`name`, and `yml`. 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:
| Input | Description | Usage |
| :---: | :---: | :---: |
| `token` | Used to authorize coverage report uploads | *Required* |
| `file` | Path to the coverage report(s) | Optional
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.) | Optional
| `name` | Custom defined name for the build | Optional
| `yml` | Path to codecov.yml config file | 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
### Example `workflow.yml` with Codecov Action
>**Note**: The latest release of this Action adds support for macOS and Windows builds!
```yaml
name: Example workflow for Codecov
@@ -51,7 +52,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@master
with:
version: 3.7
python-version: 3.7
- name: Generate coverage report
run: |
pip install pytest
@@ -64,7 +65,7 @@ jobs:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
yml: ./codecov.yml
fail_ci_if_error: true
```
## Contributing
+2 -2
View File
@@ -14,8 +14,8 @@ inputs:
flags:
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
required: false
yml:
description: 'Specify the location of the .codecov.yml config file'
fail_ci_if_error:
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
required: false
branding:
color: 'red'
+78 -33531
View File
File diff suppressed because one or more lines are too long
+66 -28
View File
@@ -3,19 +3,39 @@ const exec = require("@actions/exec");
const request = require("request");
const fs = require("fs");
let fail_ci;
try {
const name = core.getInput("name");
const token = core.getInput("token");
const flags = core.getInput("flags");
const file = core.getInput("file");
const yml = core.getInput("yml");
fail_ci = core.getInput("fail_ci_if_error").toLowerCase();
if (
fail_ci === "yes" ||
fail_ci === "y" ||
fail_ci === "true" ||
fail_ci === "t" ||
fail_ci === "1"
) {
fail_ci = true;
} else {
fail_ci = false;
}
request("https://codecov.io/bash", (error, response, body) => {
if (error) throw error;
if (error && fail_ci) {
throw error;
} else if (error) {
core.warning(`Codecov warning: ${error.message}`);
}
fs.writeFile("codecov.sh", body, err => {
if (err) throw err;
if (err && fail_ci) {
throw err;
} else if (err) {
core.warning(`Codecov warning: ${err.message}`);
}
let output = "";
let execError = "";
@@ -34,39 +54,57 @@ try {
GITHUB_ACTION: process.env.GITHUB_ACTION,
GITHUB_REF: process.env.GITHUB_REF,
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
GITHUB_SHA: process.env.GITHUB_SHA
GITHUB_SHA: process.env.GITHUB_SHA,
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || ''
};
const execArgs = ["codecov.sh"];
if (file) {
exec
.exec(
"bash",
["codecov.sh", "-f", `${file}`, "-n", `${name}`, "-F", `${flags}`, '-y', `${yml}`],
options
)
.then(() => {
unlinkFile()
});
} else {
exec
.exec(
"bash",
["codecov.sh", "-n", `${name}`, "-F", `${flags}`, '-y', `${yml}`],
options
)
.then(() => {
unlinkFile()
});
execArgs.push(
"-f", `${file}`
);
}
execArgs.push(
"-n", `${name}`,
"-F", `${flags}`
);
if (fail_ci) {
execArgs.push(
"-Z"
);
}
exec.exec("bash", execArgs, options)
.catch(err => {
if (fail_ci) {
core.setFailed(
`Codecov failed with the following error: ${err.message}`
);
} else {
core.warning(`Codecov warning: ${err.message}`);
}
})
.then(() => {
unlinkFile();
});;
const unlinkFile = () => {
fs.unlink("codecov.sh", err => {
if (err) throw err;
if (err && fail_ci) {
throw err;
} else if (err) {
core.warning(`Codecov warning: ${err.message}`);
}
});
}
};
});
});
} catch (error) {
core.setFailed(error.message);
if (fail_ci) {
core.setFailed(`Codecov failed with the following error: ${error.message}`);
} else {
core.warning(`Codecov warning: ${error.message}`);
}
}
+6 -469
View File
File diff suppressed because it is too large Load Diff
+6 -4
View File
@@ -1,10 +1,11 @@
{
"name": "test2",
"version": "1.0.0",
"description": "[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v1.0.3-undefined.svg?logo=github&logoColor=white&style=flat)](https://github.com/marketplace/actions/codecov) ### Easily upload coverage reports to Codecov from GitHub Actions",
"name": "codecov-action",
"version": "1.0.5",
"description": "Upload coverage reports to Codecov from GitHub Actions",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "ncc build index.js"
},
"repository": {
"type": "git",
@@ -20,6 +21,7 @@
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.1",
"@zeit/ncc": "^0.20.5",
"fs": "0.0.1-security",
"request": "^2.88.0"
}