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

Conversation

FileMagic
Copy link
Contributor

This is the PR related to Issue #6035

@pull-request-size pull-request-size bot added the size/S PR that changes 10-29 lines. Very easy to review. label Oct 16, 2023
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Thanks for the PR to fix it!

Looks good,
I left one comment about verifying the coverage in this PR.
Please also update the Changelog with a note about using codecov-cli.

scripts/ci/submit-codecov-coverage.sh Show resolved Hide resolved
@arm4b arm4b added this to the 3.8.1 milestone Oct 16, 2023
@arm4b arm4b added this to In progress in StackStorm v3.8.1 via automation Oct 16, 2023
@arm4b arm4b modified the milestones: 3.8.1, 3.9.0 Oct 16, 2023
@FileMagic
Copy link
Contributor Author

A couple of things to note in the PR. The python 3.6 tests seem to be failing due to the codecov-cli-0.1.13 being installed which was intresting, so I am going to try upgrading the version of pip before to see if that helps.

The python 3.9 and python 3.8 versions seem to have some issue with getting the environment var CODECOV_TOKEN which is talked about here as the following:

Note that these commands will automatically search your environment for a $CODECOV_TOKEN environment variable and use it if found. If you do not have a repository upload token, or global upload token, stored as an environment variable, you will need to pass it into each command manually, like so: -t {$CODECOV_TOKEN}.

I don't see where this is being set in the code base or via the github action so I guess I'll try the --git-service which is not documented for the README.md, but seems to be in their help menu (could be a side effect of this being a combined cmd).

@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines. Good size to review. and removed size/S PR that changes 10-29 lines. Very easy to review. labels Oct 17, 2023
@FileMagic
Copy link
Contributor Author

A couple of things to note in the PR. The python 3.6 tests seem to be failing due to the codecov-cli-0.1.13 being installed which was intresting, so I am going to try upgrading the version of pip before to see if that helps.

The python 3.9 and python 3.8 versions seem to have some issue with getting the environment var CODECOV_TOKEN which is talked about here as the following:

Note that these commands will automatically search your environment for a $CODECOV_TOKEN environment variable and use it if found. If you do not have a repository upload token, or global upload token, stored as an environment variable, you will need to pass it into each command manually, like so: -t {$CODECOV_TOKEN}.

I don't see where this is being set in the code base or via the github action so I guess I'll try the --git-service which is not documented for the README.md, but seems to be in their help menu (could be a side effect of this being a combined cmd).

Yeah after looking a bit further I now see where the env vars can be seen in github, and it's def not being passed from that end. If anyone know please just leave a comment, however, I do not know where to pull the codecov token from.

On the topic of python 3.6. It seems that the tool does not have the upload-process under python 3.6. So I guess we will see. Hopefully there won't be support for python 3.6 in st2 for much longer anyways, but this could be done using the fully written out commands nontheless...

@FileMagic
Copy link
Contributor Author

Thanks for the commit, for my own docs in the future I didn't see this: (GitHub) Using secrets in a workflow.

I'll probs try using the -t flag later on today to see if I can get this working.

@arm4b
Copy link
Member

arm4b commented Oct 18, 2023

@FileMagic We indeed didn't have CODECOV_TOKEN added (generated) for this repository.

