CI: avoid and fix ci failure, either by relying on pre-commit.ci or running pre-commit in a github workflow
See original GitHub issueIssue summary
The main
job in the test
workflow fail in a step running black . --check
because of the latest version of black is used, while it don’t fail when using pre-commit
which has a config with a pinned version. If we relied on pre-commit to run checks, instead of manually running flake8
and black
- the pinned versions would be used and this wouldn’t happen.
More than a solution to this
I’d like to propose a fix that does a bit ore than just fixing this.
In the jupyterhub ecosystem we started relying on running the pre-commit checks with the pre-commit.ci service which does three things - of which a github workflow would only easily do one.
- It runs pre-commit.ci based on the .pre-commit-config.yaml file (very fast)
- It automatically submit PRs if a version needs to be updated in a .pre-commit-config.yaml file
- It automatically adds a commit to a PR with autoformatting changes if needed
An example all of of this in https://github.com/jupyterhub/jupyterhub/pull/3784 is when pre-commit.ci has:
- Created a PR to automatically update versions in a .pre-commit-config.yaml file
- Automatically added a commit to a PR by having run pre-commit and letting it do autoformatting work (in this case, with new config)
- Automatically run tests and reported results
Reference to related code
Suggested action points
- Activate pre-commit.ci as a service for this project.
This is done by visiting the pre-commit.ci GitHub app and making it available for the dask GitHub organization to use: https://results.pre-commit.ci/
And declare it to be used specifically on this github repository at: https://github.com/organizations/dask/settings/installations
This means it would…
- a) automatically runs a pre-commit CI/CD check like a github workflow would
- b) automatically create PRs updating the version of pre-commit hooks defined in .pre-commit-config.yaml when new versions are out - at most once a week.
- c) automatically add commits to PRs with autoformatting changes based on the .pre-commit-config.yaml file if needed
- Merge a PR, such as #477, removing the manual test step here and instead rely on pre-commit.ci to report if running pre-commit led to a failure.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
a GitHub action to run `pre-commit`
while unrelated to this action, pre-commit.ci avoids these problems by installing and executing isolated from the short-lived repository-scoped installation ...
Read more >Support fail_fast on check level · Issue #1143 · pre-commit/pre ...
In my scenario I would like the pre-commit fail fast only when build fails, but when check-apache-licence fail I would like pre-commit to ......
Read more >pre-commit failing in Github Actions within setup.cfg file #112
Today @JafarAbdi and I got a failing pre-commit CI when we've added a setup.cfg ... The error we are getting from Github Actions...
Read more >[FEA] Make style CI and pre-commit hooks consistent #8193
Either : Changing ci/checks/style.sh to enforce the additional rules set by the pre-commit hooks; Changing the various configuration files used ...
Read more >pre-commit
We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jacobtomlinson thanks for taking the leap, this is a quality of life improvement for me! I hesitated initially within JupyterHub as well, but were convinced by seeing it piloted in a repo - as championed by @manics if I recall correctly 😃 Thanks @manics!!!
https://github.com/dask/community/issues/222
Ok merged! @consideRatio would you mind opening the community issue to describe the benefits of making this change and to let folks know we are trialing on
dask-gateway
?Also happy to make this change on the helm chart too, the autofix would be especially nice there because not many folks are used to running
frigate
.