mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-08 16:16:24 +00:00
Compare commits
175 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51d810878b | ||
|
|
88c796db18 | ||
|
|
0bbb08247a | ||
|
|
53f686aaf8 | ||
|
|
6ab08a75e2 | ||
|
|
f2242e1815 | ||
|
|
fc2878a530 | ||
|
|
e00e953908 | ||
|
|
8dcb1d2117 | ||
|
|
c5857ba40c | ||
|
|
d680b4c7af | ||
|
|
da21aa9fb6 | ||
|
|
0c50b7bcf4 | ||
|
|
3375d62f3d | ||
|
|
b0b3438bb4 | ||
|
|
9426b0fd6a | ||
|
|
7474287922 | ||
|
|
51773137e8 | ||
|
|
16bc085eaf | ||
|
|
37cfa1ca0a | ||
|
|
4322a1979b | ||
|
|
a558bcf782 | ||
|
|
a96e9cbd13 | ||
|
|
c4b374fc52 | ||
|
|
48b5a1f06e | ||
|
|
66926ef901 | ||
|
|
eac41f1afd | ||
|
|
4c95c92d70 | ||
|
|
c585afe366 | ||
|
|
852cffb352 | ||
|
|
d910efb490 | ||
|
|
439c1e508e | ||
|
|
fc5d663f82 | ||
|
|
5c832aefb8 | ||
|
|
71fa76a9e4 | ||
|
|
672fbdc6af | ||
|
|
1691a31d13 | ||
|
|
ad2b0032e0 | ||
|
|
51db270fe4 | ||
|
|
d4d413da82 | ||
|
|
e2a75c9ff3 | ||
|
|
635d4e88ad | ||
|
|
b215992d02 | ||
|
|
fcd8a3a0dc | ||
|
|
ca5f3da782 | ||
|
|
c21ba4838a | ||
|
|
858ce54168 | ||
|
|
ae4fdee8f8 | ||
|
|
129d2a4a5f | ||
|
|
8e28365500 | ||
|
|
bd60ae88ba | ||
|
|
8f4ab4d738 | ||
|
|
1af7f81eeb | ||
|
|
015c4ad5e2 | ||
|
|
e0bfb4cd95 | ||
|
|
aa268aafcb | ||
|
|
8e0cc2e4d6 | ||
|
|
c20b4eed29 | ||
|
|
70e827086f | ||
|
|
9107d98cec | ||
|
|
ef82f174a8 | ||
|
|
ecee53a380 | ||
|
|
8c24698b96 | ||
|
|
a432718b6a | ||
|
|
33974f67c6 | ||
|
|
d1f4b0126d | ||
|
|
dffe44534b | ||
|
|
094e9d4e9e | ||
|
|
854d359282 | ||
|
|
4463da3901 | ||
|
|
fe4ed48250 | ||
|
|
0a2a5814db | ||
|
|
b265804b8f | ||
|
|
861141ec76 | ||
|
|
61af985317 | ||
|
|
bb99ca5cc2 | ||
|
|
6a3e4db5e8 | ||
|
|
26c5f5e6b3 | ||
|
|
7e6a9d42b7 | ||
|
|
2d78cca173 | ||
|
|
ae8835afc4 | ||
|
|
6c61a504e3 | ||
|
|
28b82119da | ||
|
|
ccdd5a11a4 | ||
|
|
a9bf7a39e6 | ||
|
|
98a1251dbc | ||
|
|
265c6565d0 | ||
|
|
6c58d35c22 | ||
|
|
29386c70ef | ||
|
|
52497068bd | ||
|
|
fbeda37de9 | ||
|
|
ebcf63d8f0 | ||
|
|
a3e633d744 | ||
|
|
b8f68524af | ||
|
|
c9d0b8155c | ||
|
|
8f0855a85c | ||
|
|
c53d6ba320 | ||
|
|
67f597a1c4 | ||
|
|
23d300342d | ||
|
|
328e5ac01f | ||
|
|
9048ba87af | ||
|
|
004e333947 | ||
|
|
840a99b437 | ||
|
|
3cae11df75 | ||
|
|
fb7c8dcad3 | ||
|
|
8790aaf6ce | ||
|
|
e04986db44 | ||
|
|
92cbe0669f | ||
|
|
7ed20fef2d | ||
|
|
95c9f38035 | ||
|
|
5dab066a61 | ||
|
|
ff5bbb3aa8 | ||
|
|
6dfc35f92d | ||
|
|
069f3918b5 | ||
|
|
3ee49263a4 | ||
|
|
da4a4a1c99 | ||
|
|
5eebf0436a | ||
|
|
9feddcab70 | ||
|
|
a18b323e89 | ||
|
|
f8e6b45999 | ||
|
|
a737162646 | ||
|
|
18b0d954de | ||
|
|
bad627d1b6 | ||
|
|
ab8eb9dc66 | ||
|
|
407299cffc | ||
|
|
b072ed5085 | ||
|
|
1f38181652 | ||
|
|
39ec4545ca | ||
|
|
d5985f56ba | ||
|
|
4ce3eb846f | ||
|
|
b6708446cb | ||
|
|
16a94c297b | ||
|
|
c6981a3267 | ||
|
|
2494ac533b | ||
|
|
4c6214fb7a | ||
|
|
7402d15ad2 | ||
|
|
b80bc84850 | ||
|
|
a1ed4b322b | ||
|
|
2332a737fb | ||
|
|
dc56cf479e | ||
|
|
a5399823bb | ||
|
|
9f471fc6f8 | ||
|
|
062fb177ae | ||
|
|
31d2c8f775 | ||
|
|
47ed2776b9 | ||
|
|
b37e21182f | ||
|
|
fd42ae77ab | ||
|
|
998cb33cad | ||
|
|
052dc5d29d | ||
|
|
3e2901753e | ||
|
|
6b52f2a1d9 | ||
|
|
4789835c72 | ||
|
|
47b1f9735f | ||
|
|
298ba60aef | ||
|
|
abf28f2040 | ||
|
|
cdc2a0ed57 | ||
|
|
967e2b38a8 | ||
|
|
77a7b61cd5 | ||
|
|
50895b2a6f | ||
|
|
95e6f30a60 | ||
|
|
0e28ff86a5 | ||
|
|
72182f9425 | ||
|
|
ce1ffb8db7 | ||
|
|
864620acb9 | ||
|
|
6ac8172373 | ||
|
|
5ab0dbc584 | ||
|
|
5e8c27dd4d | ||
|
|
444b352d52 | ||
|
|
83cbbf806b | ||
|
|
040839f579 | ||
|
|
6e56f7a5a6 | ||
|
|
ae04cc96c3 | ||
|
|
d2569b4d35 | ||
|
|
216c5372a9 | ||
|
|
b349bb9c57 |
@@ -5,7 +5,9 @@
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"google"
|
||||
"google",
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
@@ -15,5 +17,6 @@
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"linebreak-style": 0
|
||||
}
|
||||
}
|
||||
|
||||
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
42
.github/workflows/main.yml
vendored
42
.github/workflows/main.yml
vendored
@@ -1,8 +1,32 @@
|
||||
name: Workflow for Codecov Action
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
no-deps:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Upload coverage to Codecov (script)
|
||||
uses: ./
|
||||
with:
|
||||
files: ./coverage/script/coverage-final.json
|
||||
flags: script,${{ matrix.os }}
|
||||
name: codecov-script
|
||||
- name: Upload coverage to Codecov (demo)
|
||||
uses: ./
|
||||
with:
|
||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
||||
file: ./coverage/coverage-final.json
|
||||
flags: demo,${{ matrix.os }}
|
||||
name: codecov-demo
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -11,17 +35,17 @@ jobs:
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
- name: Run tests and collect coverage
|
||||
run: yarn run test
|
||||
run: npm run test
|
||||
- name: Upload coverage to Codecov (script)
|
||||
uses: ./
|
||||
with:
|
||||
files: ./coverage/script/coverage-final.json
|
||||
flags: script,${{ matrix.os }}
|
||||
name: codecov-script
|
||||
- name: Upload coverage to Codecov (demo)
|
||||
uses: ./
|
||||
with:
|
||||
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
|
||||
file: ./coverage/coverage-final.json
|
||||
flags: demo
|
||||
flags: demo,${{ matrix.os }}
|
||||
name: codecov-demo
|
||||
- name: Upload coverage to Codecov (script)
|
||||
uses: ./
|
||||
with:
|
||||
files: ./coverage/script/coverage-final.json
|
||||
flags: script
|
||||
name: codecov-script
|
||||
|
||||
89
CHANGELOG.md
89
CHANGELOG.md
@@ -1,29 +1,104 @@
|
||||
## 2.0.2
|
||||
### Fixes
|
||||
- Underlying uploader fixes issues with tokens not being sent properly for users seeing
|
||||
`Error!: Error: Error uploading to https://codecov.io: Error: Error uploading to Codecov: Error: Not Found`
|
||||
- #440 fix: Validation ordering
|
||||
|
||||
## 2.0.1
|
||||
### Fixes
|
||||
- #424 fix: Issue in building all deep dependencies
|
||||
|
||||
## 2.0.0
|
||||
On February 1, 2022, the `v1` uploader will be full sunset and no longer function. This is due
|
||||
to the deprecation of the underlying bash uploader. This version uses the new [uploader](https://github.com/codecov/uploader).
|
||||
|
||||
The `v2` Action downloads, verifies, and runs the Codecov binary.
|
||||
|
||||
### Breaking Changes
|
||||
- Multiple fields have not been transferred from the bash uploader or have been deprecated. Notably
|
||||
many of the `functionalities` and `gcov_` arguments have been removed. Please check the documentation
|
||||
for the full list.
|
||||
|
||||
### Features
|
||||
- `dry-run` argument allows Codecov flow without uploading reports to Codecov
|
||||
- (Enterprise only) `slug` allows specifying the repository slug manually
|
||||
- (Enterprise only) `url` allows changing the upload host
|
||||
|
||||
## 1.5.2
|
||||
### Fixes
|
||||
- # fix: Import version properly as string not object
|
||||
|
||||
## 1.5.1
|
||||
### Fixes
|
||||
- #320 doc: add github actions badge
|
||||
- #336 Update bash uploader to 1.0.3
|
||||
- #339 fix: Add action version
|
||||
|
||||
### Dependencies
|
||||
- #302 Bump @typescript-eslint/eslint-plugin from 4.22.0 to 4.22.1
|
||||
- #303 Bump @typescript-eslint/parser from 4.22.0 to 4.22.1
|
||||
- #304 Bump ts-jest from 26.5.5 to 26.5.6
|
||||
- #309 Bump lodash from 4.17.19 to 4.17.21
|
||||
- #310 Bump hosted-git-info from 2.8.8 to 2.8.9
|
||||
- #311 Bump @actions/github from 4.0.0 to 5.0.0
|
||||
- #314 Bump eslint from 7.25.0 to 7.27.0
|
||||
- #315 Bump @actions/core from 1.2.7 to 1.3.0
|
||||
- #316 Bump @typescript-eslint/parser from 4.22.1 to 4.25.0
|
||||
- #317 Bump @typescript-eslint/eslint-plugin from 4.22.1 to 4.25.0
|
||||
- #319 Bump jest-junit from 12.0.0 to 12.1.0
|
||||
- #321 Bump typescript from 4.2.4 to 4.3.2
|
||||
- #323 Bump ws from 7.3.1 to 7.4.6
|
||||
- #331 Bump eslint from 7.27.0 to 7.28.0
|
||||
- #332 Bump @actions/exec from 1.0.4 to 1.1.0
|
||||
- #333 Bump @typescript-eslint/parser from 4.25.0 to 4.26.1
|
||||
- #334 Bump @typescript-eslint/eslint-plugin from 4.25.0 to 4.26.1
|
||||
- #335 Bump @actions/core from 1.3.0 to 1.4.0
|
||||
- #337 Bump glob-parent from 5.1.1 to 5.1.2
|
||||
|
||||
## 1.5.0
|
||||
### Features
|
||||
- #299 Pull Codecov bash script into the action
|
||||
|
||||
### Dependencies
|
||||
- #271 Bump typescript from 4.2.3 to 4.2.4
|
||||
- #277 Bump @typescript-eslint/eslint-plugin from 4.16.1 to 4.22.0
|
||||
- #278 Bump @typescript-eslint/parser from 4.20.0 to 4.22.0
|
||||
- #279 Bump @actions/core from 1.2.6 to 1.2.7
|
||||
- #292 Bump ts-jest from 26.5.3 to 26.5.5
|
||||
- #293 Bump eslint from 7.21.0 to 7.25.0
|
||||
- #297 Bump @types/jest from 26.0.20 to 26.0.23
|
||||
- #298 Upgrade to GitHub-native Dependabot
|
||||
|
||||
## 1.4.1
|
||||
### Fixes
|
||||
- #287 Update VERSION regex to restrict on digits and dot and move checksums into script
|
||||
|
||||
## 1.4.0
|
||||
### Features
|
||||
- #282 Add checksum verification of bash script
|
||||
|
||||
## 1.3.2
|
||||
- # Overwrites pr number for pull_request_target events
|
||||
### Fixes
|
||||
- #264 Overwrites pr number for pull_request_target events
|
||||
|
||||
## 1.3.1
|
||||
|
||||
### Fixes
|
||||
- #253 Add `network_filter` to action manifest
|
||||
|
||||
## 1.3.0
|
||||
|
||||
### Features
|
||||
- #252 Add "network_filter" input
|
||||
|
||||
## 1.2.2
|
||||
|
||||
### Fixes
|
||||
- #241 pass root_dir using proper bash arg
|
||||
- #244 Overwrite the commit on pull_request* events
|
||||
|
||||
## 1.2.1
|
||||
|
||||
### Fixes
|
||||
- #196 Add parameters to the action.yml
|
||||
|
||||
## 1.2.0
|
||||
|
||||
### Features
|
||||
- #193 Add all the bash params
|
||||
|
||||
@@ -31,13 +106,11 @@
|
||||
- #193 Fixes issue with working-directory
|
||||
|
||||
## 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
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
:tada: Thanks for taking the time to contribute! :tada:
|
||||
|
||||
The following is a set of guidelines for contributing to this repository, which is hosted in the [Codecov Organization](https://github.com/codecov) on GitHub.
|
||||
The following is a set of guidelines for contributing to this repository, which is hosted in the [Codecov Organization](https://github.com/codecov) on GitHub.
|
||||
|
||||
## What does this repo do?
|
||||
|
||||
This repo is a GitHub Action, meaning it integrates with the GitHub Actions CI/CD pipeline. It's meant to take formatted reports with code coverage stats and upload them to codecov.io. Our Node action uses the Actions toolkit to make system calls that allow us to run Codecov's bash uploader inside of Node. Essentially what we're doing in this action is downloading Codecov's bash uploader script from codecov.io/bash, saving it as a file in the current directory, executing the file via `exec` calls, then removing the script from the current directory.
|
||||
This repo is a GitHub Action, meaning it integrates with the GitHub Actions CI/CD pipeline. It's meant to take formatted reports with code coverage stats and upload them to codecov.io. Our Node action uses the Actions toolkit to make system calls that allow us to run Codecov's bash uploader inside of Node. Essentially what we're doing in this action is downloading Codecov's bash uploader script from codecov.io/bash, saving it as a file in the current directory, executing the file via `exec` calls, then removing the script from the current directory.
|
||||
|
||||
## PRs, Issues, and Support
|
||||
|
||||
Feel free to clone, modify code and request a PR to this repository. All PRs and issues will be reviewed by the Codecov team. If your PR/issue has been sitting for a while or if you have any questions, ping us at support@codecov.io
|
||||
Feel free to clone, modify code and request a PR to this repository. All PRs and issues will be reviewed by the Codecov team. If your PR/issue has been sitting for a while or if you have any questions, ping us at support@codecov.io
|
||||
|
||||
6
Makefile
6
Makefile
@@ -1,7 +1,7 @@
|
||||
deploy:
|
||||
$(eval VERSION := $(shell cat package.json | grep '"version": ' | cut -d\" -f4))
|
||||
git tag -d v1
|
||||
git push origin :v1
|
||||
git tag v1
|
||||
git tag -d v2
|
||||
git push origin :v2
|
||||
git tag v2
|
||||
git tag v$(VERSION) -m ""
|
||||
git push origin --tags
|
||||
|
||||
54
README.md
54
README.md
@@ -2,13 +2,29 @@
|
||||
|
||||
[](https://github.com/marketplace/actions/codecov)
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action?ref=badge_shield)
|
||||
[](https://github.com/codecov/codecov-action/actions/workflows/main.yml)
|
||||
### Easily upload coverage reports to Codecov from GitHub Actions
|
||||
|
||||
>The latest release of this Action adds support for tokenless uploads from GitHub Actions!
|
||||
|
||||
## ⚠️ Deprecration of v1
|
||||
**On February 1, 2022, this version will be fully sunset and no longer function**
|
||||
|
||||
Due to the [deprecation](https://about.codecov.io/blog/introducting-codecovs-new-uploader/) of the underlying bash uploader,
|
||||
the Codecov GitHub Action has released `v2` which will use the new [uploader](https://github.com/codecov/uploader). You can learn
|
||||
more about our deprecation plan and the new uploader on our [blog](https://about.codecov.io/blog/introducing-codecovs-new-uploader/).
|
||||
|
||||
We will be restricting any updates to the `v1` Action to security updates and hotfixes.
|
||||
|
||||
### Migration from `v1` to `v2`
|
||||
The `v2` uploader has a few breaking changes for users
|
||||
- Multiple fields have not been transferred from the bash uploader or have been deprecated. Notably
|
||||
many of the `functionalities` and `gcov_` arguments have been removed. Please check the documentation
|
||||
below for the full list.
|
||||
|
||||
## Usage
|
||||
|
||||
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (`@v1` is recommended) as a `step` within your `workflow.yml` file.
|
||||
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (`@v2` is recommended) as a `step` within your `workflow.yml` file.
|
||||
|
||||
If you have a *private repository*, this Action also requires you to [provide an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) from [codecov.io](https://www.codecov.io) (tip: in order to avoid exposing your token, store it as a `secret`). Optionally, you can choose to include up to four additional inputs to customize the upload context. **For public repositories, no token is needed**
|
||||
|
||||
@@ -17,7 +33,7 @@ Inside your `.github/workflows/workflow.yml` file:
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: codecov/codecov-action@v1
|
||||
- uses: codecov/codecov-action@v2
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
||||
files: ./coverage1.xml,./coverage2.xml # optional
|
||||
@@ -37,29 +53,14 @@ Codecov's Action currently supports five inputs from the user: `token`, `file`,
|
||||
| `token` | Used to authorize coverage report uploads | *Required for private repos* |
|
||||
| `files` | Comma-separated paths to the coverage report(s) | Optional
|
||||
| `directory` | Directory to search for coverage reports. | Optional
|
||||
| `dry_run` | Don't upload files to Codecov | Optional
|
||||
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
|
||||
| | |
|
||||
| `aws_curl_args` | Extra curl arguments to communicate with AWS. | Optional
|
||||
| `codecov_curl_args` | Extra curl arguments to communicate with Codecov. e.g., -U "--proxy http://http-proxy" | Optional
|
||||
| `commit_parent` | The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository provider's API, the parent is determined via finding the closest ancestor to the commit. | Optional
|
||||
| `env_vars` | Environment variables to tag the upload with. Multiple env variables can be separated with commas (e.g. `OS,PYTHON`) | Optional
|
||||
| `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional
|
||||
| `functionalities` | Toggle functionalities | Optional
|
||||
| | `coveragepy` Disable python coverage |
|
||||
| | `fix` Disable report fixing |
|
||||
| | `gcov` Disable gcov |
|
||||
| | `gcovout` Disable gcov output |
|
||||
| | `html` Enable coverage for HTML files |
|
||||
| | `network` Disable uploading the file network |
|
||||
| | `recursesubs` Enable recurse submodules in git projects when searching for source files | |
|
||||
| | `search` Disable searching for reports |
|
||||
| | `xcode` Disable xcode processing |
|
||||
| `gcov_path_include` | Paths to include during gcov gathering (as a glob) | Optional
|
||||
| `gcov_args` | extra arguments to pass to gcov | Optional
|
||||
| `gcov_executable` | gcov executable to run. Defaults to 'gcov' | Optional
|
||||
| `gcov_path_exclude` | Paths to ignore during gcov gathering (as a glob) | Optional
|
||||
| `gcov_prefix` | Prefix filepaths to help resolve path fixing | Optional
|
||||
| `gcov_root_dir` | Project root directory, also used when preparing gcov | Optional
|
||||
-| `functionalities` | Toggle functionalities | Optional
|
||||
-| | `network` Disable uploading the file network |
|
||||
| `move_coverage_to_trash` | Move discovered coverage reports to the trash | Optional
|
||||
| `name` | Custom defined name for the upload | Optional
|
||||
| `override_branch` | Specify the branch name | Optional
|
||||
@@ -69,10 +70,10 @@ Codecov's Action currently supports five inputs from the user: `token`, `file`,
|
||||
| `override_tag` | Specify the git tag | Optional
|
||||
| `path_to_write_report` | Write upload file to path before uploading | Optional
|
||||
| `root_dir` | Used when not in git/hg project to identify project root directory | Optional
|
||||
| `slug` | Specify the slug manually (Enterprise use) | Optional
|
||||
| `url` | Change the upload host (Enterprise use) | 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
|
||||
|
||||
@@ -100,15 +101,15 @@ jobs:
|
||||
pip install pytest-cov
|
||||
pytest --cov=./ --cov-report=xml
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v1
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./coverage1.xml,./coverage2.xml
|
||||
directory: ./coverage/reports/
|
||||
flags: unittests
|
||||
env_vars: OS,PYTHON
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: true
|
||||
files: ./coverage1.xml,./coverage2.xml
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
path_to_write_report: ./coverage/codecov_report.txt
|
||||
verbose: true
|
||||
```
|
||||
@@ -120,5 +121,4 @@ Contributions are welcome! Check out the [Contribution Guide](CONTRIBUTING.md).
|
||||
|
||||
The code in this project is released under the [MIT License](LICENSE).
|
||||
|
||||
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fcodecov-action?ref=badge_large)
|
||||
|
||||
45
action.yml
45
action.yml
@@ -14,15 +14,12 @@ inputs:
|
||||
flags:
|
||||
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
||||
required: false
|
||||
aws_curl_args:
|
||||
description: 'Extra curl arguments to communicate with AWS.'
|
||||
required: false
|
||||
codecov_curl_args:
|
||||
description: 'Extra curl arguments to communicate with Codecov. e.g., -U "--proxy http://http-proxy"'
|
||||
required: false
|
||||
commit_parent:
|
||||
description: 'The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository providers API, the parent is determined via finding the closest ancestor to the commit.'
|
||||
required: false
|
||||
dry_run:
|
||||
description: "Don't upload files to Codecov"
|
||||
required: false
|
||||
env_vars:
|
||||
description: 'Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)'
|
||||
required: false
|
||||
@@ -35,24 +32,6 @@ inputs:
|
||||
functionalities:
|
||||
description: 'Comma-separated list, see the README for options and their usage'
|
||||
required: false
|
||||
gcov_args:
|
||||
description: 'extra arguments to pass to gcov'
|
||||
required: false
|
||||
gcov_executable:
|
||||
description: 'gcov executable to run. Defaults to gcov'
|
||||
required: false
|
||||
gcov_path_exclude:
|
||||
description: 'Paths to ignore during gcov gathering (as a glob)'
|
||||
required: false
|
||||
gcov_path_include:
|
||||
description: 'Paths to include during gcov gathering (as a glob)'
|
||||
required: false
|
||||
gcov_prefix:
|
||||
description: 'Prefix filepaths to help resolve path fixing'
|
||||
required: false
|
||||
gcov_root_dir:
|
||||
description: 'Project root directory, also used when preparing gcov'
|
||||
required: false
|
||||
move_coverage_to_trash:
|
||||
description: 'Move discovered coverage reports to the trash'
|
||||
required: false
|
||||
@@ -74,27 +53,21 @@ inputs:
|
||||
override_tag:
|
||||
description: 'Specify the git tag'
|
||||
required: false
|
||||
network_filter:
|
||||
description: 'Used to restrict the set of git/hg files that can be matched with filenames in the coverage report. This is useful for monorepos or other setups where a full filepath may not be specified in the coverage report, and that shortened filepath may appear multiple times in a directory structure (e.g. __init__.py)'
|
||||
required: false
|
||||
path_to_write_report:
|
||||
description: 'Write upload file to path before uploading'
|
||||
required: false
|
||||
root_dir:
|
||||
description: 'Used when not in git/hg project to identify project root directory'
|
||||
required: false
|
||||
slug:
|
||||
description: 'Specify the slug manually (Enterprise use)'
|
||||
required: false
|
||||
url:
|
||||
description: 'Change the upload host (Enterprise use)'
|
||||
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
|
||||
xcode_derived_data:
|
||||
description: 'Custom Derived Data Path for Coverage.profdata and gcov processing'
|
||||
required: false
|
||||
xcode_package:
|
||||
description: 'Specify packages to build coverage. Uploader will only build these packages'
|
||||
required: false
|
||||
branding:
|
||||
color: 'red'
|
||||
icon: 'umbrella'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Calculator from './calculator'
|
||||
import Calculator from './calculator';
|
||||
|
||||
test('adds 2 + 3 to equal 5', () => {
|
||||
const calc = new Calculator()
|
||||
const calc = new Calculator();
|
||||
expect(calc.add(2, 3)).toBe(5);
|
||||
});
|
||||
|
||||
test('subtracts 2 - 3 to equal -1', () => {
|
||||
const calc = new Calculator()
|
||||
const calc = new Calculator();
|
||||
expect(calc.subtract(2, 3)).toBe(-1);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Coverage from "./coverage";
|
||||
import Coverage from './coverage';
|
||||
|
||||
test('test uncovered if', () => {
|
||||
const coverageObj = new Coverage();
|
||||
|
||||
67694
dist/index.js
vendored
67694
dist/index.js
vendored
File diff suppressed because one or more lines are too long
1
dist/index.js.map
vendored
Normal file
1
dist/index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
52
dist/pgp_keys.asc
vendored
Normal file
52
dist/pgp_keys.asc
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBGCsMn0BEACiCKZOhkbhUjb+obvhH49p3ShjJzU5b/GqAXSDhRhdXUq7ZoGq
|
||||
KEKCd7sQHrCf16Pi5UVacGIyE9hS93HwY15kMlLwM+lNeAeCglEscOjpCly1qUIr
|
||||
sN1wjkd2cwDXS6zHBJTqJ7wSOiXbZfTAeKhd6DuLEpmA+Rz4Yc+4qZP+fVxVG3Pv
|
||||
2v06m+E5CP/JQVQPO8HYi+S36hJImTh+zaDspu+VujSai5KzJ6YKmgwslVNIp5X5
|
||||
GnEr2uAh5w6UTn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SLNFRmXnt+GQpm44qAK1x8EGhY633
|
||||
e5B4FWorIXx0tTmsVM4rkQ6IgAodeywKG+c2Ikd+5dQLFmb7dW/6CwARAQABiQI2
|
||||
BBgBCgAgFiEEJwNOf9uFDgu8LGL/gGuyiu13mGkFAmCsMn0CGwwACgkQgGuyiu13
|
||||
mGkYWxAAkzF64SVpYvY9nY/QSYikL8UHlyyqirs6eFZ3Mj9lMRpHM2Spn9a3c701
|
||||
0Ge4wDbRP2oftCyPP+p9pdUA77ifMTlRcoMYX8oXAuyE5RT2emBDiWvSR6hQQ8bZ
|
||||
WFNXal+bUPpaRiruCCUPD2b8Od1ftzLqbYOosxr/m5Du0uahgOuGw6zlGBJCVOo7
|
||||
UB2Y++oZ8P7oDGF722opepWQ+bl2a6TRMLNWWlj4UANknyjlhyZZ7PKhWLjoC6MU
|
||||
dAKcwQUdp+XYLc/3b00bvgju0e99QgHZMX2fN3d3ktdN5Q2fqiAi5R6BmCCO4ISF
|
||||
o5j10gGU/sdqGHvNhv5C21ibun7HEzMtxBhnhGmytfBJzrsj7GOReePsfTLoCoUq
|
||||
dFMOAVUDciVfRtL2m8cv42ZJOXtPfDjsFOf8AKJk40/tc8mMMqZP7RVBr9RWOoq5
|
||||
y9D37NfI6UB8rPZ6qs0a1Vfm8lIh2/k1AFECduXgftMDTsmmXOgXXS37HukGW7AL
|
||||
QKWiWJQF/XopkXwkyAYpyuyRMZ77oF7nuqLFnl5VVEiRo0Fwu45erebc6ccSwYZU
|
||||
8pmeSx7s0aJtxCZPSZEKZ3mn0BXOR32Cgs48CjzFWf6PKucTwOy/YO0/4Gt/upNJ
|
||||
3DyeINcYcKyD08DEIF9f5tLyoiD4xz+N23ltTBoMPyv4f3X/wCQ=
|
||||
=ch7z
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
1
dist/sourcemap-register.js
vendored
Normal file
1
dist/sourcemap-register.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
npm i --package-lock-only
|
||||
npm run lint --fix
|
||||
set -e
|
||||
|
||||
npm install
|
||||
npm run lint
|
||||
npm run build
|
||||
git add src/
|
||||
git add dist/index.js
|
||||
git add dist/
|
||||
git add package-lock.json
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
}
|
||||
};
|
||||
|
||||
2921
package-lock.json
generated
2921
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
43
package.json
43
package.json
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "codecov-action",
|
||||
"version": "1.3.2",
|
||||
"version": "2.0.2",
|
||||
"description": "Upload coverage reports to Codecov from GitHub Actions",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint src/*.*",
|
||||
"test": "yarn run test-script && yarn run test-calculator && yarn run test-coverage",
|
||||
"build": "ncc build src/index.ts --source-map",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"test": "npm run test-script && npm run test-calculator && npm run test-coverage",
|
||||
"test-calculator": "jest --testPathPattern=demo/calculator/ --coverage --coverageDirectory=coverage/calculator",
|
||||
"test-coverage": "jest --testPathPattern=demo/coverage-test/ --coverage --coverageDirectory=coverage/coverage-test",
|
||||
"test-script": "jest --testPathPattern=src/ --coverage --coverageDirectory=coverage/script",
|
||||
"build": "ncc build src/index.ts"
|
||||
"test-script": "jest --testPathPattern=src/ --coverage --coverageDirectory=coverage/script"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -23,24 +23,23 @@
|
||||
},
|
||||
"homepage": "https://github.com/codecov/codecov-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.0.4",
|
||||
"@actions/github": "^4.0.0",
|
||||
"@types/jest": "^26.0.20",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"fs": "0.0.1-security",
|
||||
"jest": "^26.6.3",
|
||||
"jest-junit": "^12.0.0",
|
||||
"request": "^2.88.2",
|
||||
"requestretry": "^5.0.0",
|
||||
"ts-jest": "^26.5.3",
|
||||
"typescript": "^4.2.3",
|
||||
"yarn": "^1.22.10"
|
||||
"@actions/core": "^1.4.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"openpgp": "^5.0.0-4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^4.16.1",
|
||||
"@typescript-eslint/parser": "^4.20.0",
|
||||
"eslint": "^7.21.0",
|
||||
"eslint-config-google": "^0.14.0"
|
||||
"@types/jest": "^26.0.24",
|
||||
"@types/node": "^16.4.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
||||
"@typescript-eslint/parser": "^4.28.4",
|
||||
"@vercel/ncc": "^0.29.0",
|
||||
"eslint": "^7.31.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-junit": "^12.2.0",
|
||||
"ts-jest": "^26.5.6",
|
||||
"typescript": "^4.3.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +1,74 @@
|
||||
import * as github from '@actions/github';
|
||||
|
||||
import buildExec from './buildExec';
|
||||
const github = require('@actions/github');
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const {version} = require('../package.json');
|
||||
|
||||
const context = github.context;
|
||||
|
||||
test('no arguments', () => {
|
||||
const {execArgs, filepath, failCi} = buildExec();
|
||||
const {execArgs, failCi} = buildExec();
|
||||
|
||||
const args = [
|
||||
'codecov.sh',
|
||||
'-n',
|
||||
'',
|
||||
'-F',
|
||||
'',
|
||||
'-Q',
|
||||
'github-action',
|
||||
`github-action-${version}`,
|
||||
];
|
||||
if (context.eventName == 'pull_request') {
|
||||
args.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
expect(execArgs).toEqual(args);
|
||||
expect(filepath).toEqual('codecov.sh');
|
||||
expect(failCi).toBeFalsy();
|
||||
});
|
||||
|
||||
test('all arguments', () => {
|
||||
const envs = {
|
||||
'move_coverage_to_trash': 'true',
|
||||
'commit_parent': '83231650328f11695dfb754ca0f540516f188d27',
|
||||
'aws_curl_args': '--timeout 1',
|
||||
'codecov_curl_args': '--timeout 2',
|
||||
'directory': 'coverage/',
|
||||
'dry_run': 'true',
|
||||
'env_vars': 'OS,PYTHON',
|
||||
'fail_ci_if_error': 'true',
|
||||
'file': 'coverage.xml',
|
||||
'files': 'dir1/coverage.xml,dir2/coverage.xml',
|
||||
'flags': 'test',
|
||||
'flags': 'test,test2',
|
||||
'functionalities':
|
||||
'gcov,coveragepy,fix,search,code,network,gcovout,html,recursesubs',
|
||||
'gcov_args': '--timeout 3',
|
||||
'gcov_root_dr': 'gcov_dir/',
|
||||
'gcov_path_exclude': '**/exclude-dir/*.*',
|
||||
'gcov_executable': 'gcov',
|
||||
'gcov_path_include': '**/include-dir/*.*',
|
||||
'gcov_prefix': 'demo',
|
||||
'network',
|
||||
'move_coverage_to_trash': 'true',
|
||||
'name': 'codecov',
|
||||
'network_filter': 'dir1',
|
||||
'override_branch': 'thomasrockhu/test',
|
||||
'override_build': '1',
|
||||
'override_commit': '9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||
'override_pr': '2',
|
||||
'override_tag': 'v1.2',
|
||||
'path_to_write_report': 'codecov/',
|
||||
'root_dir': 'root/',
|
||||
'directory': 'coverage/',
|
||||
'slug': 'fakeOwner/fakeRepo',
|
||||
'token': 'd3859757-ab80-4664-924d-aef22fa7557b',
|
||||
'url': 'https://codecov.enterprise.com',
|
||||
'verbose': 't',
|
||||
'working-directory': 'src',
|
||||
'path_to_write_report': 'codecov/',
|
||||
'xcode_derived_data': '~/Library/Developer/Xcode/DerivedData',
|
||||
'xcode_package': 'MyApp',
|
||||
};
|
||||
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
|
||||
const {execArgs, filepath, failCi} = buildExec();
|
||||
const {execArgs, failCi} = buildExec();
|
||||
expect(execArgs).toEqual([
|
||||
'src/codecov.sh',
|
||||
'-n',
|
||||
'codecov',
|
||||
'-F',
|
||||
'test',
|
||||
'-Q',
|
||||
'github-action',
|
||||
`github-action-${version}`,
|
||||
'-c',
|
||||
'-N',
|
||||
'83231650328f11695dfb754ca0f540516f188d27',
|
||||
'-A',
|
||||
'--timeout 1',
|
||||
'-U',
|
||||
'--timeout 2',
|
||||
'-d',
|
||||
'-e',
|
||||
'OS,PYTHON',
|
||||
'-X',
|
||||
'network',
|
||||
'-Z',
|
||||
'-f',
|
||||
'coverage.xml',
|
||||
@@ -87,36 +76,10 @@ test('all arguments', () => {
|
||||
'dir1/coverage.xml',
|
||||
'-f',
|
||||
'dir2/coverage.xml',
|
||||
'-X',
|
||||
'gcov',
|
||||
'-X',
|
||||
'coveragepy',
|
||||
'-X',
|
||||
'fix',
|
||||
'-X',
|
||||
'search',
|
||||
'-X',
|
||||
'code',
|
||||
'-X',
|
||||
'network',
|
||||
'-X',
|
||||
'gcovout',
|
||||
'-X',
|
||||
'html',
|
||||
'-X',
|
||||
'recursesubs',
|
||||
'-a',
|
||||
'--timeout 3',
|
||||
'-g',
|
||||
'**/exclude-dir/*.*',
|
||||
'-x',
|
||||
'gcov',
|
||||
'-G',
|
||||
'**/include-dir/*.*',
|
||||
'-k',
|
||||
'demo',
|
||||
'-i',
|
||||
'dir1',
|
||||
'-F',
|
||||
'test',
|
||||
'-F',
|
||||
'test2',
|
||||
'-B',
|
||||
'thomasrockhu/test',
|
||||
'-b',
|
||||
@@ -131,15 +94,12 @@ test('all arguments', () => {
|
||||
'root/',
|
||||
'-s',
|
||||
'coverage/',
|
||||
'-r',
|
||||
'fakeOwner/fakeRepo',
|
||||
'-u',
|
||||
'https://codecov.enterprise.com',
|
||||
'-v',
|
||||
'-q',
|
||||
'codecov/',
|
||||
'-D',
|
||||
'~/Library/Developer/Xcode/DerivedData',
|
||||
'-J',
|
||||
'MyApp',
|
||||
]);
|
||||
expect(filepath).toEqual('src/codecov.sh');
|
||||
expect(failCi).toBeTruthy();
|
||||
|
||||
for (const env of Object.keys(envs)) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const core = require('@actions/core');
|
||||
const github = require('@actions/github');
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
|
||||
import {version} from '../package.json';
|
||||
|
||||
const context = github.context;
|
||||
|
||||
@@ -17,22 +19,14 @@ const isTrue = (variable) => {
|
||||
const buildExec = () => {
|
||||
const clean = core.getInput('move_coverage_to_trash');
|
||||
const commitParent = core.getInput('commit_parent');
|
||||
const curlAwsArgs = core.getInput('aws_curl_args');
|
||||
const curlCodecovArgs = core.getInput('codecov_curl_args');
|
||||
const envVars = core.getInput('env_vars');
|
||||
const dryRun = isTrue(core.getInput('dry_run'));
|
||||
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
||||
const file = core.getInput('file');
|
||||
const files = core.getInput('files');
|
||||
const flags = core.getInput('flags');
|
||||
const functionalities = core.getInput('functionalities');
|
||||
const gcovArgs = core.getInput('gcov_args');
|
||||
const gcovDir = core.getInput('gcov_root_dir');
|
||||
const gcovExclude = core.getInput('gcov_path_exclude');
|
||||
const gcovExec = core.getInput('gcov_executable');
|
||||
const gcovInclude = core.getInput('gcov_path_include');
|
||||
const gcovPrefix = core.getInput('gcov_prefix');
|
||||
const name = core.getInput('name');
|
||||
const networkFilter = core.getInput('network_filter');
|
||||
const overrideBranch = core.getInput('override_branch');
|
||||
const overrideBuild = core.getInput('override_build');
|
||||
const overrideCommit = core.getInput('override_commit');
|
||||
@@ -40,18 +34,19 @@ const buildExec = () => {
|
||||
const overrideTag = core.getInput('override_tag');
|
||||
const rootDir = core.getInput('root_dir');
|
||||
const searchDir = core.getInput('directory');
|
||||
const slug = core.getInput('slug');
|
||||
const token = core.getInput('token');
|
||||
const verbose = isTrue(core.getInput('verbose'));
|
||||
const url = core.getInput('url');
|
||||
const workingDir = core.getInput('working-directory');
|
||||
const writePath = core.getInput('path_to_write_report');
|
||||
const xcodeDerivedData = core.getInput('xcode_derived_data');
|
||||
const xcodePackage = core.getInput('xcode_package');
|
||||
|
||||
const filepath = workingDir ?
|
||||
workingDir + '/codecov.sh' : 'codecov.sh';
|
||||
|
||||
const execArgs = [filepath];
|
||||
execArgs.push( '-n', `${name}`, '-F', `${flags}`, '-Q', 'github-action' );
|
||||
const execArgs = [];
|
||||
execArgs.push(
|
||||
'-n',
|
||||
`${name}`,
|
||||
'-Q',
|
||||
`github-action-${version}`,
|
||||
);
|
||||
|
||||
const options:any = {};
|
||||
options.env = Object.assign(process.env, {
|
||||
@@ -81,15 +76,17 @@ const buildExec = () => {
|
||||
if (commitParent) {
|
||||
execArgs.push('-N', `${commitParent}`);
|
||||
}
|
||||
if (curlAwsArgs) {
|
||||
execArgs.push('-A', `${curlAwsArgs}`);
|
||||
}
|
||||
if (curlCodecovArgs) {
|
||||
execArgs.push('-U', `${curlCodecovArgs}`);
|
||||
if (dryRun) {
|
||||
execArgs.push('-d');
|
||||
}
|
||||
if (envVarsArg.length) {
|
||||
execArgs.push('-e', envVarsArg.join(','));
|
||||
}
|
||||
if (functionalities) {
|
||||
functionalities.split(',').forEach((f) => {
|
||||
execArgs.push('-X', `${f}`);
|
||||
});
|
||||
}
|
||||
if (failCi) {
|
||||
execArgs.push('-Z');
|
||||
}
|
||||
@@ -101,32 +98,11 @@ const buildExec = () => {
|
||||
execArgs.push('-f', `${f}`);
|
||||
});
|
||||
}
|
||||
if (functionalities) {
|
||||
functionalities.split(',').forEach((f) => {
|
||||
execArgs.push('-X', `${f}`);
|
||||
if (flags) {
|
||||
flags.split(',').forEach((f) => {
|
||||
execArgs.push('-F', `${f}`);
|
||||
});
|
||||
}
|
||||
if (gcovArgs) {
|
||||
execArgs.push('-a', `${gcovArgs}`);
|
||||
}
|
||||
if (gcovDir) {
|
||||
execArgs.push('-p', `${gcovDir}`);
|
||||
}
|
||||
if (gcovExclude) {
|
||||
execArgs.push('-g', `${gcovExclude}`);
|
||||
}
|
||||
if (gcovExec) {
|
||||
execArgs.push('-x', `${gcovExec}`);
|
||||
}
|
||||
if (gcovInclude) {
|
||||
execArgs.push('-G', `${gcovInclude}`);
|
||||
}
|
||||
if (gcovPrefix) {
|
||||
execArgs.push('-k', `${gcovPrefix}`);
|
||||
}
|
||||
if (networkFilter) {
|
||||
execArgs.push('-i', `${networkFilter}`);
|
||||
}
|
||||
if (overrideBranch) {
|
||||
execArgs.push('-B', `${overrideBranch}`);
|
||||
}
|
||||
@@ -157,23 +133,20 @@ const buildExec = () => {
|
||||
if (searchDir) {
|
||||
execArgs.push('-s', `${searchDir}`);
|
||||
}
|
||||
if (slug) {
|
||||
execArgs.push('-r', `${slug}`);
|
||||
}
|
||||
if (url) {
|
||||
execArgs.push('-u', `${url}`);
|
||||
}
|
||||
if (verbose) {
|
||||
execArgs.push('-v');
|
||||
}
|
||||
if (workingDir) {
|
||||
options.cwd = workingDir;
|
||||
}
|
||||
if (writePath) {
|
||||
execArgs.push('-q', `${writePath}`);
|
||||
}
|
||||
if (xcodeDerivedData) {
|
||||
execArgs.push('-D', `${xcodeDerivedData}`);
|
||||
}
|
||||
if (xcodePackage) {
|
||||
execArgs.push('-J', `${xcodePackage}`);
|
||||
}
|
||||
|
||||
return {execArgs, options, filepath, failCi};
|
||||
return {execArgs, options, failCi};
|
||||
};
|
||||
|
||||
export default buildExec;
|
||||
|
||||
41
src/helpers.ts
Normal file
41
src/helpers.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
const PLATFORMS = ['alpine', 'linux', 'macos', 'windows'];
|
||||
|
||||
const setFailure = (message: string, failCi: boolean): void => {
|
||||
failCi ? core.setFailed(message) : core.warning(message);
|
||||
if (failCi) {
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
|
||||
const getUploaderName = (): string => {
|
||||
if (isWindows()) {
|
||||
return 'codecov.exe';
|
||||
} else {
|
||||
return 'codecov';
|
||||
}
|
||||
};
|
||||
|
||||
const isValidPlatform = (): boolean => {
|
||||
return PLATFORMS.includes(getPlatform());
|
||||
};
|
||||
|
||||
const isWindows = (): boolean => {
|
||||
return getPlatform() === 'windows';
|
||||
};
|
||||
|
||||
const getPlatform = (): string => {
|
||||
return process.env.RUNNER_OS.toLowerCase();
|
||||
};
|
||||
|
||||
const BASEURL = `https://uploader.codecov.io/latest/${getPlatform()}/${getUploaderName()}`;
|
||||
|
||||
export {
|
||||
BASEURL,
|
||||
getPlatform,
|
||||
getUploaderName,
|
||||
isValidPlatform,
|
||||
isWindows,
|
||||
setFailure,
|
||||
};
|
||||
122
src/index.ts
122
src/index.ts
@@ -1,69 +1,69 @@
|
||||
const core = require('@actions/core');
|
||||
const exec = require('@actions/exec');
|
||||
import * as fs from 'fs';
|
||||
import * as https from 'https';
|
||||
import * as path from 'path';
|
||||
|
||||
const fs = require('fs');
|
||||
const request = require('requestretry');
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
import buildExec from './buildExec';
|
||||
import {
|
||||
BASEURL,
|
||||
getPlatform,
|
||||
getUploaderName,
|
||||
isValidPlatform,
|
||||
setFailure,
|
||||
} from './helpers';
|
||||
|
||||
import verify from './validate';
|
||||
|
||||
let failCi;
|
||||
|
||||
try {
|
||||
request({
|
||||
json: false,
|
||||
maxAttempts: 10,
|
||||
timeout: 3000,
|
||||
url: 'https://codecov.io/bash',
|
||||
}, (error, response, body) => {
|
||||
const {execArgs, options, filepath, failCi} = buildExec();
|
||||
|
||||
try {
|
||||
if (error && failCi) {
|
||||
throw error;
|
||||
} else if (error) {
|
||||
core.warning(`Codecov warning: ${error.message}`);
|
||||
}
|
||||
|
||||
fs.writeFile(filepath, body, (err) => {
|
||||
if (err && failCi) {
|
||||
throw err;
|
||||
} else if (err) {
|
||||
core.warning(`Codecov warning: ${err.message}`);
|
||||
}
|
||||
|
||||
exec.exec('bash', execArgs, options)
|
||||
.catch((err) => {
|
||||
if (failCi) {
|
||||
core.setFailed(
|
||||
`Codecov failed with the following error: ${err.message}`,
|
||||
);
|
||||
} else {
|
||||
core.warning(`Codecov warning: ${err.message}`);
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
unlinkFile();
|
||||
});
|
||||
|
||||
const unlinkFile = () => {
|
||||
fs.unlink(filepath, (err) => {
|
||||
if (err && failCi) {
|
||||
throw err;
|
||||
} else if (err) {
|
||||
core.warning(`Codecov warning: ${err.message}`);
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
core.setFailed(
|
||||
`Codecov failed with the following error: ${error.message}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
if (failCi) {
|
||||
core.setFailed(`Codecov failed with the following error: ${error.message}`);
|
||||
} else {
|
||||
core.warning(`Codecov warning: ${error.message}`);
|
||||
const {execArgs, options, failCi} = buildExec();
|
||||
const platform = getPlatform();
|
||||
if (!isValidPlatform()) {
|
||||
setFailure(
|
||||
`Codecov: Encountered an unexpected platform: ${platform}`,
|
||||
failCi,
|
||||
);
|
||||
}
|
||||
const filename = path.join( __dirname, getUploaderName());
|
||||
https.get(BASEURL, (res) => {
|
||||
// Image will be stored at this path
|
||||
const filePath = fs.createWriteStream(filename);
|
||||
res.pipe(filePath);
|
||||
filePath
|
||||
.on('error', (err) => {
|
||||
setFailure(
|
||||
`Codecov: Failed to write uploader binary: ${err.message}`,
|
||||
true,
|
||||
);
|
||||
}).on('finish', async () => {
|
||||
filePath.close();
|
||||
|
||||
await verify(filename);
|
||||
await fs.chmodSync(filename, '777');
|
||||
|
||||
const unlink = () => {
|
||||
fs.unlink(filename, (err) => {
|
||||
if (err) {
|
||||
setFailure(
|
||||
`Codecov: Could not unlink uploader: ${err.message}`,
|
||||
failCi,
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
await exec.exec(filename, execArgs, options)
|
||||
.catch((err) => {
|
||||
setFailure(
|
||||
`Codecov: Failed to properly upload: ${err.message}`,
|
||||
failCi,
|
||||
);
|
||||
}).then(() => {
|
||||
unlink();
|
||||
});
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
setFailure(`Codecov: Encountered an unexpected error ${err.message}`, failCi);
|
||||
}
|
||||
|
||||
52
src/pgp_keys.asc
Normal file
52
src/pgp_keys.asc
Normal file
@@ -0,0 +1,52 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBGCsMn0BEACiCKZOhkbhUjb+obvhH49p3ShjJzU5b/GqAXSDhRhdXUq7ZoGq
|
||||
KEKCd7sQHrCf16Pi5UVacGIyE9hS93HwY15kMlLwM+lNeAeCglEscOjpCly1qUIr
|
||||
sN1wjkd2cwDXS6zHBJTqJ7wSOiXbZfTAeKhd6DuLEpmA+Rz4Yc+4qZP+fVxVG3Pv
|
||||
2v06m+E5CP/JQVQPO8HYi+S36hJImTh+zaDspu+VujSai5KzJ6YKmgwslVNIp5X5
|
||||
GnEr2uAh5w6UTnt9UQUjFFliAvQ3lPLWzm7DWs6AP9hslYxSWzwbzVF5qbOIjUJL
|
||||
KfoUpvCYDs2ObgRn8WUQO0ndkRCBIxhlF3HGGYWKQaCEsiom7lyi8VbAszmUCDjw
|
||||
HdbQHFmm5yHLpTXJbg+iaxQzKnhWVXzye5/x92IJmJswW81Ky346VxYdC1XFL/+Y
|
||||
zBaj9oMmV7WfRpdch09Gf4TgosMzWf3NjJbtKE5xkaghJckIgxwzcrRmF/RmCJue
|
||||
IMqZ8A5qUUlK7NBzj51xmAQ4BtkUa2bcCBRV/vP+rk9wcBWz2LiaW+7Mwlfr/C/Q
|
||||
Swvv/JW2LsQ4iWc1BY7m7ksn9dcdypEq/1JbIzVLCRDG7pbMj9yLgYmhe5TtjOM3
|
||||
ygk25584EhXSgUA3MZw+DIqhbHQBYgrKndTr2N/wuBQY62zZg1YGQByD4QARAQAB
|
||||
tEpDb2RlY292IFVwbG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N5Q2fqiAi5R6BmCCO4ISF
|
||||
o5j10gGU/sdqGHvNhv5C21ibun7HEzMtxBhnhGmytfBJzrsj7GOReePsfTLoCoUq
|
||||
dFMOAVUDciVfRtL2m8cv42ZJOXtPfDjsFOf8AKJk40/tc8mMMqZP7RVBr9RWOoq5
|
||||
y9D37NfI6UB8rPZ6qs0a1Vfm8lIh2/k1AFECduXgftMDTsmmXOgXXS37HukGW7AL
|
||||
QKWiWJQF/XopkXwkyAYpyuyRMZ77oF7nuqLFnl5VVEiRo0Fwu45erebc6ccSwYZU
|
||||
8pmeSx7s0aJtxCZPSZEKZ3mn0BXOR32Cgs48CjzFWf6PKucTwOy/YO0/4Gt/upNJ
|
||||
3DyeINcYcKyD08DEIF9f5tLyoiD4xz+N23ltTBoMPyv4f3X/wCQ=
|
||||
=ch7z
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
74
src/validate.ts
Normal file
74
src/validate.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import * as crypto from 'crypto';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import * as core from '@actions/core';
|
||||
import * as openpgp from 'openpgp';
|
||||
import * as fetch from 'node-fetch';
|
||||
|
||||
import {
|
||||
BASEURL,
|
||||
getUploaderName,
|
||||
setFailure,
|
||||
} from './helpers';
|
||||
|
||||
const verify = async (filename: string) => {
|
||||
try {
|
||||
const uploaderName = getUploaderName();
|
||||
|
||||
// Read in public key
|
||||
const publicKeyArmored = await fs.readFileSync(
|
||||
path.join(__dirname, 'pgp_keys.asc'),
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
// Get SHASUM and SHASUM signature files
|
||||
const shasumRes = await fetch( `${BASEURL}.SHA256SUM`);
|
||||
const shasum = await shasumRes.text();
|
||||
|
||||
const shaSigRes = await fetch( `${BASEURL}.SHA256SUM.sig`);
|
||||
const shaSig = await shaSigRes.text();
|
||||
|
||||
// Verify shasum
|
||||
const verified = await openpgp.verify({
|
||||
message: await openpgp.createMessage({text: shasum}),
|
||||
signature: await openpgp.readSignature({armoredSignature: shaSig}),
|
||||
verificationKeys: await openpgp.readKeys({armoredKeys: publicKeyArmored}),
|
||||
});
|
||||
const valid = await verified.signatures[0].verified;
|
||||
if (valid) {
|
||||
core.info('==> SHASUM file signed by key id ' +
|
||||
verified.signatures[0].keyID.toHex(),
|
||||
);
|
||||
} else {
|
||||
setFailure('Codecov: Error validating SHASUM signature', true);
|
||||
}
|
||||
|
||||
const calculateHash = async (filename: string) => {
|
||||
const stream = fs.createReadStream(filename);
|
||||
const uploaderSha = crypto.createHash(`sha256`);
|
||||
stream.pipe(uploaderSha);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
stream.on('end', () => resolve(
|
||||
`${uploaderSha.digest('hex')} ${uploaderName}`,
|
||||
));
|
||||
stream.on('error', reject);
|
||||
});
|
||||
};
|
||||
|
||||
const hash = await calculateHash(filename);
|
||||
if (hash === shasum) {
|
||||
core.info(`==> Uploader SHASUM verified (${hash})`);
|
||||
} else {
|
||||
setFailure(
|
||||
'Codecov: Uploader shasum does not match -- ' +
|
||||
`uploader hash: ${hash}, public hash: ${shasum}`,
|
||||
true,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
setFailure(`Codecov: Error validating uploader: ${err.message}`, true);
|
||||
}
|
||||
};
|
||||
export default verify;
|
||||
@@ -1,5 +1,17 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "dist/",
|
||||
"resolveJsonModule": true,
|
||||
"rootDir": ".",
|
||||
"sourceMap": true,
|
||||
"target": "es2015"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"src/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user