-
Notifications
You must be signed in to change notification settings - Fork 584
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
Vastly overhaul the CI workflow for file checks #847
Conversation
This is used in `.github/workflows/ci-file-checks.yaml` to parse the output of Pylint and report errors on the workflow summary page. The [`pylint.json`](https://github.com/home-assistant/core/blob/dev/.github/workflows/matchers/pylint.json) file came from the [Home Assistant](https://github.com/home-assistant/core) project on GitHub. The Home Assistant project is licensed under the Apache 2.0 open-source license.
This is a complete rewrite of the file checks portion of the CI workflow. It incorporates many new features and efficience gains. It also serves as a framework for adding additional file linters/format checkers, such as for YAML, Markdown, shell scripts, and more. Features: - Serious use of caching of the Python installation and environment, so that repeated runs don't have to reinstall everything every time. - Concurrency detection: if a new event such as a push to a PR branch comes in while a workflow is already executing, that workflow is cancelled and a new one restarted. (The existing workflow keeps the existing one running and starts a second one, which is almost never useful.) - File-aware execution: the workflow tests which files have been modified in a given event, and invokes only the relevant lint/format-checker jobs. This reduces compute cycles needed and speeds up the overall execution. - Use of GitHub [Problem Matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md) for better error reporting. - Addition of a manual run interface, allowing the workflow to be invoked manually from the GitHub GUI with different values for program versions – useful for debugging, testing, exploring behaviors with different versions of linters, etc. - Compatibility with GitHub [merge queues](https://github.blog/news-insights/product-news/github-merge-queue-is-generally-available/).
Adding a note for clarification: this workflow looks very complicated only because of the tests and caching done to make it efficient, and for reporting results in the GitHub interface. The actual file check CI operations done by PR #847 are just this:
Those 3 things are what the two scripts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Vastly overhaul the CI workflow for file checks
This is a complete rewrite of the file checks portion of the CI workflow. It incorporates many new features and efficiency gains. It also serves as a framework for adding additional file linters/format checkers, such as for YAML, Markdown, shell scripts, and more.
Features:
Serious use of caching of the Python installation and environment, so that repeated runs don't have to reinstall everything every time.
Concurrency detection: if a new event such as a push to a PR branch comes in while a workflow is already executing, that workflow is cancelled and a new one restarted. (The existing workflow keeps the existing one running and starts a second one, which is almost never useful.)
File-aware execution: the workflow tests which files have been modified in a given event, and invokes only the relevant lint/format-checker jobs. This reduces compute cycles needed and speeds up the overall execution.
Use of GitHub Problem Matchers for better error reporting.
Addition of a manual run interface, allowing the workflow to be invoked manually from the GitHub GUI with different values for program versions – useful for debugging, testing, exploring behaviors with different versions of linters, etc.
Compatibility with GitHub merge queues.
For Python, this implements the equivalent of
scripts/lint_all.sh
(which, despite its name, actually only lints Python files) and the Python-specific format checks ofscripts/format_check.sh
.For C++, this runs clang-format with input limited to the files changed in a given PR.