question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CI: avoid and fix ci failure, either by relying on pre-commit.ci or running pre-commit in a github workflow

See original GitHub issue

Issue 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.

  1. It runs pre-commit.ci based on the .pre-commit-config.yaml file (very fast)
  2. It automatically submit PRs if a version needs to be updated in a .pre-commit-config.yaml file
  3. 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 image
  • Automatically added a commit to a PR by having run pre-commit and letting it do autoformatting work (in this case, with new config) image
  • Automatically run tests and reported results image

Reference to related code

https://github.com/dask/dask-gateway/blob/bee9255e5ea0d77f456985cd91b2622bb3776dbb/.github/workflows/test.yaml#L46-L49

https://github.com/dask/dask-gateway/blob/bee9255e5ea0d77f456985cd91b2622bb3776dbb/.pre-commit-config.yaml#L1-L11

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:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
consideRatiocommented, Feb 16, 2022

@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

0reactions
jacobtomlinsoncommented, Feb 16, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found