Skip to content

Commit 030a000

Browse files
fix: add in all the extra arguments for uploader (#955)
1 parent 91e1847 commit 030a000

File tree

5 files changed

+3041
-2905
lines changed

5 files changed

+3041
-2905
lines changed

README.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ steps:
3535
- uses: actions/checkout@master
3636
- uses: codecov/codecov-action@v3
3737
with:
38-
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
38+
token: ${{ secrets.CODECOV_TOKEN }}
3939
files: ./coverage1.xml,./coverage2.xml # optional
4040
flags: unittests # optional
4141
name: codecov-umbrella # optional
@@ -50,35 +50,43 @@ Codecov's Action supports inputs from the user. These inputs, along with their d
5050

5151
| Input | Description | Usage |
5252
| :---: | :---: | :---: |
53-
| `token` | Used to authorize coverage report uploads | *Required for private repos* |
54-
| `files` | Comma-separated paths to the coverage report(s). Negated paths are supported by starting with `!` | Optional
55-
| `directory` | Directory to search for coverage reports. | Optional
56-
| `dry_run` | Don't upload files to Codecov | Optional
57-
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
53+
| `token` | Used to authorize coverage report uploads | *Required |
54+
| `move_coverage_to_trash` | Move discovered coverage reports to the trash | Optional
5855
| `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
56+
| `dry_run` | Don't upload files to Codecov | Optional
5957
| `env_vars` | Environment variables to tag the upload with. Multiple env variables can be separated with commas (e.g. `OS,PYTHON`) | Optional
6058
| `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional
59+
| `files` | Comma-separated paths to the coverage report(s). Negated paths are supported by starting with `!` | Optional
60+
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
61+
| `full_report` | Specify the path of a full Codecov report to re-upload | Optional
6162
| `functionalities` | Toggle functionalities | Optional
62-
| `network` | Disable uploading the file network | Optional
63+
| -- `network` | Disable uploading the file network | Optional
64+
| -- `fixes` | Enable file fixes to ignore common lines from coverage | Optional
65+
| -- `search` | Disable searching for coverage files | Optional
6366
| `gcov` | Run with gcov support | Optional
6467
| `gcov_args` | Extra arguments to pass to gcov | Optional
6568
| `gcov_ignore` | Paths to ignore during gcov gathering | Optional
6669
| `gcov_include` | Paths to include during gcov gathering | Optional
67-
| `move_coverage_to_trash` | Move discovered coverage reports to the trash | Optional
70+
| `gcov_executable` | gcov executable to run. Defaults to gcov. | Optional
6871
| `name` | Custom defined name for the upload | Optional
72+
| `network_filer` | Specify a filter on the files listed in the network section of the Codecov report. Useful for upload-specific path fixing | Optional
73+
| `network_prefix` | Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing | Optional
74+
| `os` | Specify the OS (linux, macos, windows, alpine) | Optional
6975
| `override_branch` | Specify the branch name | Optional
7076
| `override_build` | Specify the build number | Optional
7177
| `override_commit` | Specify the commit SHA | Optional
7278
| `override_pr` | Specify the pull request number | Optional
7379
| `override_tag` | Specify the git tag | Optional
7480
| `root_dir` | Used when not in git/hg project to identify project root directory | Optional
81+
| `directory` | Directory to search for coverage reports. | Optional
7582
| `slug` | Specify the slug manually (Enterprise use) | Optional
83+
| `swift` | Run with swift coverage support | Optional
84+
| -- `swift_project` | Specify the swift project to speed up coverage conversion | Optional
85+
| `upstream_proxy` | The upstream http proxy server to connect through | Optional
7686
| `url` | Change the upload host (Enterprise use) | Optional
7787
| `verbose` | Specify whether the Codecov output should be verbose | Optional
7888
| `version` | Specify which version of the Codecov Uploader should be used. Defaults to `latest` | Optional
79-
| `working-directory` | Directory in which to execute `codecov.sh` | Optional
80-
| `xcode` | Run with xcode support | Optional
81-
| `xcode_archive_path` | Specify the xcode archive path. Likely specified as the -resultBundlePath and should end in .xcresult | Optional
89+
| `xtra_args` | Add additional uploader args that may be missing in the Action | Optional
8290

8391

8492
### Example `workflow.yml` with Codecov Action
@@ -94,13 +102,13 @@ jobs:
94102
os: [ubuntu-latest, macos-latest, windows-latest]
95103
env:
96104
OS: ${{ matrix.os }}
97-
PYTHON: '3.7'
105+
PYTHON: '3.10'
98106
steps:
99107
- uses: actions/checkout@master
100108
- name: Setup Python
101109
uses: actions/setup-python@master
102110
with:
103-
python-version: 3.7
111+
python-version: 3.10
104112
- name: Generate coverage report
105113
run: |
106114
pip install pytest

dist/index.js

+2,950-2,873
Large diffs are not rendered by default.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/buildExec.test.ts

+27-6
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,32 @@ test('all arguments', () => {
3535
'flags': 'test,test2',
3636
'functionalities':
3737
'network',
38+
'full_report': 'oldDir/oldReport.json',
3839
'gcov': 'true',
3940
'gcov_args': '-v',
4041
'gcov_ignore': '*.fake',
4142
'gcov_include': 'real_file',
43+
'gcov_executable': 'gcov2',
4244
'move_coverage_to_trash': 'true',
4345
'name': 'codecov',
46+
'network_filter': 'src/',
47+
'network_prefix': 'build/',
4448
'override_branch': 'thomasrockhu/test',
4549
'override_build': '1',
4650
'override_commit': '9caabca5474b49de74ef5667deabaf74cdacc244',
4751
'override_pr': '2',
4852
'override_tag': 'v1.2',
4953
'root_dir': 'root/',
54+
'swift': 'true',
55+
'swift_project': 'MyApp',
5056
'slug': 'fakeOwner/fakeRepo',
5157
'token': 'd3859757-ab80-4664-924d-aef22fa7557b',
58+
'upstream_proxy': 'https://codecov.example.com',
5259
'url': 'https://codecov.enterprise.com',
5360
'verbose': 't',
54-
'working-directory': 'src',
5561
'xcode': 'true',
5662
'xcode_archive_path': '/test.xcresult',
63+
'xtra_args': '-some -other -args',
5764
};
5865

5966
for (const env of Object.keys(envs)) {
@@ -81,17 +88,25 @@ test('all arguments', () => {
8188
'dir1/coverage.xml',
8289
'-f',
8390
'dir2/coverage.xml',
91+
'-full',
92+
'oldDir/oldReport.json',
8493
'-F',
8594
'test',
8695
'-F',
8796
'test2',
8897
'-g',
89-
'--gcovArgs',
98+
'-gcovArgs',
9099
'-v',
91-
'--gcovIgnore',
100+
'-gcovIgnore',
92101
'*.fake',
93-
'--gcovInclude',
102+
'-gcovInclude',
94103
'real_file',
104+
'-gcovExecutable',
105+
'gcov2',
106+
'-networkFilter',
107+
'src/',
108+
'-networkPrefix',
109+
'build/',
95110
'-B',
96111
'thomasrockhu/test',
97112
'-b',
@@ -108,12 +123,18 @@ test('all arguments', () => {
108123
'coverage/',
109124
'-r',
110125
'fakeOwner/fakeRepo',
126+
'-xs',
127+
'-xsp',
128+
'MyApp',
129+
'-U',
130+
'https://codecov.example.com',
111131
'-u',
112132
'https://codecov.enterprise.com',
113133
'-v',
114-
'--xc',
115-
'--xp',
134+
'-xc',
135+
'-xp',
116136
'/test.xcresult',
137+
'-some -other -args',
117138
]);
118139
expect(failCi).toBeTruthy();
119140

src/buildExec.ts

+42-12
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ const isTrue = (variable) => {
1919
const buildExec = () => {
2020
const clean = core.getInput('move_coverage_to_trash');
2121
const commitParent = core.getInput('commit_parent');
22-
const envVars = core.getInput('env_vars');
2322
const dryRun = isTrue(core.getInput('dry_run'));
23+
const envVars = core.getInput('env_vars');
2424
const failCi = isTrue(core.getInput('fail_ci_if_error'));
2525
const file = core.getInput('file');
2626
const files = core.getInput('files');
2727
const flags = core.getInput('flags');
28+
const fullReport = core.getInput('full_report');
29+
const functionalities = core.getInput('functionalities');
2830
const gcov = core.getInput('gcov');
2931
const gcovArgs = core.getInput('gcov_args');
32+
const gcovExecutable = core.getInput('gcov_executable');
3033
const gcovIgnore = core.getInput('gcov_ignore');
3134
const gcovInclude = core.getInput('gcov_include');
32-
const functionalities = core.getInput('functionalities');
3335
const name = core.getInput('name');
36+
const networkFilter = core.getInput('network_filter');
37+
const networkPrefix = core.getInput('network_prefix');
3438
const os = core.getInput('os');
3539
const overrideBranch = core.getInput('override_branch');
3640
const overrideBuild = core.getInput('override_build');
@@ -40,13 +44,16 @@ const buildExec = () => {
4044
const rootDir = core.getInput('root_dir');
4145
const searchDir = core.getInput('directory');
4246
const slug = core.getInput('slug');
47+
const swift = core.getInput('swift');
48+
const swiftProject = core.getInput('swift_project');
4349
const token = core.getInput('token');
44-
let uploaderVersion = core.getInput('version');
50+
const upstream = core.getInput('upstream_proxy');
4551
const url = core.getInput('url');
4652
const verbose = isTrue(core.getInput('verbose'));
47-
const workingDir = core.getInput('working-directory');
4853
const xcode = core.getInput('xcode');
4954
const xcodeArchivePath = core.getInput('xcode_archive_path');
55+
const xtraArgs = core.getInput('xtra_args');
56+
let uploaderVersion = core.getInput('version');
5057

5158
const execArgs = [];
5259
execArgs.push(
@@ -106,6 +113,9 @@ const buildExec = () => {
106113
execArgs.push('-f', `${f}`);
107114
});
108115
}
116+
if (fullReport) {
117+
execArgs.push('-full', `${fullReport}`);
118+
}
109119
if (flags) {
110120
flags.split(',').map((f) => f.trim()).forEach((f) => {
111121
execArgs.push('-F', `${f}`);
@@ -116,13 +126,23 @@ const buildExec = () => {
116126
execArgs.push('-g');
117127
}
118128
if (gcovArgs) {
119-
execArgs.push('--gcovArgs', `${gcovArgs}`);
129+
execArgs.push('-gcovArgs', `${gcovArgs}`);
120130
}
121131
if (gcovIgnore) {
122-
execArgs.push('--gcovIgnore', `${gcovIgnore}`);
132+
execArgs.push('-gcovIgnore', `${gcovIgnore}`);
123133
}
124134
if (gcovInclude) {
125-
execArgs.push('--gcovInclude', `${gcovInclude}`);
135+
execArgs.push('-gcovInclude', `${gcovInclude}`);
136+
}
137+
if (gcovExecutable) {
138+
execArgs.push('-gcovExecutable', `${gcovExecutable}`);
139+
}
140+
141+
if (networkFilter) {
142+
execArgs.push('-networkFilter', `${networkFilter}`);
143+
}
144+
if (networkPrefix) {
145+
execArgs.push('-networkPrefix', `${networkPrefix}`);
126146
}
127147

128148
if (overrideBranch) {
@@ -158,18 +178,24 @@ const buildExec = () => {
158178
if (slug) {
159179
execArgs.push('-r', `${slug}`);
160180
}
181+
if (swift) {
182+
execArgs.push('-xs');
183+
}
184+
if (swift && swiftProject) {
185+
execArgs.push('-xsp', `${swiftProject}`);
186+
}
187+
if (upstream) {
188+
execArgs.push('-U', `${upstream}`);
189+
}
161190
if (url) {
162191
execArgs.push('-u', `${url}`);
163192
}
164193
if (verbose) {
165194
execArgs.push('-v');
166195
}
167-
if (workingDir) {
168-
options.cwd = workingDir;
169-
}
170196
if (xcode && xcodeArchivePath) {
171-
execArgs.push('--xc');
172-
execArgs.push('--xp', `${xcodeArchivePath}`);
197+
execArgs.push('-xc');
198+
execArgs.push('-xp', `${xcodeArchivePath}`);
173199
}
174200

175201
if (uploaderVersion == '') {
@@ -180,6 +206,10 @@ const buildExec = () => {
180206
console.debug({execArgs});
181207
}
182208

209+
if (xtraArgs) {
210+
execArgs.push(`${xtraArgs}`);
211+
}
212+
183213
return {execArgs, options, failCi, os, uploaderVersion, verbose};
184214
};
185215

0 commit comments

Comments
 (0)