Compare commits
46
Commits
node-action
...
v1.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e34ee48524 | ||
|
|
d7c91c57ee | ||
|
|
d9faadf52a | ||
|
|
c70450d006 | ||
|
|
a6d365dd4c | ||
|
|
94278ffe1b | ||
|
|
ebea5cacdf | ||
|
|
6a65fa4d50 | ||
|
|
4623a4dc3d | ||
|
|
c98408608b | ||
|
|
49c86d6a5f | ||
|
|
6ec347819d | ||
|
|
44ca3d2c84 | ||
|
|
66879ff350 | ||
|
|
797e92895e | ||
|
|
a6337803aa | ||
|
|
2613f978c9 | ||
|
|
4c6a7296af | ||
|
|
4fec3dfa96 | ||
|
|
355d574b25 | ||
|
|
a497b16d77 | ||
|
|
ab46201142 | ||
|
|
ecf5f576a0 | ||
|
|
8c950ae5c5 | ||
|
|
3d303911df | ||
|
|
eb1ea256cb | ||
|
|
5f55456d46 | ||
|
|
ade1ebf812 | ||
|
|
31d7d88849 | ||
|
|
d608de8763 | ||
|
|
08a0ecb0f3 | ||
|
|
3dfea70b3f | ||
|
|
f291e7ca9d | ||
|
|
78d806df69 | ||
|
|
dd4242c61d | ||
|
|
fc0e9fde50 | ||
|
|
cf0e744e2c | ||
|
|
fd07c5fc0c | ||
|
|
3d11715b9e | ||
|
|
cec654a0a7 | ||
|
|
41a31f1ccf | ||
|
|
d073b23c28 | ||
|
|
11d69070bf | ||
|
|
dd2a59ac10 | ||
|
|
3ec2345d08 | ||
|
|
aea83764c6 |
@@ -1,23 +1,14 @@
|
|||||||
name: Example workflow for Codecov
|
name: Example workflow for Codecov
|
||||||
on: [push]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
run:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
|
|
||||||
# - name: Setup Python
|
|
||||||
# uses: actions/setup-python@master
|
|
||||||
|
|
||||||
# - name: Generate coverage report
|
|
||||||
# run: |
|
|
||||||
# pip install pytest
|
|
||||||
# pip install pytest-cov
|
|
||||||
# pytest --cov=./ --cov-report=xml
|
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.CODECOV_TOKEN}}
|
#commenting out token because tokenless uploads are now supported
|
||||||
|
#token: ${{secrets.CODECOV_TOKEN}}
|
||||||
flags: unittest
|
flags: unittest
|
||||||
name: codecov-1
|
name: codecov-1
|
||||||
|
|||||||
+5
-2
@@ -76,7 +76,7 @@ typings/
|
|||||||
# nuxt.js build output
|
# nuxt.js build output
|
||||||
.nuxt
|
.nuxt
|
||||||
|
|
||||||
# react / gatsby
|
# react / gatsby
|
||||||
public/
|
public/
|
||||||
|
|
||||||
# vuepress build output
|
# vuepress build output
|
||||||
@@ -89,4 +89,7 @@ public/
|
|||||||
.fusebox/
|
.fusebox/
|
||||||
|
|
||||||
# DynamoDB Local files
|
# DynamoDB Local files
|
||||||
.dynamodb/
|
.dynamodb/
|
||||||
|
|
||||||
|
# macOS Finder metadata
|
||||||
|
.DS_Store
|
||||||
|
|||||||
+4
-4
@@ -6,16 +6,16 @@ inputs:
|
|||||||
description: 'User defined upload name. Visible in Codecov UI'
|
description: 'User defined upload name. Visible in Codecov UI'
|
||||||
required: false
|
required: false
|
||||||
token:
|
token:
|
||||||
description: 'Repository upload token - get it from codecov.io'
|
description: 'Repository upload token - get it from codecov.io. Required only for private repositories'
|
||||||
required: true
|
required: false
|
||||||
file:
|
file:
|
||||||
description: 'Path to coverage file to upload'
|
description: 'Path to coverage file to upload'
|
||||||
required: false
|
required: false
|
||||||
flags:
|
flags:
|
||||||
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
||||||
required: false
|
required: false
|
||||||
yml:
|
fail_ci_if_error:
|
||||||
description: 'Specify the location of the .codecov.yml config file'
|
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
|
||||||
required: false
|
required: false
|
||||||
branding:
|
branding:
|
||||||
color: 'red'
|
color: 'red'
|
||||||
|
|||||||
Vendored
+23908
-23866
File diff suppressed because one or more lines are too long
@@ -3,19 +3,39 @@ const exec = require("@actions/exec");
|
|||||||
const request = require("request");
|
const request = require("request");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
|
||||||
|
let fail_ci;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const name = core.getInput("name");
|
const name = core.getInput("name");
|
||||||
const token = core.getInput("token");
|
const token = core.getInput("token");
|
||||||
const flags = core.getInput("flags");
|
const flags = core.getInput("flags");
|
||||||
const file = core.getInput("file");
|
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) => {
|
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 => {
|
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 output = "";
|
||||||
let execError = "";
|
let execError = "";
|
||||||
@@ -30,43 +50,65 @@ try {
|
|||||||
};
|
};
|
||||||
|
|
||||||
options.env = {
|
options.env = {
|
||||||
CODECOV_TOKEN: `${token}`,
|
|
||||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||||
|
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||||
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,
|
||||||
|
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || ''
|
||||||
};
|
};
|
||||||
|
|
||||||
if (file) {
|
if(token){
|
||||||
exec
|
options.env.CODECOV_TOKEN = token
|
||||||
.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()
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const execArgs = ["codecov.sh"];
|
||||||
|
if (file) {
|
||||||
|
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 = () => {
|
const unlinkFile = () => {
|
||||||
fs.unlink("codecov.sh", err => {
|
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) {
|
} 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}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+6
-469
File diff suppressed because it is too large
Load Diff
+10
-7
@@ -1,18 +1,19 @@
|
|||||||
{
|
{
|
||||||
"name": "test2",
|
"name": "codecov-action",
|
||||||
"version": "1.0.0",
|
"version": "1.0.5",
|
||||||
"description": "[](https://github.com/marketplace/actions/codecov) ### Easily 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": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"build": "ncc build index.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/codecov/codecov-action.git"
|
"url": "git+https://github.com/codecov/codecov-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "Ibrahim Ali",
|
||||||
"license": "ISC",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/codecov/codecov-action/issues"
|
"url": "https://github.com/codecov/codecov-action/issues"
|
||||||
},
|
},
|
||||||
@@ -20,7 +21,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.0",
|
"@actions/core": "^1.2.0",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
|
"@zeit/ncc": "^0.20.5",
|
||||||
"fs": "0.0.1-security",
|
"fs": "0.0.1-security",
|
||||||
"request": "^2.88.0"
|
"request": "^2.88.0"
|
||||||
}
|
},
|
||||||
|
"devDependencies": {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user