Skip to content

Commit bb7467c

Browse files
feat: use wrapper (#1621)
* feat: use wrapper * fix: submodules * fix: >> * fix: container with python * fix: oidc * fix: latex * fix: latex in the container * fix: no sudo * fix: container to python * fix: submodule stuff * fix: just dont coverage * fix: apt install git * fix: no sudo * fix: apt-get * fix: use the oidc token * fix: cut the token * fix: small changes * fix: set the token * fix: add defaults * fix: bump to latest wrapper * fix: 0.0.20 * fix: 0.8.0 * Update action.yml * Update action.yml * Update action.yml * Update action.yml Co-authored-by: Joe Becher <[email protected]> * Update action.yml Co-authored-by: Joe Becher <[email protected]> * Update dist/codecov.sh * Update action.yml * feat: use wrapper fix: submodules fix: >> fix: container with python fix: oidc fix: latex fix: latex in the container fix: no sudo fix: container to python fix: submodule stuff fix: just dont coverage fix: apt install git fix: no sudo fix: apt-get fix: use the oidc token fix: cut the token fix: small changes fix: set the token fix: add defaults fix: bump to latest wrapper fix: 0.0.20 fix: 0.8.0 * chore(deps): 0.0.21 --------- Co-authored-by: Joe Becher <[email protected]>
1 parent 1d60598 commit bb7467c

30 files changed

+408
-40565
lines changed

.github/workflows/main.yml

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
---
12
name: Workflow for Codecov Action
23
on: [push, pull_request]
4+
permissions:
5+
id-token: write
6+
contents: read
37
jobs:
48
run:
59
runs-on: ${{ matrix.os }}
@@ -9,12 +13,12 @@ jobs:
913
steps:
1014
- name: Checkout
1115
uses: actions/[email protected]
16+
with:
17+
submodules: 'true'
1218
- name: Install dependencies
13-
run: npm install
14-
- name: Lint
15-
run: npm run lint
19+
run: pip install -r src/scripts/app/requirements.txt
1620
- name: Run tests and collect coverage
17-
run: npm run test
21+
run: pytest src/scripts/app/ --cov
1822
- name: Upload coverage to Codecov (script)
1923
uses: ./
2024
with:
@@ -42,7 +46,7 @@ jobs:
4246
file: ./coverage/coverage-final.json
4347
flags: version,${{ matrix.os }}
4448
name: codecov-version
45-
version: v0.7.3
49+
version: v0.8.0
4650
verbose: true
4751
token: ${{ secrets.CODECOV_TOKEN }}
4852

@@ -52,12 +56,12 @@ jobs:
5256
steps:
5357
- name: Checkout
5458
uses: actions/[email protected]
59+
with:
60+
submodules: 'true'
5561
- name: Install dependencies
56-
run: npm install
57-
- name: Lint
58-
run: npm run lint
62+
run: pip install -r src/scripts/app/requirements.txt
5963
- name: Run tests and collect coverage
60-
run: npm run test
64+
run: pytest src/scripts/app/ --cov
6165
- name: Upload coverage to Codecov (script)
6266
uses: ./
6367
with:
@@ -91,16 +95,15 @@ jobs:
9195

9296
run-container:
9397
runs-on: ubuntu-latest
94-
container: node:18
98+
container: python:latest
9599
steps:
96100
- name: Checkout
97101
uses: actions/[email protected]
98-
- name: Install dependencies
99-
run: npm install
100-
- name: Lint
101-
run: npm run lint
102-
- name: Run tests and collect coverage
103-
run: npm run test
102+
with:
103+
submodules: 'true'
104+
- name: Install deps
105+
run: |
106+
apt-get install git
104107
- name: Upload coverage to Codecov (script)
105108
uses: ./
106109
with:

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[submodule "src/scripts"]
2+
path = src/scripts
3+
url = https://github.com/codecov/wrapper
4+
branch = main

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
deploy:
2-
$(eval VERSION := $(shell cat package.json | grep '"version": ' | cut -d\" -f4))
3-
git tag -d v4
4-
git push origin :v4
5-
git tag v4
2+
$(eval VERSION := $(shell cat src/version | grep 'CODECOV_ACTION_VERSION=' | cut -d\" -f2))
3+
git tag -d v5
4+
git push origin :v5
5+
git tag v5
66
git tag v$(VERSION) -s -m ""
77
git push origin --tags

action.yml

+142-41
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,222 @@
1+
---
2+
# yamllint disable rule:line-length
13
name: 'Codecov'
24
description: 'GitHub Action that uploads coverage reports for your repository to codecov.io'
3-
author: 'Ibrahim Ali <@ibrahim0814> & Thomas Hu <@thomasrockhu> | Codecov'
5+
author: 'Thomas Hu <@thomasrockhu-codecov> | Codecov'
46
inputs:
5-
token:
6-
description: 'Repository Codecov token. Used to authorize report uploads'
7-
required: false
8-
codecov_yml_path:
9-
description: 'Specify the path to the Codecov YML'
7+
binary:
8+
description: 'The file location of a pre-downloaded version of the CLI. If specified, integrity checking will be bypassed.'
109
required: false
1110
commit_parent:
12-
description: 'Override to specify the parent commit SHA'
11+
description: 'SHA (with 40 chars) of what should be the parent of this commit.'
1312
required: false
1413
directory:
15-
description: 'Directory to search for coverage reports.'
14+
description: 'Folder to search for coverage files. Default to the current working directory'
1615
required: false
1716
disable_file_fixes:
18-
description: 'Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)'
17+
description: 'Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets). Read more here https://docs.codecov.com/docs/fixing-reports'
1918
required: false
19+
default: 'false'
2020
disable_search:
21-
description: 'Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.'
21+
description: 'Disable search for coverage files. This is helpful when specifying what files you want to upload with the files option.'
2222
required: false
23+
default: 'false'
2324
disable_safe_directory:
2425
description: 'Disable setting safe directory. Set to true to disable.'
2526
required: false
27+
default: 'false'
2628
dry_run:
2729
description: "Don't upload files to Codecov"
2830
required: false
31+
default: 'false'
2932
env_vars:
3033
description: 'Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)'
3134
required: false
3235
exclude:
33-
description: 'Folders to exclude from search'
36+
description: 'Comma-separated list of folders to exclude from search.'
3437
required: false
3538
fail_ci_if_error:
36-
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
37-
required: false
38-
file:
39-
description: 'Path to coverage file to upload'
39+
description: 'On error, exit with non-zero code'
4040
required: false
41+
default: 'false'
4142
files:
42-
description: 'Comma-separated list of files to upload'
43+
description: 'Comma-separated list of explicit files to upload. These will be added to the coverage files found for upload. If you wish to only upload the specified files, please consider using disable-search to disable uploading other files.'
4344
required: false
4445
flags:
45-
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
46+
description: 'Comma-separated list of flags to upload to group coverage metrics.'
4647
required: false
4748
git_service:
4849
description: 'Override the git_service (e.g. github_enterprise)'
4950
required: false
51+
default: 'github'
52+
gcov_args:
53+
description: 'Extra arguments to pass to gcov'
54+
required: false
55+
gcov_executable:
56+
description: "gcov executable to run. Defaults to 'gcov'"
57+
required: false
58+
default: 'gcov'
59+
gcov_ignore:
60+
description: 'Paths to ignore during gcov gathering'
61+
required: false
62+
gcov_include:
63+
description: "Paths to include during gcov gathering"
64+
required: false
5065
handle_no_reports_found:
51-
description: 'Raise no exceptions when no coverage reports found'
66+
description: 'If no coverage reports are found, do not raise an exception.'
5267
required: false
68+
default: 'false'
5369
job_code:
54-
description: 'The job code'
70+
description: ''
5571
required: false
5672
name:
57-
description: 'User defined upload name. Visible in Codecov UI'
73+
description: 'Custom defined name of the upload. Visible in the Codecov UI'
5874
required: false
5975
network_filter:
60-
description: 'Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing'
76+
description: 'Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing.'
6177
required: false
6278
network_prefix:
63-
description: 'Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing'
79+
description: 'Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing.'
6480
required: false
6581
os:
66-
description: 'Override the assumed OS. Options are linux | macos | windows.'
82+
description: 'Override the assumed OS. Options available at cli.codecov.io'
6783
required: false
6884
override_branch:
69-
description: 'Specify the branch name'
85+
description: 'Specify the branch to be displayed with this commit on Codecov'
7086
required: false
7187
override_build:
72-
description: 'Specify the build number'
88+
description: 'Specify the build number manually'
7389
required: false
7490
override_build_url:
7591
description: 'The URL of the build where this is running'
7692
required: false
7793
override_commit:
78-
description: 'Specify the commit SHA'
94+
description: 'Commit SHA (with 40 chars)'
7995
required: false
8096
override_pr:
81-
description: 'Specify the pull request number'
82-
required: false
83-
plugin:
84-
description: 'plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all.'
97+
description: 'Specify the pull request number manually. Used to override pre-existing CI environment variables.'
8598
required: false
8699
plugins:
87-
description: 'Comma-separated list of plugins for use during upload.'
100+
description: 'Comma-separated list of plugins to run. Specify `noop` to turn off all plugins'
88101
required: false
89102
report_code:
90-
description: 'The code of the report. If unsure, do not include'
103+
description: 'The code of the report if using local upload. If unsure, leave default. Read more here https://docs.codecov.com/docs/the-codecov-cli#how-to-use-local-upload'
104+
required: false
105+
report_type:
106+
description: 'The type of file to upload, coverage by default. Possible values are "testing", "coverage".'
91107
required: false
92-
root_dir:
93-
description: 'Used when not in git/hg project to identify project root directory'
108+
root_folder:
109+
description: 'Root folder from which to consider paths on the network section. Defaults to current working directory.'
94110
required: false
111+
skip_validation:
112+
description: 'Skip integrity checking of the CLI. This is NOT recommended.'
113+
required: false
114+
default: 'false'
95115
slug:
96-
description: 'Specify the slug manually (Enterprise use)'
116+
description: '[Required when using the org token] Set to the owner/repo slug used instead of the private repo token. Only applicable to some Enterprise users.'
117+
required: false
118+
swift_project:
119+
description: 'Specify the swift project name. Useful for optimization.'
120+
required: false
121+
token:
122+
description: 'Repository Codecov token. Used to authorize report uploads'
97123
required: false
98124
url:
99-
description: 'Specify the base url to upload (Enterprise use)'
125+
description: 'Set to the Codecov instance URl. Used by Dedicated Enterprise Cloud customers.'
100126
required: false
101127
use_legacy_upload_endpoint:
102-
description: 'Use the legacy upload endpoint'
128+
description: 'Use the legacy upload endpoint.'
103129
required: false
130+
default: 'false'
104131
use_oidc:
105132
description: 'Use OIDC instead of token. This will ignore any token supplied'
106133
required: false
134+
default: 'false'
107135
verbose:
108-
description: 'Specify whether the Codecov output should be verbose'
136+
description: 'Enable verbose logging'
109137
required: false
138+
default: 'false'
110139
version:
111-
description: 'Specify which version of the Codecov CLI should be used. Defaults to `latest`'
140+
description: "Which version of the Codecov CLI to use (defaults to 'latest')"
112141
required: false
142+
default: 'latest'
113143
working-directory:
114144
description: 'Directory in which to execute codecov.sh'
115145
required: false
146+
147+
steps:
148+
- run:
149+
name: Upload to Codecov
150+
command: <<include(scripts/dist/codecov.sh)>>
151+
when: << parameters.when >>
116152
branding:
117153
color: 'red'
118154
icon: 'umbrella'
119155
runs:
120-
using: 'node20'
121-
main: 'dist/index.js'
156+
using: "composite"
157+
steps:
158+
- name: Set safe directory
159+
if: ${{ inputs.set_safe_directory != 'true' }}
160+
shell: bash
161+
run: |
162+
git config --global --add safe.directory ${{ github.workspace }}
163+
164+
- name: Get and set token
165+
shell: bash
166+
run: |
167+
if [ ${{ inputs.use_oidc }} == 'true' ];
168+
then
169+
# {"count":1984,"value":"***"}
170+
CODECOV_TOKEN=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" | cut -d\' -f6)
171+
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> $GITHUB_ENV
172+
else
173+
if [ -n ${{ inputs.token }} ];
174+
then
175+
CODECOV_TOKEN=${{ inputs.token }}
176+
echo "CODECOV_TOKEN=$CODECOV_TOKEN" >> $GITHUB_ENV
177+
fi
178+
fi
179+
- name: Upload coverage to Codecov
180+
run: ./dist/codecov.sh
181+
shell: bash
182+
working-directory: ${{ inputs.working-directory }}
183+
env:
184+
CC_BINARY: ${{ inputs.binary }}
185+
CC_BRANCH: ${{ inputs.override_branch }}
186+
CC_BUILD: ${{ inputs.override_build }}
187+
CC_BUILD_URL: ${{ inputs.override_build_url }}
188+
CC_CODE: ${{ inputs.report_code }}
189+
CC_DIR: ${{ inputs.directory }}
190+
CC_DISABLE_FILE_FIXES: ${{ inputs.disable_file_fixes }}
191+
CC_DISABLE_SEARCH: ${{ inputs.disable_search }}
192+
CC_DRY_RUN: ${{ inputs.dry_run }}
193+
CC_ENTERPRISE_URL: ${{ inputs.url }}
194+
CC_ENV: ${{ inputs.env_vars }}
195+
CC_EXCLUDES: ${{ inputs.exclude }}
196+
CC_FAIL_ON_ERROR: ${{ inputs.fail_ci_if_error }}
197+
CC_FILES: ${{ inputs.files }}
198+
CC_FLAGS: ${{ inputs.flags }}
199+
CC_GCOV_ARGS: ${{ inputs.gcov_args }}
200+
CC_GCOV_EXECUTABLE: ${{ inputs.gcov_executable }}
201+
CC_GCOV_IGNORE: ${{ inputs.gcov_ignore }}
202+
CC_GCOV_INCLUDE: ${{ inputs.gcov_include }}
203+
CC_GIT_SERVICE: ${{ inputs.git_service }}
204+
CC_HANDLE_NO_REPORTS_FOUND: ${{ inputs.handle_no_reports_found }}
205+
CC_JOB_CODE: ${{ inputs.job_code }}
206+
CC_LEGACY: ${{ inputs.use_legacy_upload_endpoint }}
207+
CC_NAME: ${{ inputs.name }}
208+
CC_NETWORK_FILTER: ${{ inputs.network_filter }}
209+
CC_NETWORK_PREFIX: ${{ inputs.network_prefix }}
210+
CC_NETWORK_ROOT_FOLDER: ${{ inputs.root_dir }}
211+
CC_OS: ${{ inputs.os }}
212+
CC_PARENT_SHA: ${{ inputs.commit_parent }}
213+
CC_PLUGINS: ${{ inputs.plugins }}
214+
CC_PR: ${{ inputs.override_pr }}
215+
CC_REPORT_TYPE: ${{ inputs.report_type }}
216+
CC_SHA: ${{ inputs.override_commit }}
217+
CC_SKIP_VALIDATION: ${{ inputs.skip_validation }}
218+
CC_SLUG: ${{ inputs.slug }}
219+
CC_SWIFT_PROJECT: ${{ inputs.swift_project }}
220+
CC_TOKEN: $CODECOV_TOKEN
221+
CC_VERBOSE: ${{ inputs.verbose }}
222+
CC_VERSION: ${{ inputs.version }}

0 commit comments

Comments
 (0)