Repository navigation
Agent friendly checks: make review conventions mechanically checkable #9748
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
Open
sangbida
wants to merge
16
commits into
ElementsProject:master
Choose a base branch
from
sangbida:agent-friendly-checks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ff03939
ci: validate changelog entries
sangbida 9190bd2
tools: require strict pytest xfail markers
sangbida fa58d63
tools: report newly added lines
sangbida 98e741c
tools: reject default labels in enum switches
sangbida e6e6f93
tools: check every commit in a branch
sangbida 1908fd4
ci: add opt-in per-commit checks
sangbida b2e74fb
tools: reject comments which will go stale
sangbida 85b9d69
tools: cap added comment length
sangbida f0f7f0e
tools: check commit message prose
sangbida fc5ce38
tools: reject unused added functions
sangbida 49afa80
tools: require NULL parents for take()
sangbida 3d9ba60
tools: require a subsystem in commit subjects
sangbida 20e81e8
pre-commit: remove the stale commitlint hook
sangbida 86e80f7
tools: require tab indentation in C code
sangbida 712cb9f
tools: reject take() in wire call arguments
sangbida d758e75
tools: test the source checkers
sangbida File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| --- | ||
| name: Per-commit checks | ||
| # Builds and tests every commit of a PR except the last, which the main CI | ||
| # workflow already covers. | ||
| # | ||
| # Off by default. A maintainer turns it on for all PRs by setting the | ||
| # repository variable PER_COMMIT_CHECKS to "true", for one PR by adding the | ||
| # "per-commit-checks" label, or runs it by hand on a branch. | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, labeled] | ||
| workflow_dispatch: | ||
| inputs: | ||
| base: | ||
| description: Branch the commits are compared against | ||
| default: master | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| env: | ||
| # Reduce size, as in the main CI workflow | ||
| RUST_PROFILE: small | ||
| SLOW_MACHINE: 1 | ||
| SCCACHE_GHA_ENABLED: "true" | ||
| BASE_REF: ${{ github.base_ref || inputs.base }} | ||
| PASSED_KEY: check-commits-${{ github.event.pull_request.number || github.ref_name }} | ||
|
|
||
| jobs: | ||
| per-commit: | ||
| name: Build and test each commit | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 120 | ||
| if: >- | ||
| github.event_name == 'workflow_dispatch' || | ||
| (github.event.action == 'labeled' && | ||
| github.event.label.name == 'per-commit-checks') || | ||
| (github.event.action != 'labeled' && | ||
| (vars.PER_COMMIT_CHECKS == 'true' || | ||
| contains(github.event.pull_request.labels.*.name, 'per-commit-checks'))) | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| fetch-depth: 0 | ||
| submodules: recursive | ||
|
|
||
| - name: Set up Python 3.10 | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: "3.10" | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v10.3.2 | ||
|
|
||
| - uses: actions/cache@v6 | ||
| with: | ||
| path: ~/ci-cache | ||
| key: apt-${{ runner.os }} | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| bash -x .github/scripts/setup.sh | ||
| # check-source checks BOLT quotes | ||
| git clone https://github.com/lightning/bolts.git ../bolts | ||
|
|
||
| - name: Setup sccache | ||
| uses: mozilla-actions/sccache-action@v0.0.11 | ||
|
|
||
| # Commits that passed on an earlier push of this PR are not rechecked. | ||
| - name: Restore list of commits that passed | ||
| uses: actions/cache/restore@v6 | ||
| with: | ||
| path: ~/check-commits | ||
| key: ${{ env.PASSED_KEY }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
| restore-keys: | | ||
| ${{ env.PASSED_KEY }}- | ||
|
|
||
| # The Rust build is the slow part, and the main CI workflow builds the | ||
| # last commit with it anyway. | ||
| - name: Configure | ||
| run: | | ||
| git fetch origin "$BASE_REF" | ||
| rust=--disable-rust | ||
| if ! git diff --quiet "origin/$BASE_REF...HEAD" -- '*.rs' '*Cargo.toml' Cargo.lock cln-grpc/ cln-rpc/ contrib/msggen/ doc/schemas/; then | ||
| rust=--enable-rust | ||
| fi | ||
| ./configure --enable-debugbuild --disable-valgrind "$rust" CC="sccache gcc" | ||
|
|
||
| - name: Check each commit | ||
| env: | ||
| COMPAT: 1 | ||
| RUSTC_WRAPPER: sccache | ||
| PYTEST_OPTS: --timeout=1800 | ||
| CHECK_COMMITS_SKIP_TIP: 1 | ||
| CHECK_COMMITS_LOGDIR: ${{ runner.temp }}/check-commits-logs | ||
| run: | | ||
| mkdir -p ~/check-commits | ||
| touch ~/check-commits/passed | ||
| export CHECK_COMMITS_CACHE=~/check-commits/passed | ||
| export GRPC_BREAKING_BASE_REF="origin/$BASE_REF" | ||
| # Use the base branch's script, so a PR branched before a change | ||
| # to it is checked the same way as every other PR. | ||
| script="$RUNNER_TEMP/check-commits.sh" | ||
| git show "origin/$BASE_REF:tools/check-commits.sh" > "$script" 2>/dev/null || cp tools/check-commits.sh "$script" | ||
| chmod +x "$script" | ||
| sg wireshark "uv run eatmydata $script origin/$BASE_REF" | ||
|
|
||
| - name: Save list of commits that passed | ||
| if: always() | ||
| uses: actions/cache/save@v6 | ||
| with: | ||
| path: ~/check-commits | ||
| key: ${{ env.PASSED_KEY }}-${{ github.run_id }}-${{ github.run_attempt }} | ||
|
|
||
| - name: Upload step logs | ||
| if: failure() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: check-commits-logs | ||
| path: ${{ runner.temp }}/check-commits-logs | ||
| if-no-files-found: ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.