mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-08 16:16:24 +00:00
Compare commits
182 Commits
snyk-fix-8
...
v4.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0016507ac7 | ||
|
|
c9e4b73267 | ||
|
|
c9e0f0b3cf | ||
|
|
da8479a5b3 | ||
|
|
8e29a53ea6 | ||
|
|
162bda9838 | ||
|
|
46acd9de81 | ||
|
|
904bf5a031 | ||
|
|
267c1ae7ba | ||
|
|
398b9de041 | ||
|
|
a08d532ca1 | ||
|
|
db68c7a205 | ||
|
|
7811627418 | ||
|
|
c3a18848b8 | ||
|
|
36dbb833d4 | ||
|
|
04adcebd9b | ||
|
|
836e505c14 | ||
|
|
3d80684171 | ||
|
|
0a6ec24b18 | ||
|
|
f257191299 | ||
|
|
030fc6b0c7 | ||
|
|
6991c70c83 | ||
|
|
2b88a0bb95 | ||
|
|
de1b515b0f | ||
|
|
8a36907d84 | ||
|
|
8ccb892add | ||
|
|
c17956f54f | ||
|
|
e1dd05cde2 | ||
|
|
8f4394ce71 | ||
|
|
5f0db07700 | ||
|
|
c47ccb92bf | ||
|
|
223b2a5870 | ||
|
|
dc7955ad4d | ||
|
|
5b168f78a6 | ||
|
|
6a48e74ab1 | ||
|
|
eaaf4bedf3 | ||
|
|
c2ab9ab2e1 | ||
|
|
49c20db375 | ||
|
|
cf8e3e4262 | ||
|
|
1c34415a06 | ||
|
|
b4dfea724f | ||
|
|
5bf250470e | ||
|
|
1dd0ce34be | ||
|
|
894ff025c7 | ||
|
|
f539f977d5 | ||
|
|
6757614f24 | ||
|
|
cdee249da5 | ||
|
|
ce548e935a | ||
|
|
40a12dcee2 | ||
|
|
030a000ec6 | ||
|
|
91e184765d | ||
|
|
cc7fb3f71c | ||
|
|
fee48966e2 | ||
|
|
ddd8c1b461 | ||
|
|
76e2f5265e | ||
|
|
9b87723d6a | ||
|
|
13d8b070d5 | ||
|
|
4b062cb89c | ||
|
|
61ac410891 | ||
|
|
927bc26587 | ||
|
|
ce0bcc6545 | ||
|
|
48f9a51f89 | ||
|
|
83bb3d0210 | ||
|
|
e3c8ffd812 | ||
|
|
704d393840 | ||
|
|
742000aae0 | ||
|
|
8b063424e4 | ||
|
|
842e0917ee | ||
|
|
a0f542a57e | ||
|
|
d660f23757 | ||
|
|
4eab105708 | ||
|
|
5e7b9c90d0 | ||
|
|
e418d185b8 | ||
|
|
0a0c29f6e1 | ||
|
|
a622646a2c | ||
|
|
644e02d3c9 | ||
|
|
f480a52db5 | ||
|
|
e0fbd592d3 | ||
|
|
d9f34f8cd5 | ||
|
|
0e9e7b4e8a | ||
|
|
7f20bd4c41 | ||
|
|
13bc2536ab | ||
|
|
5c0da1b28f | ||
|
|
68d5f6d0be | ||
|
|
2a829b95de | ||
|
|
8e09eaf1b4 | ||
|
|
39e222921f | ||
|
|
b2b7703473 | ||
|
|
6f4f74dd60 | ||
|
|
3dbd745e61 | ||
|
|
76f0319234 | ||
|
|
3b97abb4e5 | ||
|
|
dd819f8a8a | ||
|
|
963c54109b | ||
|
|
95faa5a026 | ||
|
|
a2d3766e60 | ||
|
|
f62b75a7da | ||
|
|
6d96cd710b | ||
|
|
4d5e2702f8 | ||
|
|
0c0df47689 | ||
|
|
93e388beec | ||
|
|
721720f939 | ||
|
|
8eb06817e2 | ||
|
|
e12c307842 | ||
|
|
0fb8cc0045 | ||
|
|
17d5f7fd73 | ||
|
|
2037dcb530 | ||
|
|
f68665b473 | ||
|
|
eab630b0a5 | ||
|
|
b7d228a249 | ||
|
|
5cf08ddf91 | ||
|
|
cbf117b92b | ||
|
|
79227c8a3e | ||
|
|
a51f451c4d | ||
|
|
c99c922c5e | ||
|
|
3a932f30ee | ||
|
|
fe1c74e432 | ||
|
|
a4b66e8ccb | ||
|
|
5b0152ad71 | ||
|
|
34e7489f32 | ||
|
|
d633e271ad | ||
|
|
22ec2ddfa5 | ||
|
|
53cfbc752e | ||
|
|
81cd2dc814 | ||
|
|
a03184e530 | ||
|
|
6a6a9ae7b1 | ||
|
|
92a872a5e7 | ||
|
|
43a9c182dd | ||
|
|
13ce822ccd | ||
|
|
4d6dbaaea6 | ||
|
|
98f0f19300 | ||
|
|
d3021d9910 | ||
|
|
2c83f35c20 | ||
|
|
e3c560433a | ||
|
|
174efc5984 | ||
|
|
6243a75ef3 | ||
|
|
0d6466ff9c | ||
|
|
d4729eeb39 | ||
|
|
351baf62fa | ||
|
|
d8cf6802a8 | ||
|
|
b775e9013c | ||
|
|
2ebc2f0f6f | ||
|
|
8e2ef2bfcc | ||
|
|
5f458f03fe | ||
|
|
398eded4bc | ||
|
|
9af8a2b3c9 | ||
|
|
57fe0bb86d | ||
|
|
e0cb890d01 | ||
|
|
36c973b6e9 | ||
|
|
adc3ab95ef | ||
|
|
184819f51c | ||
|
|
351939570f | ||
|
|
86baaaf3a3 | ||
|
|
7ab2ce5d95 | ||
|
|
c3d40623c9 | ||
|
|
9e4b071621 | ||
|
|
ac6033346c | ||
|
|
c76bf12730 | ||
|
|
f37520c6b0 | ||
|
|
f78e7e3295 | ||
|
|
8930ac6d38 | ||
|
|
ef0a21c8b8 | ||
|
|
3568e51c1c | ||
|
|
8b32ec40ba | ||
|
|
b049ab51f4 | ||
|
|
a85bdd422f | ||
|
|
108007e68f | ||
|
|
bf6b3a72da | ||
|
|
a485989079 | ||
|
|
7b31018a7e | ||
|
|
bcaaa7b51e | ||
|
|
d1701787c1 | ||
|
|
d7cfb89995 | ||
|
|
e01bbc8240 | ||
|
|
db6357e737 | ||
|
|
6f19c0f88c | ||
|
|
6c33a9bebe | ||
|
|
c2991883fa | ||
|
|
56370063d3 | ||
|
|
50287531e1 | ||
|
|
2f3807462c | ||
|
|
d964f8d698 |
69
.github/workflows/codeql-analysis.yml
vendored
Normal file
69
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '24 6 * * 5'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4.0.0
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2.21.5
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2.21.5
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2.21.5
|
||||
20
.github/workflows/main.yml
vendored
20
.github/workflows/main.yml
vendored
@@ -8,13 +8,15 @@ jobs:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4.0.0
|
||||
- name: Upload coverage to Codecov (script)
|
||||
uses: ./
|
||||
with:
|
||||
files: ./coverage/script/coverage-final.json
|
||||
flags: script,${{ matrix.os }}
|
||||
name: codecov-script
|
||||
verbose: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
- name: Upload coverage to Codecov (demo)
|
||||
uses: ./
|
||||
with:
|
||||
@@ -22,6 +24,8 @@ jobs:
|
||||
file: ./coverage/coverage-final.json
|
||||
flags: demo,${{ matrix.os }}
|
||||
name: codecov-demo
|
||||
verbose: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
- name: Upload coverage to Codecov (version)
|
||||
uses: ./
|
||||
with:
|
||||
@@ -29,7 +33,9 @@ jobs:
|
||||
file: ./coverage/coverage-final.json
|
||||
flags: version,${{ matrix.os }}
|
||||
name: codecov-version
|
||||
version: v0.1.0_8880
|
||||
version: v0.2.0
|
||||
verbose: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
run:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
@@ -37,7 +43,7 @@ jobs:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v4.0.0
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Lint
|
||||
@@ -50,6 +56,8 @@ jobs:
|
||||
files: ./coverage/script/coverage-final.json
|
||||
flags: script,${{ matrix.os }}
|
||||
name: codecov-script
|
||||
verbose: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
- name: Upload coverage to Codecov (demo)
|
||||
uses: ./
|
||||
with:
|
||||
@@ -57,6 +65,8 @@ jobs:
|
||||
file: ./coverage/coverage-final.json
|
||||
flags: demo,${{ matrix.os }}
|
||||
name: codecov-demo
|
||||
verbose: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
- name: Upload coverage to Codecov (version)
|
||||
uses: ./
|
||||
with:
|
||||
@@ -64,4 +74,6 @@ jobs:
|
||||
file: ./coverage/coverage-final.json
|
||||
flags: version,${{ matrix.os }}
|
||||
name: codecov-version
|
||||
version: v0.1.0_8880
|
||||
version: v0.2.0
|
||||
verbose: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
61
.github/workflows/scorecards-analysis.yml
vendored
Normal file
61
.github/workflows/scorecards-analysis.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
name: Scorecards supply-chain security
|
||||
on:
|
||||
# Only the default branch is supported.
|
||||
branch_protection_rule:
|
||||
schedule:
|
||||
- cron: '43 20 * * 1'
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecards analysis
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Used to receive a badge. (Upcoming feature)
|
||||
id-token: write
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@v4.0.0 # v3.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
# (Optional) Read-only PAT token. Uncomment the `repo_token` line below if:
|
||||
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||
# - you are installing Scorecards on a *private* repository
|
||||
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
|
||||
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
|
||||
|
||||
# Publish the results for public repositories to enable scorecard badges. For more details, see
|
||||
# https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories, `publish_results` will automatically be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@v2.21.5 # v1.0.26
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
135
CHANGELOG.md
135
CHANGELOG.md
@@ -1,3 +1,138 @@
|
||||
## 4.0.0-beta.1
|
||||
|
||||
`v4` represents a move from the [universal uploader](https://github.com/codecov/uploader) to the [Codecov CLI](https://github.com/codecov/codecov-cli). Although this will unlock new features for our users, the CLI is not yet at feature parity with the universal uploader.
|
||||
|
||||
### Breaking Changes
|
||||
- No current support for `aarch64` and `alpine` architectures.
|
||||
- Tokenless uploading is unsuported
|
||||
- Various arguments to the Action have been removed
|
||||
|
||||
## 3.1.4
|
||||
### Fixes
|
||||
- #967 Fix typo in README.md
|
||||
- #971 fix: add back in working dir
|
||||
- #969 fix: CLI option names for uploader
|
||||
|
||||
### Dependencies
|
||||
- #970 build(deps-dev): bump @types/node from 18.15.12 to 18.16.3
|
||||
- #979 build(deps-dev): bump @types/node from 20.1.0 to 20.1.2
|
||||
- #981 build(deps-dev): bump @types/node from 20.1.2 to 20.1.4
|
||||
|
||||
## 3.1.3
|
||||
### Fixes
|
||||
- #960 fix: allow for aarch64 build
|
||||
|
||||
### Dependencies
|
||||
- #957 build(deps-dev): bump jest-junit from 15.0.0 to 16.0.0
|
||||
- #958 build(deps): bump openpgp from 5.7.0 to 5.8.0
|
||||
- #959 build(deps-dev): bump @types/node from 18.15.10 to 18.15.12
|
||||
|
||||
## 3.1.2
|
||||
### Fixes
|
||||
- #718 Update README.md
|
||||
- #851 Remove unsupported path_to_write_report argument
|
||||
- #898 codeql-analysis.yml
|
||||
- #901 Update README to contain correct information - inputs and negate feature
|
||||
- #955 fix: add in all the extra arguments for uploader
|
||||
|
||||
### Dependencies
|
||||
- #819 build(deps): bump openpgp from 5.4.0 to 5.5.0
|
||||
- #835 build(deps): bump node-fetch from 3.2.4 to 3.2.10
|
||||
- #840 build(deps): bump ossf/scorecard-action from 1.1.1 to 2.0.4
|
||||
- #841 build(deps): bump @actions/core from 1.9.1 to 1.10.0
|
||||
- #843 build(deps): bump @actions/github from 5.0.3 to 5.1.1
|
||||
- #869 build(deps): bump node-fetch from 3.2.10 to 3.3.0
|
||||
- #872 build(deps-dev): bump jest-junit from 13.2.0 to 15.0.0
|
||||
- #879 build(deps): bump decode-uri-component from 0.2.0 to 0.2.2
|
||||
- #889 build(deps): bump ossf/scorecard-action from 1.1.1 to 2.1.2
|
||||
- #895 build(deps): bump json5 from 2.2.1 to 2.2.3
|
||||
- #896 build(deps): bump actions/upload-artifact from 3.1.0 to 3.1.2
|
||||
- #900 build(deps-dev): bump @vercel/ncc from 0.34.0 to 0.36.1
|
||||
- #905 build(deps-dev): bump typescript from 4.7.4 to 4.9.5
|
||||
- #911 build(deps-dev): bump @types/node from 16.11.40 to 18.13.0
|
||||
- #922 build(deps-dev): bump @types/node from 18.13.0 to 18.14.0
|
||||
- #924 build(deps): bump openpgp from 5.5.0 to 5.7.0
|
||||
- #927 build(deps-dev): bump @types/node from 18.14.0 to 18.14.2
|
||||
- #933 build(deps-dev): bump @types/node from 18.14.2 to 18.14.6
|
||||
- #937 build(deps-dev): bump @types/node from 18.14.6 to 18.15.0
|
||||
- #938 build(deps): bump node-fetch from 3.3.0 to 3.3.1
|
||||
- #945 build(deps-dev): bump @types/node from 18.15.0 to 18.15.5
|
||||
- #946 build(deps-dev): bump @types/node from 18.15.5 to 18.15.6
|
||||
- #947 build(deps-dev): bump @types/node from 18.15.6 to 18.15.10
|
||||
- #951 build(deps): bump ossf/scorecard-action from 2.1.2 to 2.1.3
|
||||
|
||||
## 3.1.1
|
||||
### Fixes
|
||||
- #661 Update deprecation warning
|
||||
- #593 Create codeql-analysis.yml
|
||||
- #712 README: fix typo
|
||||
- #725 fix: Remove a blank row
|
||||
- #726 Update README.md with correct badge version
|
||||
- #633 Create scorecards-analysis.yml
|
||||
- #747 fix: add more verbosity to validation
|
||||
- #750 Regenerate scorecards-analysis.yml
|
||||
- #774 Switch to v3
|
||||
- #783 Fix network entry in table
|
||||
- #791 Trim arguments after splitting them
|
||||
- #769 Plumb failCi into verification function.
|
||||
|
||||
### Dependencies
|
||||
- #713 build(deps-dev): bump typescript from 4.6.3 to 4.6.4
|
||||
- #714 build(deps): bump node-fetch from 3.2.3 to 3.2.4
|
||||
- #724 build(deps): bump github/codeql-action from 1 to 2
|
||||
- #717 build(deps-dev): bump @types/jest from 27.4.1 to 27.5.0
|
||||
- #729 build(deps-dev): bump @types/node from 17.0.25 to 17.0.33
|
||||
- #734 build(deps-dev): downgrade @types/node to 16.11.35
|
||||
- #723 build(deps): bump actions/checkout from 2 to 3
|
||||
- #733 build(deps): bump @actions/github from 5.0.1 to 5.0.3
|
||||
- #732 build(deps): bump @actions/core from 1.6.0 to 1.8.2
|
||||
- #737 build(deps-dev): bump @types/node from 16.11.35 to 16.11.36
|
||||
- #749 build(deps): bump ossf/scorecard-action from 1.0.1 to 1.1.0
|
||||
- #755 build(deps-dev): bump typescript from 4.6.4 to 4.7.3
|
||||
- #759 build(deps-dev): bump @types/node from 16.11.36 to 16.11.39
|
||||
- #762 build(deps-dev): bump @types/node from 16.11.39 to 16.11.40
|
||||
- #746 build(deps-dev): bump @vercel/ncc from 0.33.4 to 0.34.0
|
||||
- #757 build(deps): bump ossf/scorecard-action from 1.1.0 to 1.1.1
|
||||
- #760 build(deps): bump openpgp from 5.2.1 to 5.3.0
|
||||
- #748 build(deps): bump actions/upload-artifact from 2.3.1 to 3.1.0
|
||||
- #766 build(deps-dev): bump typescript from 4.7.3 to 4.7.4
|
||||
- #799 build(deps): bump openpgp from 5.3.0 to 5.4.0
|
||||
- #798 build(deps): bump @actions/core from 1.8.2 to 1.9.1
|
||||
|
||||
## 3.1.0
|
||||
### Features
|
||||
- #699 Incorporate `xcode` arguments for the Codecov uploader
|
||||
|
||||
### Dependencies
|
||||
- #694 build(deps-dev): bump @vercel/ncc from 0.33.3 to 0.33.4
|
||||
- #696 build(deps-dev): bump @types/node from 17.0.23 to 17.0.25
|
||||
- #698 build(deps-dev): bump jest-junit from 13.0.0 to 13.2.0
|
||||
|
||||
## 3.0.0
|
||||
### Breaking Changes
|
||||
- #689 Bump to node16 and small fixes
|
||||
|
||||
### Features
|
||||
- #688 Incorporate `gcov` arguments for the Codecov uploader
|
||||
|
||||
### Dependencies
|
||||
- #548 build(deps-dev): bump jest-junit from 12.2.0 to 13.0.0
|
||||
- #603 [Snyk] Upgrade @actions/core from 1.5.0 to 1.6.0
|
||||
- #628 build(deps): bump node-fetch from 2.6.1 to 3.1.1
|
||||
- #634 build(deps): bump node-fetch from 3.1.1 to 3.2.0
|
||||
- #636 build(deps): bump openpgp from 5.0.1 to 5.1.0
|
||||
- #652 build(deps-dev): bump @vercel/ncc from 0.30.0 to 0.33.3
|
||||
- #653 build(deps-dev): bump @types/node from 16.11.21 to 17.0.18
|
||||
- #659 build(deps-dev): bump @types/jest from 27.4.0 to 27.4.1
|
||||
- #667 build(deps): bump actions/checkout from 2 to 3
|
||||
- #673 build(deps): bump node-fetch from 3.2.0 to 3.2.3
|
||||
- #683 build(deps): bump minimist from 1.2.5 to 1.2.6
|
||||
- #685 build(deps): bump @actions/github from 5.0.0 to 5.0.1
|
||||
- #681 build(deps-dev): bump @types/node from 17.0.18 to 17.0.23
|
||||
- #682 build(deps-dev): bump typescript from 4.5.5 to 4.6.3
|
||||
- #676 build(deps): bump @actions/exec from 1.1.0 to 1.1.1
|
||||
- #675 build(deps): bump openpgp from 5.1.0 to 5.2.1
|
||||
|
||||
## 2.1.0
|
||||
### Features
|
||||
- #515 Allow specifying version of Codecov uploader
|
||||
|
||||
8
Makefile
8
Makefile
@@ -1,7 +1,7 @@
|
||||
deploy:
|
||||
$(eval VERSION := $(shell cat package.json | grep '"version": ' | cut -d\" -f4))
|
||||
git tag -d v2
|
||||
git push origin :v2
|
||||
git tag v2
|
||||
git tag v$(VERSION) -m ""
|
||||
git tag -d v3
|
||||
git push origin :v3
|
||||
git tag v3
|
||||
git tag v$(VERSION) -s -m ""
|
||||
git push origin --tags
|
||||
|
||||
75
README.md
75
README.md
@@ -1,30 +1,32 @@
|
||||
# Codecov GitHub Action
|
||||
|
||||
[](https://github.com/marketplace/actions/codecov)
|
||||
[](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!
|
||||
## v4 Beta Release
|
||||
`v4` of the Codecov GitHub Action will use the [Codecov CLI](https://github.com/codecov/codecov-cli) to upload coverage reports to Codecov. Currently, `v4` is in beta.
|
||||
|
||||
## ⚠️ Deprecration of v1
|
||||
**On February 1, 2022, this version will be fully sunset and no longer function**
|
||||
Breaking Changes
|
||||
- No current support for `aarch64` and `alpine` architectures.
|
||||
- Tokenless uploading is unsupported
|
||||
- Various arguments to the Action have been removed
|
||||
|
||||
`v3` versions and below will not have access to CLI features (e.g. global upload token).
|
||||
|
||||
## ⚠️ Deprecation of v1
|
||||
**As of February 1, 2022, v1 has been fully sunset and no longer functions**
|
||||
|
||||
Due to the [deprecation](https://about.codecov.io/blog/introducing-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
|
||||
the Codecov GitHub Action has released `v2`/`v3` 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 (`@v2` 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 (`@v3` 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**
|
||||
|
||||
@@ -33,9 +35,9 @@ Inside your `.github/workflows/workflow.yml` file:
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: codecov/codecov-action@v2
|
||||
- uses: codecov/codecov-action@v3
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./coverage1.xml,./coverage2.xml # optional
|
||||
flags: unittests # optional
|
||||
name: codecov-umbrella # optional
|
||||
@@ -46,35 +48,49 @@ steps:
|
||||
|
||||
## Arguments
|
||||
|
||||
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 supports inputs from the user. 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 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
|
||||
| | |
|
||||
| `token` | Used to authorize coverage report uploads | *Required |
|
||||
| `move_coverage_to_trash` | Move discovered coverage reports to the trash | 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
|
||||
| `dry_run` | Don't upload files to Codecov | 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
|
||||
-| | `network` Disable uploading the file network |
|
||||
| `move_coverage_to_trash` | Move discovered coverage reports to the trash | Optional
|
||||
| `files` | Comma-separated paths to the coverage report(s). Negated paths are supported by starting with `!` | Optional
|
||||
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
|
||||
| `full_report` | Specify the path of a full Codecov report to re-upload | Optional
|
||||
| `functionalities` | Toggle functionalities | Optional
|
||||
| -- `network` | Disable uploading the file network | Optional
|
||||
| -- `fixes` | Enable file fixes to ignore common lines from coverage | Optional
|
||||
| -- `search` | Disable searching for coverage files | Optional
|
||||
| `gcov` | Run with gcov support | Optional
|
||||
| `gcov_args` | Extra arguments to pass to gcov | Optional
|
||||
| `gcov_ignore` | Paths to ignore during gcov gathering | Optional
|
||||
| `gcov_include` | Paths to include during gcov gathering | Optional
|
||||
| `gcov_executable` | gcov executable to run. Defaults to gcov. | Optional
|
||||
| `name` | Custom defined name for the upload | Optional
|
||||
| `network_filter` | Specify a filter on the files listed in the network section of the Codecov report. Useful for upload-specific path fixing | Optional
|
||||
| `network_prefix` | Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing | Optional
|
||||
| `os` | Specify the OS (linux, macos, windows, alpine) | Optional
|
||||
| `override_branch` | Specify the branch name | Optional
|
||||
| `override_build` | Specify the build number | Optional
|
||||
| `override_commit` | Specify the commit SHA | Optional
|
||||
| `override_pr` | Specify the pull request number | Optional
|
||||
| `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
|
||||
| `directory` | Directory to search for coverage reports. | Optional
|
||||
| `slug` | Specify the slug manually (Enterprise use) | Optional
|
||||
| `swift` | Run with swift coverage support | Optional
|
||||
| -- `swift_project` | Specify the swift project to speed up coverage conversion | Optional
|
||||
| `upstream_proxy` | The upstream http proxy server to connect through | Optional
|
||||
| `url` | Change the upload host (Enterprise use) | Optional
|
||||
| `verbose` | Specify whether the Codecov output should be verbose | Optional
|
||||
| `version` | Specify which version of the Codecov Uploader should be used. Defaults to `latest` | Optional
|
||||
| `working-directory` | Directory in which to execute `codecov.sh` | Optional
|
||||
| `xtra_args` | Add additional uploader args that may be missing in the Action | Optional
|
||||
|
||||
|
||||
### Example `workflow.yml` with Codecov Action
|
||||
|
||||
@@ -89,29 +105,28 @@ jobs:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
env:
|
||||
OS: ${{ matrix.os }}
|
||||
PYTHON: '3.7'
|
||||
PYTHON: '3.10'
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@master
|
||||
with:
|
||||
python-version: 3.7
|
||||
python-version: 3.10
|
||||
- name: Generate coverage report
|
||||
run: |
|
||||
pip install pytest
|
||||
pip install pytest-cov
|
||||
pytest --cov=./ --cov-report=xml
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
directory: ./coverage/reports/
|
||||
env_vars: OS,PYTHON
|
||||
fail_ci_if_error: true
|
||||
files: ./coverage1.xml,./coverage2.xml
|
||||
files: ./coverage1.xml,./coverage2.xml,!./cache
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
path_to_write_report: ./coverage/codecov_report.txt
|
||||
verbose: true
|
||||
```
|
||||
## Contributing
|
||||
|
||||
32
action.yml
32
action.yml
@@ -5,6 +5,9 @@ inputs:
|
||||
token:
|
||||
description: 'Repository upload token - get it from codecov.io. Required only for private repositories'
|
||||
required: false
|
||||
file:
|
||||
description: 'Path to coverage file to upload'
|
||||
required: false
|
||||
files:
|
||||
description: 'Comma-separated list of files to upload'
|
||||
required: false
|
||||
@@ -14,9 +17,6 @@ inputs:
|
||||
flags:
|
||||
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
||||
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
|
||||
@@ -26,18 +26,15 @@ inputs:
|
||||
fail_ci_if_error:
|
||||
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
|
||||
required: false
|
||||
file:
|
||||
description: 'Path to coverage file to upload'
|
||||
required: false
|
||||
functionalities:
|
||||
description: 'Comma-separated list, see the README for options and their usage'
|
||||
required: false
|
||||
move_coverage_to_trash:
|
||||
description: 'Move discovered coverage reports to the trash'
|
||||
gcov:
|
||||
description: 'Run with gcov support'
|
||||
required: false
|
||||
name:
|
||||
description: 'User defined upload name. Visible in Codecov UI'
|
||||
required: false
|
||||
os:
|
||||
description: 'Override the assumed OS. Options are linux | macos | windows.'
|
||||
required: false
|
||||
override_branch:
|
||||
description: 'Specify the branch name'
|
||||
required: false
|
||||
@@ -50,26 +47,17 @@ inputs:
|
||||
override_pr:
|
||||
description: 'Specify the pull request number'
|
||||
required: false
|
||||
override_tag:
|
||||
description: 'Specify the git tag'
|
||||
required: false
|
||||
os:
|
||||
description: 'Override the assumed OS. Options are alpine | linux | macos | windows.'
|
||||
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
|
||||
version:
|
||||
description: 'Specify which version of the Codecov Uploader should be used. Defaults to `latest`'
|
||||
description: 'Specify which version of the Codecov CLI should be used. Defaults to `latest`'
|
||||
required: false
|
||||
working-directory:
|
||||
description: 'Directory in which to execute codecov.sh'
|
||||
@@ -78,5 +66,5 @@ branding:
|
||||
color: 'red'
|
||||
icon: 'umbrella'
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
||||
453
dist/37.index.js
vendored
Normal file
453
dist/37.index.js
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
"use strict";
|
||||
exports.id = 37;
|
||||
exports.ids = [37];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 4037:
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "toFormData": () => (/* binding */ toFormData)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2777);
|
||||
/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8010);
|
||||
|
||||
|
||||
|
||||
let s = 0;
|
||||
const S = {
|
||||
START_BOUNDARY: s++,
|
||||
HEADER_FIELD_START: s++,
|
||||
HEADER_FIELD: s++,
|
||||
HEADER_VALUE_START: s++,
|
||||
HEADER_VALUE: s++,
|
||||
HEADER_VALUE_ALMOST_DONE: s++,
|
||||
HEADERS_ALMOST_DONE: s++,
|
||||
PART_DATA_START: s++,
|
||||
PART_DATA: s++,
|
||||
END: s++
|
||||
};
|
||||
|
||||
let f = 1;
|
||||
const F = {
|
||||
PART_BOUNDARY: f,
|
||||
LAST_BOUNDARY: f *= 2
|
||||
};
|
||||
|
||||
const LF = 10;
|
||||
const CR = 13;
|
||||
const SPACE = 32;
|
||||
const HYPHEN = 45;
|
||||
const COLON = 58;
|
||||
const A = 97;
|
||||
const Z = 122;
|
||||
|
||||
const lower = c => c | 0x20;
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
class MultipartParser {
|
||||
/**
|
||||
* @param {string} boundary
|
||||
*/
|
||||
constructor(boundary) {
|
||||
this.index = 0;
|
||||
this.flags = 0;
|
||||
|
||||
this.onHeaderEnd = noop;
|
||||
this.onHeaderField = noop;
|
||||
this.onHeadersEnd = noop;
|
||||
this.onHeaderValue = noop;
|
||||
this.onPartBegin = noop;
|
||||
this.onPartData = noop;
|
||||
this.onPartEnd = noop;
|
||||
|
||||
this.boundaryChars = {};
|
||||
|
||||
boundary = '\r\n--' + boundary;
|
||||
const ui8a = new Uint8Array(boundary.length);
|
||||
for (let i = 0; i < boundary.length; i++) {
|
||||
ui8a[i] = boundary.charCodeAt(i);
|
||||
this.boundaryChars[ui8a[i]] = true;
|
||||
}
|
||||
|
||||
this.boundary = ui8a;
|
||||
this.lookbehind = new Uint8Array(this.boundary.length + 8);
|
||||
this.state = S.START_BOUNDARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
*/
|
||||
write(data) {
|
||||
let i = 0;
|
||||
const length_ = data.length;
|
||||
let previousIndex = this.index;
|
||||
let {lookbehind, boundary, boundaryChars, index, state, flags} = this;
|
||||
const boundaryLength = this.boundary.length;
|
||||
const boundaryEnd = boundaryLength - 1;
|
||||
const bufferLength = data.length;
|
||||
let c;
|
||||
let cl;
|
||||
|
||||
const mark = name => {
|
||||
this[name + 'Mark'] = i;
|
||||
};
|
||||
|
||||
const clear = name => {
|
||||
delete this[name + 'Mark'];
|
||||
};
|
||||
|
||||
const callback = (callbackSymbol, start, end, ui8a) => {
|
||||
if (start === undefined || start !== end) {
|
||||
this[callbackSymbol](ui8a && ui8a.subarray(start, end));
|
||||
}
|
||||
};
|
||||
|
||||
const dataCallback = (name, clear) => {
|
||||
const markSymbol = name + 'Mark';
|
||||
if (!(markSymbol in this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (clear) {
|
||||
callback(name, this[markSymbol], i, data);
|
||||
delete this[markSymbol];
|
||||
} else {
|
||||
callback(name, this[markSymbol], data.length, data);
|
||||
this[markSymbol] = 0;
|
||||
}
|
||||
};
|
||||
|
||||
for (i = 0; i < length_; i++) {
|
||||
c = data[i];
|
||||
|
||||
switch (state) {
|
||||
case S.START_BOUNDARY:
|
||||
if (index === boundary.length - 2) {
|
||||
if (c === HYPHEN) {
|
||||
flags |= F.LAST_BOUNDARY;
|
||||
} else if (c !== CR) {
|
||||
return;
|
||||
}
|
||||
|
||||
index++;
|
||||
break;
|
||||
} else if (index - 1 === boundary.length - 2) {
|
||||
if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
|
||||
state = S.END;
|
||||
flags = 0;
|
||||
} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
|
||||
index = 0;
|
||||
callback('onPartBegin');
|
||||
state = S.HEADER_FIELD_START;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (c !== boundary[index + 2]) {
|
||||
index = -2;
|
||||
}
|
||||
|
||||
if (c === boundary[index + 2]) {
|
||||
index++;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.HEADER_FIELD_START:
|
||||
state = S.HEADER_FIELD;
|
||||
mark('onHeaderField');
|
||||
index = 0;
|
||||
// falls through
|
||||
case S.HEADER_FIELD:
|
||||
if (c === CR) {
|
||||
clear('onHeaderField');
|
||||
state = S.HEADERS_ALMOST_DONE;
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
if (c === HYPHEN) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (c === COLON) {
|
||||
if (index === 1) {
|
||||
// empty header field
|
||||
return;
|
||||
}
|
||||
|
||||
dataCallback('onHeaderField', true);
|
||||
state = S.HEADER_VALUE_START;
|
||||
break;
|
||||
}
|
||||
|
||||
cl = lower(c);
|
||||
if (cl < A || cl > Z) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.HEADER_VALUE_START:
|
||||
if (c === SPACE) {
|
||||
break;
|
||||
}
|
||||
|
||||
mark('onHeaderValue');
|
||||
state = S.HEADER_VALUE;
|
||||
// falls through
|
||||
case S.HEADER_VALUE:
|
||||
if (c === CR) {
|
||||
dataCallback('onHeaderValue', true);
|
||||
callback('onHeaderEnd');
|
||||
state = S.HEADER_VALUE_ALMOST_DONE;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.HEADER_VALUE_ALMOST_DONE:
|
||||
if (c !== LF) {
|
||||
return;
|
||||
}
|
||||
|
||||
state = S.HEADER_FIELD_START;
|
||||
break;
|
||||
case S.HEADERS_ALMOST_DONE:
|
||||
if (c !== LF) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback('onHeadersEnd');
|
||||
state = S.PART_DATA_START;
|
||||
break;
|
||||
case S.PART_DATA_START:
|
||||
state = S.PART_DATA;
|
||||
mark('onPartData');
|
||||
// falls through
|
||||
case S.PART_DATA:
|
||||
previousIndex = index;
|
||||
|
||||
if (index === 0) {
|
||||
// boyer-moore derrived algorithm to safely skip non-boundary data
|
||||
i += boundaryEnd;
|
||||
while (i < bufferLength && !(data[i] in boundaryChars)) {
|
||||
i += boundaryLength;
|
||||
}
|
||||
|
||||
i -= boundaryEnd;
|
||||
c = data[i];
|
||||
}
|
||||
|
||||
if (index < boundary.length) {
|
||||
if (boundary[index] === c) {
|
||||
if (index === 0) {
|
||||
dataCallback('onPartData', true);
|
||||
}
|
||||
|
||||
index++;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
} else if (index === boundary.length) {
|
||||
index++;
|
||||
if (c === CR) {
|
||||
// CR = part boundary
|
||||
flags |= F.PART_BOUNDARY;
|
||||
} else if (c === HYPHEN) {
|
||||
// HYPHEN = end boundary
|
||||
flags |= F.LAST_BOUNDARY;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
} else if (index - 1 === boundary.length) {
|
||||
if (flags & F.PART_BOUNDARY) {
|
||||
index = 0;
|
||||
if (c === LF) {
|
||||
// unset the PART_BOUNDARY flag
|
||||
flags &= ~F.PART_BOUNDARY;
|
||||
callback('onPartEnd');
|
||||
callback('onPartBegin');
|
||||
state = S.HEADER_FIELD_START;
|
||||
break;
|
||||
}
|
||||
} else if (flags & F.LAST_BOUNDARY) {
|
||||
if (c === HYPHEN) {
|
||||
callback('onPartEnd');
|
||||
state = S.END;
|
||||
flags = 0;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (index > 0) {
|
||||
// when matching a possible boundary, keep a lookbehind reference
|
||||
// in case it turns out to be a false lead
|
||||
lookbehind[index - 1] = c;
|
||||
} else if (previousIndex > 0) {
|
||||
// if our boundary turned out to be rubbish, the captured lookbehind
|
||||
// belongs to partData
|
||||
const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
|
||||
callback('onPartData', 0, previousIndex, _lookbehind);
|
||||
previousIndex = 0;
|
||||
mark('onPartData');
|
||||
|
||||
// reconsider the current character even so it interrupted the sequence
|
||||
// it could be the beginning of a new sequence
|
||||
i--;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.END:
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unexpected state entered: ${state}`);
|
||||
}
|
||||
}
|
||||
|
||||
dataCallback('onHeaderField');
|
||||
dataCallback('onHeaderValue');
|
||||
dataCallback('onPartData');
|
||||
|
||||
// Update properties for the next call
|
||||
this.index = index;
|
||||
this.state = state;
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
end() {
|
||||
if ((this.state === S.HEADER_FIELD_START && this.index === 0) ||
|
||||
(this.state === S.PART_DATA && this.index === this.boundary.length)) {
|
||||
this.onPartEnd();
|
||||
} else if (this.state !== S.END) {
|
||||
throw new Error('MultipartParser.end(): stream ended unexpectedly');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _fileName(headerValue) {
|
||||
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
||||
if (!m) {
|
||||
return;
|
||||
}
|
||||
|
||||
const match = m[2] || m[3] || '';
|
||||
let filename = match.slice(match.lastIndexOf('\\') + 1);
|
||||
filename = filename.replace(/%22/g, '"');
|
||||
filename = filename.replace(/&#(\d{4});/g, (m, code) => {
|
||||
return String.fromCharCode(code);
|
||||
});
|
||||
return filename;
|
||||
}
|
||||
|
||||
async function toFormData(Body, ct) {
|
||||
if (!/multipart/i.test(ct)) {
|
||||
throw new TypeError('Failed to fetch');
|
||||
}
|
||||
|
||||
const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('no or bad content-type header, no multipart boundary');
|
||||
}
|
||||
|
||||
const parser = new MultipartParser(m[1] || m[2]);
|
||||
|
||||
let headerField;
|
||||
let headerValue;
|
||||
let entryValue;
|
||||
let entryName;
|
||||
let contentType;
|
||||
let filename;
|
||||
const entryChunks = [];
|
||||
const formData = new formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__/* .FormData */ .Ct();
|
||||
|
||||
const onPartData = ui8a => {
|
||||
entryValue += decoder.decode(ui8a, {stream: true});
|
||||
};
|
||||
|
||||
const appendToFile = ui8a => {
|
||||
entryChunks.push(ui8a);
|
||||
};
|
||||
|
||||
const appendFileToFormData = () => {
|
||||
const file = new fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__/* .File */ .$B(entryChunks, filename, {type: contentType});
|
||||
formData.append(entryName, file);
|
||||
};
|
||||
|
||||
const appendEntryToFormData = () => {
|
||||
formData.append(entryName, entryValue);
|
||||
};
|
||||
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
decoder.decode();
|
||||
|
||||
parser.onPartBegin = function () {
|
||||
parser.onPartData = onPartData;
|
||||
parser.onPartEnd = appendEntryToFormData;
|
||||
|
||||
headerField = '';
|
||||
headerValue = '';
|
||||
entryValue = '';
|
||||
entryName = '';
|
||||
contentType = '';
|
||||
filename = null;
|
||||
entryChunks.length = 0;
|
||||
};
|
||||
|
||||
parser.onHeaderField = function (ui8a) {
|
||||
headerField += decoder.decode(ui8a, {stream: true});
|
||||
};
|
||||
|
||||
parser.onHeaderValue = function (ui8a) {
|
||||
headerValue += decoder.decode(ui8a, {stream: true});
|
||||
};
|
||||
|
||||
parser.onHeaderEnd = function () {
|
||||
headerValue += decoder.decode();
|
||||
headerField = headerField.toLowerCase();
|
||||
|
||||
if (headerField === 'content-disposition') {
|
||||
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||
const m = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
||||
|
||||
if (m) {
|
||||
entryName = m[2] || m[3] || '';
|
||||
}
|
||||
|
||||
filename = _fileName(headerValue);
|
||||
|
||||
if (filename) {
|
||||
parser.onPartData = appendToFile;
|
||||
parser.onPartEnd = appendFileToFormData;
|
||||
}
|
||||
} else if (headerField === 'content-type') {
|
||||
contentType = headerValue;
|
||||
}
|
||||
|
||||
headerValue = '';
|
||||
headerField = '';
|
||||
};
|
||||
|
||||
for await (const chunk of Body) {
|
||||
parser.write(chunk);
|
||||
}
|
||||
|
||||
parser.end();
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
//# sourceMappingURL=37.index.js.map
|
||||
1
dist/37.index.js.map
vendored
Normal file
1
dist/37.index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
453
dist/629.index.js
vendored
Normal file
453
dist/629.index.js
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
exports.id = 629;
|
||||
exports.ids = [629];
|
||||
exports.modules = {
|
||||
|
||||
/***/ 6629:
|
||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ "toFormData": () => (/* binding */ toFormData)
|
||||
/* harmony export */ });
|
||||
/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4818);
|
||||
/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1402);
|
||||
|
||||
|
||||
|
||||
let s = 0;
|
||||
const S = {
|
||||
START_BOUNDARY: s++,
|
||||
HEADER_FIELD_START: s++,
|
||||
HEADER_FIELD: s++,
|
||||
HEADER_VALUE_START: s++,
|
||||
HEADER_VALUE: s++,
|
||||
HEADER_VALUE_ALMOST_DONE: s++,
|
||||
HEADERS_ALMOST_DONE: s++,
|
||||
PART_DATA_START: s++,
|
||||
PART_DATA: s++,
|
||||
END: s++
|
||||
};
|
||||
|
||||
let f = 1;
|
||||
const F = {
|
||||
PART_BOUNDARY: f,
|
||||
LAST_BOUNDARY: f *= 2
|
||||
};
|
||||
|
||||
const LF = 10;
|
||||
const CR = 13;
|
||||
const SPACE = 32;
|
||||
const HYPHEN = 45;
|
||||
const COLON = 58;
|
||||
const A = 97;
|
||||
const Z = 122;
|
||||
|
||||
const lower = c => c | 0x20;
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
class MultipartParser {
|
||||
/**
|
||||
* @param {string} boundary
|
||||
*/
|
||||
constructor(boundary) {
|
||||
this.index = 0;
|
||||
this.flags = 0;
|
||||
|
||||
this.onHeaderEnd = noop;
|
||||
this.onHeaderField = noop;
|
||||
this.onHeadersEnd = noop;
|
||||
this.onHeaderValue = noop;
|
||||
this.onPartBegin = noop;
|
||||
this.onPartData = noop;
|
||||
this.onPartEnd = noop;
|
||||
|
||||
this.boundaryChars = {};
|
||||
|
||||
boundary = '\r\n--' + boundary;
|
||||
const ui8a = new Uint8Array(boundary.length);
|
||||
for (let i = 0; i < boundary.length; i++) {
|
||||
ui8a[i] = boundary.charCodeAt(i);
|
||||
this.boundaryChars[ui8a[i]] = true;
|
||||
}
|
||||
|
||||
this.boundary = ui8a;
|
||||
this.lookbehind = new Uint8Array(this.boundary.length + 8);
|
||||
this.state = S.START_BOUNDARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Uint8Array} data
|
||||
*/
|
||||
write(data) {
|
||||
let i = 0;
|
||||
const length_ = data.length;
|
||||
let previousIndex = this.index;
|
||||
let {lookbehind, boundary, boundaryChars, index, state, flags} = this;
|
||||
const boundaryLength = this.boundary.length;
|
||||
const boundaryEnd = boundaryLength - 1;
|
||||
const bufferLength = data.length;
|
||||
let c;
|
||||
let cl;
|
||||
|
||||
const mark = name => {
|
||||
this[name + 'Mark'] = i;
|
||||
};
|
||||
|
||||
const clear = name => {
|
||||
delete this[name + 'Mark'];
|
||||
};
|
||||
|
||||
const callback = (callbackSymbol, start, end, ui8a) => {
|
||||
if (start === undefined || start !== end) {
|
||||
this[callbackSymbol](ui8a && ui8a.subarray(start, end));
|
||||
}
|
||||
};
|
||||
|
||||
const dataCallback = (name, clear) => {
|
||||
const markSymbol = name + 'Mark';
|
||||
if (!(markSymbol in this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (clear) {
|
||||
callback(name, this[markSymbol], i, data);
|
||||
delete this[markSymbol];
|
||||
} else {
|
||||
callback(name, this[markSymbol], data.length, data);
|
||||
this[markSymbol] = 0;
|
||||
}
|
||||
};
|
||||
|
||||
for (i = 0; i < length_; i++) {
|
||||
c = data[i];
|
||||
|
||||
switch (state) {
|
||||
case S.START_BOUNDARY:
|
||||
if (index === boundary.length - 2) {
|
||||
if (c === HYPHEN) {
|
||||
flags |= F.LAST_BOUNDARY;
|
||||
} else if (c !== CR) {
|
||||
return;
|
||||
}
|
||||
|
||||
index++;
|
||||
break;
|
||||
} else if (index - 1 === boundary.length - 2) {
|
||||
if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
|
||||
state = S.END;
|
||||
flags = 0;
|
||||
} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
|
||||
index = 0;
|
||||
callback('onPartBegin');
|
||||
state = S.HEADER_FIELD_START;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (c !== boundary[index + 2]) {
|
||||
index = -2;
|
||||
}
|
||||
|
||||
if (c === boundary[index + 2]) {
|
||||
index++;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.HEADER_FIELD_START:
|
||||
state = S.HEADER_FIELD;
|
||||
mark('onHeaderField');
|
||||
index = 0;
|
||||
// falls through
|
||||
case S.HEADER_FIELD:
|
||||
if (c === CR) {
|
||||
clear('onHeaderField');
|
||||
state = S.HEADERS_ALMOST_DONE;
|
||||
break;
|
||||
}
|
||||
|
||||
index++;
|
||||
if (c === HYPHEN) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (c === COLON) {
|
||||
if (index === 1) {
|
||||
// empty header field
|
||||
return;
|
||||
}
|
||||
|
||||
dataCallback('onHeaderField', true);
|
||||
state = S.HEADER_VALUE_START;
|
||||
break;
|
||||
}
|
||||
|
||||
cl = lower(c);
|
||||
if (cl < A || cl > Z) {
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.HEADER_VALUE_START:
|
||||
if (c === SPACE) {
|
||||
break;
|
||||
}
|
||||
|
||||
mark('onHeaderValue');
|
||||
state = S.HEADER_VALUE;
|
||||
// falls through
|
||||
case S.HEADER_VALUE:
|
||||
if (c === CR) {
|
||||
dataCallback('onHeaderValue', true);
|
||||
callback('onHeaderEnd');
|
||||
state = S.HEADER_VALUE_ALMOST_DONE;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.HEADER_VALUE_ALMOST_DONE:
|
||||
if (c !== LF) {
|
||||
return;
|
||||
}
|
||||
|
||||
state = S.HEADER_FIELD_START;
|
||||
break;
|
||||
case S.HEADERS_ALMOST_DONE:
|
||||
if (c !== LF) {
|
||||
return;
|
||||
}
|
||||
|
||||
callback('onHeadersEnd');
|
||||
state = S.PART_DATA_START;
|
||||
break;
|
||||
case S.PART_DATA_START:
|
||||
state = S.PART_DATA;
|
||||
mark('onPartData');
|
||||
// falls through
|
||||
case S.PART_DATA:
|
||||
previousIndex = index;
|
||||
|
||||
if (index === 0) {
|
||||
// boyer-moore derrived algorithm to safely skip non-boundary data
|
||||
i += boundaryEnd;
|
||||
while (i < bufferLength && !(data[i] in boundaryChars)) {
|
||||
i += boundaryLength;
|
||||
}
|
||||
|
||||
i -= boundaryEnd;
|
||||
c = data[i];
|
||||
}
|
||||
|
||||
if (index < boundary.length) {
|
||||
if (boundary[index] === c) {
|
||||
if (index === 0) {
|
||||
dataCallback('onPartData', true);
|
||||
}
|
||||
|
||||
index++;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
} else if (index === boundary.length) {
|
||||
index++;
|
||||
if (c === CR) {
|
||||
// CR = part boundary
|
||||
flags |= F.PART_BOUNDARY;
|
||||
} else if (c === HYPHEN) {
|
||||
// HYPHEN = end boundary
|
||||
flags |= F.LAST_BOUNDARY;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
} else if (index - 1 === boundary.length) {
|
||||
if (flags & F.PART_BOUNDARY) {
|
||||
index = 0;
|
||||
if (c === LF) {
|
||||
// unset the PART_BOUNDARY flag
|
||||
flags &= ~F.PART_BOUNDARY;
|
||||
callback('onPartEnd');
|
||||
callback('onPartBegin');
|
||||
state = S.HEADER_FIELD_START;
|
||||
break;
|
||||
}
|
||||
} else if (flags & F.LAST_BOUNDARY) {
|
||||
if (c === HYPHEN) {
|
||||
callback('onPartEnd');
|
||||
state = S.END;
|
||||
flags = 0;
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
} else {
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (index > 0) {
|
||||
// when matching a possible boundary, keep a lookbehind reference
|
||||
// in case it turns out to be a false lead
|
||||
lookbehind[index - 1] = c;
|
||||
} else if (previousIndex > 0) {
|
||||
// if our boundary turned out to be rubbish, the captured lookbehind
|
||||
// belongs to partData
|
||||
const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
|
||||
callback('onPartData', 0, previousIndex, _lookbehind);
|
||||
previousIndex = 0;
|
||||
mark('onPartData');
|
||||
|
||||
// reconsider the current character even so it interrupted the sequence
|
||||
// it could be the beginning of a new sequence
|
||||
i--;
|
||||
}
|
||||
|
||||
break;
|
||||
case S.END:
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unexpected state entered: ${state}`);
|
||||
}
|
||||
}
|
||||
|
||||
dataCallback('onHeaderField');
|
||||
dataCallback('onHeaderValue');
|
||||
dataCallback('onPartData');
|
||||
|
||||
// Update properties for the next call
|
||||
this.index = index;
|
||||
this.state = state;
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
end() {
|
||||
if ((this.state === S.HEADER_FIELD_START && this.index === 0) ||
|
||||
(this.state === S.PART_DATA && this.index === this.boundary.length)) {
|
||||
this.onPartEnd();
|
||||
} else if (this.state !== S.END) {
|
||||
throw new Error('MultipartParser.end(): stream ended unexpectedly');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _fileName(headerValue) {
|
||||
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
||||
if (!m) {
|
||||
return;
|
||||
}
|
||||
|
||||
const match = m[2] || m[3] || '';
|
||||
let filename = match.slice(match.lastIndexOf('\\') + 1);
|
||||
filename = filename.replace(/%22/g, '"');
|
||||
filename = filename.replace(/&#(\d{4});/g, (m, code) => {
|
||||
return String.fromCharCode(code);
|
||||
});
|
||||
return filename;
|
||||
}
|
||||
|
||||
async function toFormData(Body, ct) {
|
||||
if (!/multipart/i.test(ct)) {
|
||||
throw new TypeError('Failed to fetch');
|
||||
}
|
||||
|
||||
const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('no or bad content-type header, no multipart boundary');
|
||||
}
|
||||
|
||||
const parser = new MultipartParser(m[1] || m[2]);
|
||||
|
||||
let headerField;
|
||||
let headerValue;
|
||||
let entryValue;
|
||||
let entryName;
|
||||
let contentType;
|
||||
let filename;
|
||||
const entryChunks = [];
|
||||
const formData = new formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__/* .FormData */ .Ct();
|
||||
|
||||
const onPartData = ui8a => {
|
||||
entryValue += decoder.decode(ui8a, {stream: true});
|
||||
};
|
||||
|
||||
const appendToFile = ui8a => {
|
||||
entryChunks.push(ui8a);
|
||||
};
|
||||
|
||||
const appendFileToFormData = () => {
|
||||
const file = new fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__/* .File */ .$B(entryChunks, filename, {type: contentType});
|
||||
formData.append(entryName, file);
|
||||
};
|
||||
|
||||
const appendEntryToFormData = () => {
|
||||
formData.append(entryName, entryValue);
|
||||
};
|
||||
|
||||
const decoder = new TextDecoder('utf-8');
|
||||
decoder.decode();
|
||||
|
||||
parser.onPartBegin = function () {
|
||||
parser.onPartData = onPartData;
|
||||
parser.onPartEnd = appendEntryToFormData;
|
||||
|
||||
headerField = '';
|
||||
headerValue = '';
|
||||
entryValue = '';
|
||||
entryName = '';
|
||||
contentType = '';
|
||||
filename = null;
|
||||
entryChunks.length = 0;
|
||||
};
|
||||
|
||||
parser.onHeaderField = function (ui8a) {
|
||||
headerField += decoder.decode(ui8a, {stream: true});
|
||||
};
|
||||
|
||||
parser.onHeaderValue = function (ui8a) {
|
||||
headerValue += decoder.decode(ui8a, {stream: true});
|
||||
};
|
||||
|
||||
parser.onHeaderEnd = function () {
|
||||
headerValue += decoder.decode();
|
||||
headerField = headerField.toLowerCase();
|
||||
|
||||
if (headerField === 'content-disposition') {
|
||||
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||
const m = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
||||
|
||||
if (m) {
|
||||
entryName = m[2] || m[3] || '';
|
||||
}
|
||||
|
||||
filename = _fileName(headerValue);
|
||||
|
||||
if (filename) {
|
||||
parser.onPartData = appendToFile;
|
||||
parser.onPartEnd = appendFileToFormData;
|
||||
}
|
||||
} else if (headerField === 'content-type') {
|
||||
contentType = headerValue;
|
||||
}
|
||||
|
||||
headerValue = '';
|
||||
headerField = '';
|
||||
};
|
||||
|
||||
for await (const chunk of Body) {
|
||||
parser.write(chunk);
|
||||
}
|
||||
|
||||
parser.end();
|
||||
|
||||
return formData;
|
||||
}
|
||||
|
||||
|
||||
/***/ })
|
||||
|
||||
};
|
||||
;
|
||||
//# sourceMappingURL=629.index.js.map
|
||||
1
dist/629.index.js.map
vendored
Normal file
1
dist/629.index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
17070
dist/index.js
vendored
Normal file → Executable file
17070
dist/index.js
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/sourcemap-register.js
vendored
2
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
12590
package-lock.json
generated
12590
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "codecov-action",
|
||||
"version": "2.1.0",
|
||||
"version": "4.0.0-beta.1",
|
||||
"description": "Upload coverage reports to Codecov from GitHub Actions",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -16,30 +16,30 @@
|
||||
"url": "git+https://github.com/codecov/codecov-action.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Ibrahim Ali",
|
||||
"author": "Codecov",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/codecov/codecov-action/issues"
|
||||
},
|
||||
"homepage": "https://github.com/codecov/codecov-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.5.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"openpgp": "^5.0.0"
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^5.1.1",
|
||||
"node-fetch": "^3.3.2",
|
||||
"openpgp": "5.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.1",
|
||||
"@types/node": "^16.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
||||
"@typescript-eslint/parser": "^4.29.2",
|
||||
"@vercel/ncc": "^0.30.0",
|
||||
"eslint": "^7.32.0",
|
||||
"@types/jest": "^29.5.4",
|
||||
"@types/node": "^20.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.7.0",
|
||||
"@typescript-eslint/parser": "^6.7.0",
|
||||
"@vercel/ncc": "^0.38.0",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-junit": "^13.0.0",
|
||||
"ts-jest": "^26.5.6",
|
||||
"typescript": "^4.3.5"
|
||||
"jest": "^29.6.4",
|
||||
"jest-junit": "^16.0.0",
|
||||
"ts-jest": "^29.1.1",
|
||||
"typescript": "^5.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,58 @@
|
||||
import * as github from '@actions/github';
|
||||
|
||||
import buildExec from './buildExec';
|
||||
import {
|
||||
buildCommitExec,
|
||||
buildGeneralExec,
|
||||
buildReportExec,
|
||||
buildUploadExec,
|
||||
} from './buildExec';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const {version} = require('../package.json');
|
||||
|
||||
const context = github.context;
|
||||
|
||||
test('no arguments', () => {
|
||||
const {execArgs, failCi} = buildExec();
|
||||
|
||||
const args = [
|
||||
'-n',
|
||||
'',
|
||||
'-Q',
|
||||
`github-action-${version}`,
|
||||
];
|
||||
if (context.eventName == 'pull_request') {
|
||||
args.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
test('general args', () => {
|
||||
const envs = {
|
||||
url: 'https://codecov.enterprise.com',
|
||||
verbose: 't',
|
||||
};
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
|
||||
const {args, verbose} = buildGeneralExec();
|
||||
|
||||
expect(args).toEqual(
|
||||
expect.arrayContaining([
|
||||
'--enterprise-url',
|
||||
'https://codecov.enterprise.com',
|
||||
'-v',
|
||||
]));
|
||||
expect(verbose).toBeTruthy();
|
||||
for (const env of Object.keys(envs)) {
|
||||
delete process.env['INPUT_' + env.toUpperCase()];
|
||||
}
|
||||
expect(execArgs).toEqual(args);
|
||||
expect(failCi).toBeFalsy();
|
||||
});
|
||||
|
||||
test('all arguments', () => {
|
||||
|
||||
test('upload args using context', () => {
|
||||
const expectedArgs = [
|
||||
'-n',
|
||||
'',
|
||||
];
|
||||
const {uploadExecArgs, uploadCommand} = buildUploadExec();
|
||||
if (context.eventName == 'pull_request') {
|
||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
if (context.eventName == 'pull_request_target') {
|
||||
expectedArgs.push('-P', `${context.payload.number}`);
|
||||
}
|
||||
|
||||
expect(uploadExecArgs).toEqual(expectedArgs);
|
||||
expect(uploadCommand).toEqual('do-upload');
|
||||
});
|
||||
|
||||
test('upload args', () => {
|
||||
const envs = {
|
||||
'commit_parent': '83231650328f11695dfb754ca0f540516f188d27',
|
||||
'directory': 'coverage/',
|
||||
'dry_run': 'true',
|
||||
'env_vars': 'OS,PYTHON',
|
||||
@@ -33,42 +60,29 @@ test('all arguments', () => {
|
||||
'file': 'coverage.xml',
|
||||
'files': 'dir1/coverage.xml,dir2/coverage.xml',
|
||||
'flags': 'test,test2',
|
||||
'functionalities':
|
||||
'network',
|
||||
'move_coverage_to_trash': 'true',
|
||||
'name': 'codecov',
|
||||
'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/',
|
||||
'slug': 'fakeOwner/fakeRepo',
|
||||
'token': 'd3859757-ab80-4664-924d-aef22fa7557b',
|
||||
'url': 'https://codecov.enterprise.com',
|
||||
'verbose': 't',
|
||||
'working-directory': 'src',
|
||||
'plugin': 'xcode',
|
||||
'exclude': 'src',
|
||||
};
|
||||
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
|
||||
const {execArgs, failCi} = buildExec();
|
||||
expect(execArgs).toEqual([
|
||||
const {uploadExecArgs, uploadCommand} = buildUploadExec();
|
||||
const expectedArgs = [
|
||||
'-n',
|
||||
'codecov',
|
||||
'-Q',
|
||||
`github-action-${version}`,
|
||||
'-c',
|
||||
'-N',
|
||||
'83231650328f11695dfb754ca0f540516f188d27',
|
||||
'-d',
|
||||
'-e',
|
||||
'OS,PYTHON',
|
||||
'-X',
|
||||
'network',
|
||||
'-Z',
|
||||
'-f',
|
||||
'coverage.xml',
|
||||
@@ -88,21 +102,119 @@ test('all arguments', () => {
|
||||
'9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||
'-P',
|
||||
'2',
|
||||
'-T',
|
||||
'v1.2',
|
||||
'-R',
|
||||
'--network-root-folder',
|
||||
'root/',
|
||||
'-s',
|
||||
'coverage/',
|
||||
'-r',
|
||||
'fakeOwner/fakeRepo',
|
||||
'-u',
|
||||
'https://codecov.enterprise.com',
|
||||
'-v',
|
||||
]);
|
||||
expect(failCi).toBeTruthy();
|
||||
'--plugin',
|
||||
'xcode',
|
||||
'--exclude',
|
||||
'src',
|
||||
];
|
||||
|
||||
expect(uploadExecArgs).toEqual(expectedArgs);
|
||||
expect(uploadCommand).toEqual('do-upload');
|
||||
for (const env of Object.keys(envs)) {
|
||||
delete process.env['INPUT_' + env.toUpperCase()];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test('report args', () => {
|
||||
const envs = {
|
||||
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||
slug: 'fakeOwner/fakeRepo',
|
||||
token: 'd3859757-ab80-4664-924d-aef22fa7557b',
|
||||
};
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
|
||||
const {reportExecArgs, reportCommand} = buildReportExec();
|
||||
|
||||
expect(reportExecArgs).toEqual(
|
||||
expect.arrayContaining([
|
||||
'-C',
|
||||
'9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||
'--slug',
|
||||
'fakeOwner/fakeRepo',
|
||||
]));
|
||||
expect(reportCommand).toEqual('create-report');
|
||||
for (const env of Object.keys(envs)) {
|
||||
delete process.env['INPUT_' + env.toUpperCase()];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test('report args using context', () => {
|
||||
const envs = {
|
||||
token: 'd3859757-ab80-4664-924d-aef22fa7557b',
|
||||
};
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
const expectedArgs : string[] = [];
|
||||
if (context.eventName == 'pull_request') {
|
||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
|
||||
const {reportExecArgs, reportCommand} = buildReportExec();
|
||||
|
||||
expect(reportExecArgs).toEqual(expectedArgs);
|
||||
expect(reportCommand).toEqual('create-report');
|
||||
for (const env of Object.keys(envs)) {
|
||||
delete process.env['INPUT_' + env.toUpperCase()];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test('commit args', () => {
|
||||
const envs = {
|
||||
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||
slug: 'fakeOwner/fakeRepo',
|
||||
token: 'd3859757-ab80-4664-924d-aef22fa7557b',
|
||||
override_branch: 'thomasrockhu/test',
|
||||
override_pr: '2',
|
||||
commit_parent: '83231650328f11695dfb754ca0f540516f188d27',
|
||||
};
|
||||
for (const env of Object.keys(envs)) {
|
||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||
}
|
||||
|
||||
const {commitExecArgs, commitCommand} = buildCommitExec();
|
||||
|
||||
expect(commitExecArgs).toEqual(
|
||||
expect.arrayContaining([
|
||||
'-C',
|
||||
'9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||
'--slug',
|
||||
'fakeOwner/fakeRepo',
|
||||
'-B',
|
||||
'thomasrockhu/test',
|
||||
'--pr',
|
||||
'2',
|
||||
'--parent-sha',
|
||||
'83231650328f11695dfb754ca0f540516f188d27',
|
||||
]));
|
||||
expect(commitCommand).toEqual('create-commit');
|
||||
for (const env of Object.keys(envs)) {
|
||||
delete process.env['INPUT_' + env.toUpperCase()];
|
||||
}
|
||||
});
|
||||
|
||||
test('commit args using context', () => {
|
||||
const expectedArgs :string[] = [];
|
||||
|
||||
const {commitExecArgs, commitCommand} = buildCommitExec();
|
||||
if (context.eventName == 'pull_request') {
|
||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
if (context.eventName == 'pull_request_target') {
|
||||
expectedArgs.push('-P', `${context.payload.number}`);
|
||||
}
|
||||
|
||||
expect(commitExecArgs).toEqual(expectedArgs);
|
||||
expect(commitCommand).toEqual('create-commit');
|
||||
});
|
||||
|
||||
215
src/buildExec.ts
215
src/buildExec.ts
@@ -1,7 +1,8 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
|
||||
import {version} from '../package.json';
|
||||
|
||||
const context = github.context;
|
||||
|
||||
@@ -16,42 +17,145 @@ const isTrue = (variable) => {
|
||||
);
|
||||
};
|
||||
|
||||
const buildExec = () => {
|
||||
const clean = core.getInput('move_coverage_to_trash');
|
||||
|
||||
const buildCommitExec = () => {
|
||||
const commitParent = core.getInput('commit_parent');
|
||||
const overrideBranch = core.getInput('override_branch');
|
||||
const overrideCommit = core.getInput('override_commit');
|
||||
const overridePr = core.getInput('override_pr');
|
||||
const slug = core.getInput('slug');
|
||||
const token = core.getInput('token');
|
||||
|
||||
|
||||
const commitCommand = 'create-commit';
|
||||
const commitExecArgs = [];
|
||||
|
||||
const commitOptions:any = {};
|
||||
commitOptions.env = Object.assign(process.env, {
|
||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||
GITHUB_REF: process.env.GITHUB_REF,
|
||||
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
|
||||
GITHUB_SHA: process.env.GITHUB_SHA,
|
||||
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || '',
|
||||
});
|
||||
|
||||
|
||||
if (token) {
|
||||
commitOptions.env.CODECOV_TOKEN = token;
|
||||
}
|
||||
if (commitParent) {
|
||||
commitExecArgs.push('--parent-sha', `${commitParent}`);
|
||||
}
|
||||
|
||||
if (overrideBranch) {
|
||||
commitExecArgs.push('-B', `${overrideBranch}`);
|
||||
}
|
||||
if (overrideCommit) {
|
||||
commitExecArgs.push('-C', `${overrideCommit}`);
|
||||
} else if (
|
||||
`${context.eventName}` == 'pull_request' ||
|
||||
`${context.eventName}` == 'pull_request_target'
|
||||
) {
|
||||
commitExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
if (overridePr) {
|
||||
commitExecArgs.push('--pr', `${overridePr}`);
|
||||
} else if (
|
||||
`${context.eventName}` == 'pull_request_target'
|
||||
) {
|
||||
commitExecArgs.push('--pr', `${context.payload.number}`);
|
||||
}
|
||||
if (slug) {
|
||||
commitExecArgs.push('--slug', `${slug}`);
|
||||
}
|
||||
|
||||
|
||||
return {commitExecArgs, commitOptions, commitCommand};
|
||||
};
|
||||
|
||||
const buildGeneralExec = () => {
|
||||
const url = core.getInput('url');
|
||||
const verbose = isTrue(core.getInput('verbose'));
|
||||
const args = [];
|
||||
|
||||
if (url) {
|
||||
args.push('--enterprise-url', `${url}`);
|
||||
}
|
||||
if (verbose) {
|
||||
args.push('-v');
|
||||
}
|
||||
return {args, verbose};
|
||||
};
|
||||
|
||||
const buildReportExec = () => {
|
||||
const overrideCommit = core.getInput('override_commit');
|
||||
const slug = core.getInput('slug');
|
||||
const token = core.getInput('token');
|
||||
|
||||
|
||||
const reportCommand = 'create-report';
|
||||
const reportExecArgs = [];
|
||||
|
||||
const reportOptions:any = {};
|
||||
reportOptions.env = Object.assign(process.env, {
|
||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||
GITHUB_REF: process.env.GITHUB_REF,
|
||||
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
|
||||
GITHUB_SHA: process.env.GITHUB_SHA,
|
||||
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || '',
|
||||
});
|
||||
|
||||
|
||||
if (token) {
|
||||
reportOptions.env.CODECOV_TOKEN = token;
|
||||
}
|
||||
if (overrideCommit) {
|
||||
reportExecArgs.push('-C', `${overrideCommit}`);
|
||||
} else if (
|
||||
`${context.eventName}` == 'pull_request' ||
|
||||
`${context.eventName}` == 'pull_request_target'
|
||||
) {
|
||||
reportExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
if (slug) {
|
||||
reportExecArgs.push('--slug', `${slug}`);
|
||||
}
|
||||
|
||||
return {reportExecArgs, reportOptions, reportCommand};
|
||||
};
|
||||
|
||||
const buildUploadExec = () => {
|
||||
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 name = core.getInput('name');
|
||||
const os = core.getInput('os');
|
||||
const overrideBranch = core.getInput('override_branch');
|
||||
const overrideBuild = core.getInput('override_build');
|
||||
const overrideCommit = core.getInput('override_commit');
|
||||
const overridePr = core.getInput('override_pr');
|
||||
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');
|
||||
let uploaderVersion = core.getInput('version');
|
||||
const url = core.getInput('url');
|
||||
const verbose = isTrue(core.getInput('verbose'));
|
||||
const workingDir = core.getInput('working-directory');
|
||||
const plugin = core.getInput('plugin');
|
||||
const exclude = core.getInput('exclude');
|
||||
|
||||
const execArgs = [];
|
||||
execArgs.push(
|
||||
const uploadExecArgs = [];
|
||||
uploadExecArgs.push(
|
||||
'-n',
|
||||
`${name}`,
|
||||
'-Q',
|
||||
`github-action-${version}`,
|
||||
);
|
||||
|
||||
const options:any = {};
|
||||
options.env = Object.assign(process.env, {
|
||||
const uploadCommand = 'do-upload';
|
||||
const uploadOptions:any = {};
|
||||
uploadOptions.env = Object.assign(process.env, {
|
||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
||||
GITHUB_REF: process.env.GITHUB_REF,
|
||||
@@ -64,95 +168,94 @@ const buildExec = () => {
|
||||
for (const envVar of envVars.split(',')) {
|
||||
const envVarClean = envVar.trim();
|
||||
if (envVarClean) {
|
||||
options.env[envVarClean] = process.env[envVarClean];
|
||||
uploadOptions.env[envVarClean] = process.env[envVarClean];
|
||||
envVarsArg.push(envVarClean);
|
||||
}
|
||||
}
|
||||
|
||||
if (token) {
|
||||
options.env.CODECOV_TOKEN = token;
|
||||
}
|
||||
if (clean) {
|
||||
execArgs.push('-c');
|
||||
}
|
||||
if (commitParent) {
|
||||
execArgs.push('-N', `${commitParent}`);
|
||||
uploadOptions.env.CODECOV_TOKEN = token;
|
||||
}
|
||||
if (dryRun) {
|
||||
execArgs.push('-d');
|
||||
uploadExecArgs.push('-d');
|
||||
}
|
||||
if (envVarsArg.length) {
|
||||
execArgs.push('-e', envVarsArg.join(','));
|
||||
}
|
||||
if (functionalities) {
|
||||
functionalities.split(',').forEach((f) => {
|
||||
execArgs.push('-X', `${f}`);
|
||||
});
|
||||
uploadExecArgs.push('-e', envVarsArg.join(','));
|
||||
}
|
||||
if (failCi) {
|
||||
execArgs.push('-Z');
|
||||
uploadExecArgs.push('-Z');
|
||||
}
|
||||
if (file) {
|
||||
execArgs.push('-f', `${file}`);
|
||||
uploadExecArgs.push('-f', `${file}`);
|
||||
}
|
||||
if (files) {
|
||||
files.split(',').forEach((f) => {
|
||||
execArgs.push('-f', `${f}`);
|
||||
files.split(',').map((f) => f.trim()).forEach((f) => {
|
||||
uploadExecArgs.push('-f', `${f}`);
|
||||
});
|
||||
}
|
||||
if (flags) {
|
||||
flags.split(',').forEach((f) => {
|
||||
execArgs.push('-F', `${f}`);
|
||||
flags.split(',').map((f) => f.trim()).forEach((f) => {
|
||||
uploadExecArgs.push('-F', `${f}`);
|
||||
});
|
||||
}
|
||||
if (overrideBranch) {
|
||||
execArgs.push('-B', `${overrideBranch}`);
|
||||
uploadExecArgs.push('-B', `${overrideBranch}`);
|
||||
}
|
||||
if (overrideBuild) {
|
||||
execArgs.push('-b', `${overrideBuild}`);
|
||||
uploadExecArgs.push('-b', `${overrideBuild}`);
|
||||
}
|
||||
if (overrideCommit) {
|
||||
execArgs.push('-C', `${overrideCommit}`);
|
||||
uploadExecArgs.push('-C', `${overrideCommit}`);
|
||||
} else if (
|
||||
`${context.eventName}` == 'pull_request' ||
|
||||
`${context.eventName}` == 'pull_request_target'
|
||||
) {
|
||||
execArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
uploadExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||
}
|
||||
if (overridePr) {
|
||||
execArgs.push('-P', `${overridePr}`);
|
||||
uploadExecArgs.push('-P', `${overridePr}`);
|
||||
} else if (
|
||||
`${context.eventName}` == 'pull_request_target'
|
||||
) {
|
||||
execArgs.push('-P', `${context.payload.number}`);
|
||||
}
|
||||
if (overrideTag) {
|
||||
execArgs.push('-T', `${overrideTag}`);
|
||||
uploadExecArgs.push('-P', `${context.payload.number}`);
|
||||
}
|
||||
if (rootDir) {
|
||||
execArgs.push('-R', `${rootDir}`);
|
||||
uploadExecArgs.push('--network-root-folder', `${rootDir}`);
|
||||
}
|
||||
if (searchDir) {
|
||||
execArgs.push('-s', `${searchDir}`);
|
||||
uploadExecArgs.push('-s', `${searchDir}`);
|
||||
}
|
||||
if (slug) {
|
||||
execArgs.push('-r', `${slug}`);
|
||||
}
|
||||
if (url) {
|
||||
execArgs.push('-u', `${url}`);
|
||||
}
|
||||
if (verbose) {
|
||||
execArgs.push('-v');
|
||||
uploadExecArgs.push('-r', `${slug}`);
|
||||
}
|
||||
if (workingDir) {
|
||||
options.cwd = workingDir;
|
||||
uploadOptions.cwd = workingDir;
|
||||
}
|
||||
if (plugin) {
|
||||
uploadExecArgs.push('--plugin', `${plugin}`);
|
||||
}
|
||||
if (exclude) {
|
||||
uploadExecArgs.push('--exclude', `${exclude}`);
|
||||
}
|
||||
|
||||
if (uploaderVersion == '') {
|
||||
uploaderVersion = 'latest';
|
||||
}
|
||||
|
||||
return {execArgs, options, failCi, os, uploaderVersion};
|
||||
return {
|
||||
uploadExecArgs,
|
||||
uploadOptions,
|
||||
failCi,
|
||||
os,
|
||||
uploaderVersion,
|
||||
uploadCommand,
|
||||
};
|
||||
};
|
||||
|
||||
export default buildExec;
|
||||
|
||||
export {
|
||||
buildCommitExec,
|
||||
buildGeneralExec,
|
||||
buildReportExec,
|
||||
buildUploadExec,
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
isValidPlatform,
|
||||
isWindows,
|
||||
PLATFORMS,
|
||||
getCommand,
|
||||
} from './helpers';
|
||||
|
||||
let OLDOS = process.env.RUNNER_OS;
|
||||
@@ -39,32 +40,35 @@ test('getBaseUrl', () => {
|
||||
expect(PLATFORMS.map((platform) => {
|
||||
return getBaseUrl(platform, 'latest');
|
||||
})).toEqual([
|
||||
'https://uploader.codecov.io/latest/alpine/codecov',
|
||||
'https://uploader.codecov.io/latest/linux/codecov',
|
||||
'https://uploader.codecov.io/latest/macos/codecov',
|
||||
'https://uploader.codecov.io/latest/windows/codecov.exe',
|
||||
'https://cli.codecov.io/latest/linux/codecov',
|
||||
'https://cli.codecov.io/latest/macos/codecov',
|
||||
'https://cli.codecov.io/latest/windows/codecov.exe',
|
||||
]);
|
||||
|
||||
expect(PLATFORMS.map((platform) => {
|
||||
return getBaseUrl(platform, 'v0.1.0_8880');
|
||||
})).toEqual([
|
||||
'https://uploader.codecov.io/v0.1.0_8880/alpine/codecov',
|
||||
'https://uploader.codecov.io/v0.1.0_8880/linux/codecov',
|
||||
'https://uploader.codecov.io/v0.1.0_8880/macos/codecov',
|
||||
'https://uploader.codecov.io/v0.1.0_8880/windows/codecov.exe',
|
||||
'https://cli.codecov.io/v0.1.0_8880/linux/codecov',
|
||||
'https://cli.codecov.io/v0.1.0_8880/macos/codecov',
|
||||
'https://cli.codecov.io/v0.1.0_8880/windows/codecov.exe',
|
||||
]);
|
||||
});
|
||||
|
||||
test('isWindows', () => {
|
||||
expect(PLATFORMS.map((platform) => {
|
||||
return isWindows(platform);
|
||||
})).toEqual([false, false, false, true]);
|
||||
})).toEqual([false, false, true]);
|
||||
});
|
||||
|
||||
test('isValidPlatform', () => {
|
||||
expect(PLATFORMS.map((platform) => {
|
||||
return isValidPlatform(platform);
|
||||
})).toEqual([true, true, true, true]);
|
||||
})).toEqual([true, true, true]);
|
||||
|
||||
expect(isValidPlatform('fakeos')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('getCommand', () => {
|
||||
expect(getCommand('path', ['-v', '-x'], 'do-upload'))
|
||||
.toEqual(['path', '-v', '-x', 'do-upload']);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
const PLATFORMS = ['alpine', 'linux', 'macos', 'windows'];
|
||||
const PLATFORMS = [
|
||||
'linux',
|
||||
'macos',
|
||||
'windows',
|
||||
];
|
||||
|
||||
const setFailure = (message: string, failCi: boolean): void => {
|
||||
failCi ? core.setFailed(message) : core.warning(message);
|
||||
@@ -44,7 +48,17 @@ const getPlatform = (os?: string): string => {
|
||||
};
|
||||
|
||||
const getBaseUrl = (platform: string, version: string): string => {
|
||||
return `https://uploader.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
||||
return `https://cli.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
||||
};
|
||||
|
||||
const getCommand = (
|
||||
filename: string,
|
||||
generalArgs:string[],
|
||||
command: string,
|
||||
): string[] => {
|
||||
const fullCommand = [filename, ...generalArgs, command];
|
||||
core.info(`==> Running command '${fullCommand.join(' ')}'`);
|
||||
return fullCommand;
|
||||
};
|
||||
|
||||
export {
|
||||
@@ -55,4 +69,5 @@ export {
|
||||
isValidPlatform,
|
||||
isWindows,
|
||||
setFailure,
|
||||
getCommand,
|
||||
};
|
||||
|
||||
71
src/index.ts
71
src/index.ts
@@ -4,12 +4,18 @@ import * as path from 'path';
|
||||
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
import buildExec from './buildExec';
|
||||
import {
|
||||
buildCommitExec,
|
||||
buildGeneralExec,
|
||||
buildReportExec,
|
||||
buildUploadExec,
|
||||
} from './buildExec';
|
||||
import {
|
||||
getBaseUrl,
|
||||
getPlatform,
|
||||
getUploaderName,
|
||||
setFailure,
|
||||
getCommand,
|
||||
} from './helpers';
|
||||
|
||||
import verify from './validate';
|
||||
@@ -18,7 +24,18 @@ import versionInfo from './version';
|
||||
let failCi;
|
||||
|
||||
try {
|
||||
const {execArgs, options, failCi, os, uploaderVersion} = buildExec();
|
||||
const {commitExecArgs, commitOptions, commitCommand} = buildCommitExec();
|
||||
const {reportExecArgs, reportOptions, reportCommand} = buildReportExec();
|
||||
const {
|
||||
uploadExecArgs,
|
||||
uploadOptions,
|
||||
failCi,
|
||||
os,
|
||||
uploaderVersion,
|
||||
uploadCommand,
|
||||
} = buildUploadExec();
|
||||
const {args, verbose} = buildGeneralExec();
|
||||
|
||||
const platform = getPlatform(os);
|
||||
|
||||
const filename = path.join( __dirname, getUploaderName(platform));
|
||||
@@ -35,7 +52,7 @@ try {
|
||||
}).on('finish', async () => {
|
||||
filePath.close();
|
||||
|
||||
await verify(filename, platform, uploaderVersion);
|
||||
await verify(filename, platform, uploaderVersion, verbose, failCi);
|
||||
await versionInfo(platform, uploaderVersion);
|
||||
await fs.chmodSync(filename, '777');
|
||||
|
||||
@@ -49,14 +66,52 @@ try {
|
||||
}
|
||||
});
|
||||
};
|
||||
await exec.exec(filename, execArgs, options)
|
||||
.catch((err) => {
|
||||
const doUpload = async () => {
|
||||
await exec.exec(getCommand(filename, args, uploadCommand).join(' '),
|
||||
uploadExecArgs,
|
||||
uploadOptions)
|
||||
.catch((err) => {
|
||||
setFailure(
|
||||
`Codecov:
|
||||
Failed to properly upload report: ${err.message}`,
|
||||
failCi,
|
||||
);
|
||||
});
|
||||
};
|
||||
const createReport = async () => {
|
||||
await exec.exec(
|
||||
getCommand(filename, args, reportCommand).join(' '),
|
||||
reportExecArgs,
|
||||
reportOptions)
|
||||
.then(async (exitCode) => {
|
||||
if (exitCode == 0) {
|
||||
await doUpload();
|
||||
}
|
||||
}).catch((err) => {
|
||||
setFailure(
|
||||
`Codecov:
|
||||
Failed to properly create report: ${err.message}`,
|
||||
failCi,
|
||||
);
|
||||
});
|
||||
};
|
||||
await exec.exec(
|
||||
getCommand(
|
||||
filename,
|
||||
args,
|
||||
commitCommand,
|
||||
).join(' '),
|
||||
commitExecArgs, commitOptions)
|
||||
.then(async (exitCode) => {
|
||||
if (exitCode == 0) {
|
||||
await createReport();
|
||||
}
|
||||
unlink();
|
||||
}).catch((err) => {
|
||||
setFailure(
|
||||
`Codecov: Failed to properly upload: ${err.message}`,
|
||||
`Codecov: Failed to properly create commit: ${err.message}`,
|
||||
failCi,
|
||||
);
|
||||
}).then(() => {
|
||||
unlink();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -12,7 +12,13 @@ import {
|
||||
setFailure,
|
||||
} from './helpers';
|
||||
|
||||
const verify = async (filename: string, platform: string, version: string) => {
|
||||
const verify = async (
|
||||
filename: string,
|
||||
platform: string,
|
||||
version: string,
|
||||
verbose: boolean,
|
||||
failCi: boolean,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const uploaderName = getUploaderName(platform);
|
||||
|
||||
@@ -24,15 +30,21 @@ const verify = async (filename: string, platform: string, version: string) => {
|
||||
|
||||
// Get SHASUM and SHASUM signature files
|
||||
console.log(`${getBaseUrl(platform, version)}.SHA256SUM`);
|
||||
const shasumRes = await fetch(
|
||||
const shasumRes = await fetch.default(
|
||||
`${getBaseUrl(platform, version)}.SHA256SUM`,
|
||||
);
|
||||
const shasum = await shasumRes.text();
|
||||
if (verbose) {
|
||||
console.log(`Received SHA256SUM ${shasum}`);
|
||||
}
|
||||
|
||||
const shaSigRes = await fetch(
|
||||
const shaSigRes = await fetch.default(
|
||||
`${getBaseUrl(platform, version)}.SHA256SUM.sig`,
|
||||
);
|
||||
const shaSig = await shaSigRes.text();
|
||||
if (verbose) {
|
||||
console.log(`Received SHA256SUM signature ${shaSig}`);
|
||||
}
|
||||
|
||||
// Verify shasum
|
||||
const verified = await openpgp.verify({
|
||||
@@ -46,7 +58,7 @@ const verify = async (filename: string, platform: string, version: string) => {
|
||||
verified.signatures[0].keyID.toHex(),
|
||||
);
|
||||
} else {
|
||||
setFailure('Codecov: Error validating SHASUM signature', true);
|
||||
setFailure('Codecov: Error validating SHASUM signature', failCi);
|
||||
}
|
||||
|
||||
const calculateHash = async (filename: string) => {
|
||||
@@ -69,11 +81,11 @@ const verify = async (filename: string, platform: string, version: string) => {
|
||||
setFailure(
|
||||
'Codecov: Uploader shasum does not match -- ' +
|
||||
`uploader hash: ${hash}, public hash: ${shasum}`,
|
||||
true,
|
||||
failCi,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
setFailure(`Codecov: Error validating uploader: ${err.message}`, true);
|
||||
setFailure(`Codecov: Error validating uploader: ${err.message}`, failCi);
|
||||
}
|
||||
};
|
||||
export default verify;
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as fetch from 'node-fetch';
|
||||
|
||||
const versionInfo = async (platform: string, version?: string) => {
|
||||
const versionInfo = async (
|
||||
platform: string,
|
||||
version?: string,
|
||||
): Promise<void> => {
|
||||
if (version) {
|
||||
core.info(`==> Running version ${version}`);
|
||||
}
|
||||
|
||||
try {
|
||||
const metadataRes = await fetch( `https://uploader.codecov.io/${platform}/latest`, {
|
||||
const metadataRes = await fetch.default( `https://uploader.codecov.io/${platform}/latest`, {
|
||||
headers: {'Accept': 'application/json'},
|
||||
});
|
||||
const metadata = await metadataRes.json();
|
||||
|
||||
Reference in New Issue
Block a user