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

Fix Codecov upload with token #115384

Merged
merged 5 commits into from
Apr 11, 2024
Merged

Fix Codecov upload with token #115384

merged 5 commits into from
Apr 11, 2024

Conversation

TheJulianJES
Copy link
Member

@TheJulianJES TheJulianJES commented Apr 10, 2024

Proposed change

This fixes the Codecov action by properly using the GitHub secrets token for runs in the main repo.
When Codecov v4 is running in a fork, it'll ignore the provided token (will be empty due to the missing GitHub secret) and forces a tokenless upload.

Built upon the work Nick did in #115321, this also removes wretry, as it should no longer be needed with Codecov v4.

  • check this works for branches on the main repo (using token, was always broken before) (this PR did that)
  • check this works for branches on forks (using tokenless upload, ignoring missing GH secret) (tested on zigpy repos, HA PR DNM: Remove wretry action from codecov (test run from fork) #115437 will also repeat the check for the core repo)

Do note that on forks, "random" failures might still occur sometimes, as tokenless uploads are constrained by the GitHub API rate limit. Runs on the main repo should "always" work now, as token uploads are not constrained by that API limit.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed small-pr PRs with less than 30 lines. labels Apr 10, 2024
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
@MartinHjelmare
Copy link
Member

This will probably have to wait until the flaky test in bucket 4 has been fixed. It's failing in PRs at the moment.

@bdraco
Copy link
Member

bdraco commented Apr 11, 2024

that test seems to run fine the first time but fails with

pytest --count=10 tests/components/rtsp_to_webrtc/test_diagnostics.py::test_entry_diagnostics

@bdraco
Copy link
Member

bdraco commented Apr 11, 2024

#115437 is with secrets running from a fork

@TheJulianJES
Copy link
Member Author

TheJulianJES commented Apr 11, 2024

We've also done a bit of testing and switched zigpy repos to using codecov-action v4 with secrets.
It's working fine on both the main repos (token upload) and forks (tokenless).
Tokenless uploads are (obviously) still capped by the GitHub API rate limit, so might still fail intermittently, but token uploads seem solid now.

Related PRs linked in:

@bdraco
Copy link
Member

bdraco commented Apr 11, 2024

If #115321 and #115437 pass I think this is good to go if you want to cleanup the opening text and undraft

@TheJulianJES TheJulianJES marked this pull request as ready for review April 11, 2024 19:25
@TheJulianJES TheJulianJES requested a review from a team as a code owner April 11, 2024 19:25
@TheJulianJES
Copy link
Member Author

TheJulianJES commented Apr 11, 2024

Both of those PRs failed due to an unrelated flakey test now.
This PR confirms that token uploads are working as expected now, as the upload succeeded and the codecov checks show up. (#115321 also tested this again)

For PR from forks, we've had no issues with basically the same codecov setup on all zigpy repos. #115437 also passed now and has the codecov checks visible 🎉

IMO, we should be good to go with this.

@bdraco
Copy link
Member

bdraco commented Apr 11, 2024

Thanks @TheJulianJES

@bdraco bdraco merged commit 6ba7a30 into dev Apr 11, 2024
38 checks passed
@bdraco bdraco deleted the codecov-token-fix branch April 11, 2024 19:51
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants