Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use codecov-cli over python-codecov #6036

Merged
merged 24 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8e4f965
Use codecov-cli over python-codecov
FileMagic Oct 16, 2023
341a49e
Add codecov to changelogs
FileMagic Oct 17, 2023
46ab07f
Enable coverage for the meantime to test codecov
FileMagic Oct 17, 2023
e002b73
enable coverage via the var instead in setup env
FileMagic Oct 17, 2023
4669ff9
Remove pinning of coverage
FileMagic Oct 17, 2023
0cc2ec5
Add some updates to codecov submission
FileMagic Oct 17, 2023
043d439
set git service for codecovcli
FileMagic Oct 17, 2023
9056e01
Merge branch 'master' into fix_st2_codecov
arm4b Oct 18, 2023
0f81454
Add Codecov token to GH workflows
arm4b Oct 18, 2023
f224a2d
Rename codecov config file
FileMagic Oct 19, 2023
87dc75b
Use codecov action intead of bash script
FileMagic Oct 19, 2023
2121afd
Add token to codecovcli call
FileMagic Oct 19, 2023
559a3e5
Add quotes to codecov
FileMagic Oct 20, 2023
98c3636
confirm ci-cd working using key in commit (will be invalid after).
FileMagic Oct 20, 2023
a61ac51
Use CODECOV_TOKEN ENV variable from CI
arm4b Oct 21, 2023
a2df958
Install pip coverage for codecov
arm4b Oct 21, 2023
06718aa
Switch to Codecov script for integration tests
arm4b Oct 21, 2023
4536e2f
Revert the code comments for codecov
arm4b Oct 21, 2023
29cc295
Remove nix shell.
FileMagic Oct 21, 2023
7b837e0
Set coverage to work only on python 3.8
FileMagic Oct 21, 2023
9fe0f12
Add enviorment varibles to pull in python version for code coverage u…
FileMagic Oct 21, 2023
5687d33
Revert ENABLE_COVERAGE upload change
FileMagic Oct 21, 2023
456b61b
Remove coverage install for it is no longer a dep to codecov-cli
FileMagic Oct 21, 2023
337e427
Revert "Remove coverage install for it is no longer a dep to codecov-…
FileMagic Oct 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ jobs:

env:
TASK: '${{ matrix.task }}'

PYTHON_VERSION_SHORT: '${{ matrix.python-version-short }}'
NODE_TOTAL: '${{ matrix.nosetests_node_total }}'
NODE_INDEX: '${{ matrix.nosetests_node_index }}'

Expand Down Expand Up @@ -478,9 +478,11 @@ jobs:
./scripts/ci/run-nightly-make-task-if-exists.sh "${TASK}"
- name: Codecov
# NOTE: We only generate and submit coverage report for master and version branches and only when the build succeeds (default on GitHub Actions, this was not the case on Travis so we had to explicitly check success)
if: "${{ success() && (env.ENABLE_COVERAGE == 'yes') }}"
if: "${{ success() && (env.ENABLE_COVERAGE == 'yes') && (env.PYTHON_VERSION_SHORT == '3.8')}}"
run: |
./scripts/ci/submit-codecov-coverage.sh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

integration-tests:
needs: pre_job
Expand Down Expand Up @@ -606,7 +608,7 @@ jobs:

env:
TASK: '${{ matrix.task }}'

PYTHON_VERSION_SHORT: '${{ matrix.python-version-short }}'
NODE_TOTAL: '${{ matrix.nosetests_node_total }}'
NODE_INDEX: '${{ matrix.nosetests_node_index }}'

Expand Down Expand Up @@ -715,9 +717,11 @@ jobs:
script -e -c "make ${TASK}" && exit 0
- name: Codecov
# NOTE: We only generate and submit coverage report for master and version branches and only when the build succeeds (default on GitHub Actions, this was not the case on Travis so we had to explicitly check success)
if: "${{ success() && env.ENABLE_COVERAGE == 'yes' && env.TASK == 'ci-integration' }}"
if: "${{ success() && (env.ENABLE_COVERAGE == 'yes') && (env.TASK == 'ci-integration') && (env.PYTHON_VERSION_SHORT == '3.8')}}"
run: |
./scripts/ci/submit-codecov-coverage.sh
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Compress Service Logs Before upload
if: ${{ failure() && env.TASK == 'ci-integration' }}
run: |
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Fixed

* Avoid logging sensitive information in debug (fix #5977)

* Fix codecov stackstorm/st2 (https://github.com/StackStorm/st2/issues/6035)

Added
~~~~~

Expand Down
File renamed without changes.
12 changes: 4 additions & 8 deletions scripts/ci/submit-codecov-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
# If we're on Travis, then we need to manually check that the build succeeded.
if [[ "${USER}" == "runner" || ${TRAVIS_TEST_RESULT} -eq 0 ]]; then
# 1. Install codecov dependencies
# NOTE: We need eventlet installed so coverage can be correctly combined. This is needed because we are covering code which utilizes eventlet.
FileMagic marked this conversation as resolved.
Show resolved Hide resolved
# Without eventlet being available to the coverage command it will fail with "Couldn't trace with concurrency=eventlet, the module isn't installed."
pip install eventlet
# NOTE: codecov only supports coverage==4.5.2
pip install 'coverage<5.0'
Copy link
Member

@arm4b arm4b Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With removing coverage (9f27017) in a bash script we get the following error at a later stage:

https://github.com/StackStorm/st2/actions/runs/6603759812/job/17937403741?pr=6040#step:17:38

info - 2023-10-22 12:48:45,887 -- ci service found: github-actions
info - 2023-10-22 12:48:45,991 -- Process Commit creating complete
info - 2023-10-22 12:48:46,101 -- Process Report creating complete
info - 2023-10-22 12:48:46,101 -- Finished creating report successfully --- {"response": "{\"external_id\":\"2aa2e37f-d821-4cad-9199-ecd04092be89\",\"created_at\":\"2023-10-22T12:35:18.103083Z\",\"commit_sha\":\"d1666b936f8e58a8beccc69ad8d4a1772f74b20b\",\"code\":null}"}
warning - 2023-10-22 12:48:46,102 -- xcrun is not installed or can't be found.
warning - 2023-10-22 12:48:46,429 -- No gcov data found.
warning - 2023-10-22 12:48:46,429 -- coverage.py is not installed or can't be found.
info - 2023-10-22 12:48:46,522 -- Found 0 coverage files to upload
Error: No coverage reports found. Please make sure you're generating reports successfully.
Error: Process completed with exit code 1.

so it's indeed needed, please keep it included

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will put it back one sec here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize about that. That should do it for ya.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, and thanks for your work! 👍

pip install "codecov==2.1.11"
pip install -U pip
pip install codecov-cli>=0.3.2

# 2. Combine coverage report and submit coverage report to codecovs.io
codecov --required
# 2. Combine coverage report and submit coverage report to codecov.io
codecovcli upload-process -t "${CODECOV_TOKEN}"
exit $?
else
echo "Build has failed, not submitting coverage"
Expand Down
3 changes: 1 addition & 2 deletions test-requirements.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I unpin the version of coverage here due to codecovcli not requiring it anymore directly. This can be seen here

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# NOTE: codecov only supports coverage==4.5.2
coverage==4.5.2
coverage
pep8==1.7.1
st2flake8==0.1.0
astroid==2.5.6
Expand Down