I just added it, but looks like the main repository secrets are not accessible from the GH forks (codecov/codecov-action#44 (comment)) during the build.

Could you try to generate a Codecov token and add it to your Github Repo (fork) just for testing purposes?

@arm4b
Copy link
Member

arm4b commented Oct 18, 2023

Minor addition, based on https://github.com/StackStorm/st2/actions/runs/6564663313/job/17831515543?pr=6036#step:17:33

warning - 2023-10-18 18:03:47,823 -- Config file codecov.yml not found, or is not a file. Ignoring config.

We may need to rename the .codecov.yml to codecov.yml as the file name format (I guess) was changed with the new Codecov.

@FileMagic
Copy link
Contributor Author

It seems that even when CODECOV_TOKEN is set within the fork it does not work.

@FileMagic
Copy link
Contributor Author

I used a key for code cov here one time on a free account to test if it would work. It seems that it doesn't read from my project's github secrets either. I regenerated the key after so we should be good. However, we will see if this technically would have worked.

@arm4b arm4b added this to the 3.8.1 milestone Oct 21, 2023
@pull-request-size pull-request-size bot added size/S PR that changes 10-29 lines. Very easy to review. and removed size/M PR that changes 30-99 lines. Good size to review. labels Oct 21, 2023
@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines. Good size to review. and removed size/S PR that changes 10-29 lines. Very easy to review. labels Oct 21, 2023
@FileMagic
Copy link
Contributor Author

Well, that seems to work as expected. I'll revert the change ENABLE_COVERAGE here in a bit.

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

@pull-request-size pull-request-size bot added size/S PR that changes 10-29 lines. Very easy to review. and removed size/M PR that changes 30-99 lines. Good size to review. labels Oct 21, 2023
@FileMagic
Copy link
Contributor Author

The last thing I did was remove the extra coverage install from scripts/ci/submit-codecov-coverage.sh.

I tested the updated script (without coverage install) in my cli:

Requirement already satisfied: pip in ./venv/lib/python3.9/site-packages (23.0)
Collecting pip
  Downloading pip-23.3.1-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 7.0 MB/s eta 0:00:00
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 23.0
    Uninstalling pip-23.0:
      Successfully uninstalled pip-23.0
Successfully installed pip-23.3.1
info - 2023-10-21 19:26:39,462 -- ci service found: local
info - 2023-10-21 19:26:39,611 -- Process Commit creating complete
error - 2023-10-21 19:26:39,611 -- Commit creating failed: {"detail":"Invalid token."}

So we should be good now. Let me know if you see anything else that should be changed.

# 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! 👍

@pull-request-size pull-request-size bot added size/M PR that changes 30-99 lines. Good size to review. and removed size/S PR that changes 10-29 lines. Very easy to review. labels Oct 22, 2023
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

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

Thanks a lot for fixing the st2 master build! 🟢

@arm4b arm4b requested a review from a team October 23, 2023 11:22
@arm4b arm4b linked an issue Oct 23, 2023 that may be closed by this pull request
@cognifloyd cognifloyd merged commit d374b92 into StackStorm:master Oct 23, 2023
40 checks passed
StackStorm v3.8.1 automation moved this from In progress to Done Oct 23, 2023
@arm4b
Copy link
Member

arm4b commented Oct 23, 2023

Unit Tests are running fine now and reporting the coverage 🟢 (https://app.codecov.io/gh/StackStorm/st2/commits) after merging this PR.

The Orquesta Integration tests though failed 🔴 on:

- name: 'Integration Tests (Orquesta)'
task: 'ci-orquesta'
nosetests_node_total: 1
nosetests_node_index: 0
python-version: '3.6.13'
python-version-short: '3.6'
- name: 'Integration Tests (Orquesta)'
task: 'ci-orquesta'
nosetests_node_total: 1
nosetests_node_index: 0
python-version-short: '3.8'
python-version: '3.8.10'
- name: 'Integration Tests (Orquesta)'
task: 'ci-orquesta'
nosetests_node_total: 1
nosetests_node_index: 0
python-version-short: '3.9'
python-version: '3.9.14'

- 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' }}"
run: |
./scripts/ci/submit-codecov-coverage.sh

where we missed to include the CODECOV_TOKEN and py3.8 condition in GH workflows.

@FileMagic If you'd like to help with that as well, considering you already figured out the solution in this PR.

@FileMagic
Copy link
Contributor Author

Unit Tests are running fine now and reporting the coverage 🟢 (https://app.codecov.io/gh/StackStorm/st2/commits) after merging this PR.

The Orquesta Integration tests though failed 🔴 on:

- name: 'Integration Tests (Orquesta)'
task: 'ci-orquesta'
nosetests_node_total: 1
nosetests_node_index: 0
python-version: '3.6.13'
python-version-short: '3.6'
- name: 'Integration Tests (Orquesta)'
task: 'ci-orquesta'
nosetests_node_total: 1
nosetests_node_index: 0
python-version-short: '3.8'
python-version: '3.8.10'
- name: 'Integration Tests (Orquesta)'
task: 'ci-orquesta'
nosetests_node_total: 1
nosetests_node_index: 0
python-version-short: '3.9'
python-version: '3.9.14'

- 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' }}"
run: |
./scripts/ci/submit-codecov-coverage.sh

where we missed to include the CODECOV_TOKEN and py3.8 condition in GH workflows.

* https://github.com/StackStorm/st2/actions/runs/6612741025/job/17970691174

* https://github.com/StackStorm/st2/actions/runs/6612741025/job/17970691413

* https://github.com/StackStorm/st2/actions/runs/6612741025/job/17970691618

@FileMagic If you'd like to help with that as well, considering you already figured out the solution in this PR.

I see, yeah I can fix that tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M PR that changes 30-99 lines. Good size to review.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fix CI / Unit Tests Failing
3 participants