ENH: Convert from Docker action to composite action with setup-pixi#23
ENH: Convert from Docker action to composite action with setup-pixi#23hjmjohnson merged 3 commits intomainfrom
Conversation
572295b to
f87aa5a
Compare
Point clang-format-linter at ITKClangFormatLinterAction@composite-action to test the new composite action. Build workflows disabled. No code changes - clang-format should pass. See: InsightSoftwareConsortium/ITKClangFormatLinterAction#23
Add badly formatted code to test that the composite clang-format linter correctly detects and reports style violations. See: InsightSoftwareConsortium/ITKClangFormatLinterAction#23
Validation ResultsTested the composite action on ITKCuberille with two WIP PRs: Test 1: Clean code (expect PASS) — ITKCuberille#96Result: PASSED — lint job Version verification from logs: Test 2: Deliberate violation (expect FAIL) — ITKCuberille#97Result: FAILED — lint job The linter correctly detected the violation and reported: Verified behaviors
Both WIP PRs will be closed after this review. |
Timing Comparison: Docker vs Composite ActionMeasured on ITKCuberille using recent lint runs. Docker action (current
|
| Run | Docker Build | Lint | Total |
|---|---|---|---|
| 23929699361 | 23s | 3s | 27s |
| 23163109631 | 19s | 6s | 26s |
| 23929698324 | 17s | 3s | 21s |
| Average | 20s | 4s | 25s |
Composite action (this PR)
| Run | Docker Build | Lint | Total |
|---|---|---|---|
| 23946965792 (pass) | N/A | 3s | 6s |
| 23946978057 (fail) | N/A | 3s | 6s |
| 23946964100 (pass) | N/A | 3s | 5s |
| Average | 0s | 3s | 6s |
Summary
| Docker | Composite | ||
|---|---|---|---|
| Total job time | ~25s | ~6s | 4.4x faster |
| Docker build overhead | ~20s | 0s | Eliminated |
| Lint execution | ~4s | ~3s | Same |
The ~20s Docker build step (FROM ubuntu:18.04 → apt-get install → copy entrypoint) runs on every invocation and is completely eliminated by the composite action. The actual clang-format check takes ~3s either way.
Additionally, when Docker Hub rate-limits the ubuntu:18.04 pull (which happens frequently on shared runners), the Docker action fails entirely after retries, wasting 30-60s before reporting the infrastructure error. The composite action eliminates this failure mode completely.
There was a problem hiding this comment.
Pull request overview
This PR refactors the ITK clang-format linter GitHub Action from a Docker-based action to a composite action that runs directly on the GitHub Actions runner, aiming to avoid Docker Hub rate limits and make pixi installation more reliable via prefix-dev/setup-pixi.
Changes:
- Replaced
runs.using: dockerwith a composite action workflow of shell steps. - Added logic to determine the
clang-formatversion from ITK’s.pre-commit-config.yamland install it via pixi. - Switched ITK file/script downloads from
wgettocurlwith retry behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@thewtex I am trying to make the PRs for remote modules more robust and faster. Clang linting has been a common transient failure point. I asked claude-code to help identify more robust solutions. This PR is mostly the result of that effort. It completely changes the approach, but I think I have demonstrated that it works the same. |
34e4bf6 to
3ced120
Compare
Replace the Docker-based action (FROM ubuntu:18.04) with a composite action that runs directly on the GitHub Actions runner. Problems fixed: - Docker Hub rate limiting (401/429) pulling EOL ubuntu:18.04 - Transient pixi download failures (HTTP 502) from curl|bash Implementation: - prefix-dev/setup-pixi@v0.9.4 for reliable pixi installation with built-in caching (run-install: false, global install only) - curl --retry 3 --retry-delay 30 for resilient downloads (without --retry-all-errors so 404 from invalid itk-branch fails fast) - Step outputs for passing clang-format version between steps - Version validation: empty/malformed version detection with clear error messages - release-5.4/release branches: pip install clang-format==8.0.1 (not available in conda-forge, available on PyPI) - main/other branches: pixi global install with exact version from ITK .pre-commit-config.yaml Tested on ITKCuberille: - PR#96: clean code passed lint (clang-format 19.1.7 verified) - PR#97: deliberate violation detected and reported correctly - 4.4x faster than Docker action (6s vs 25s average) The Dockerfile and entrypoint.sh are retained for reference but are no longer used by action.yml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3ced120 to
d9ab7aa
Compare
dzenanz
left a comment
There was a problem hiding this comment.
Looks good on a glance. Someone else should review.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add the pip scripts directory to $GITHUB_PATH after installing clang-format via pip for release/release-5.4 branches. This ensures the binary is discoverable by subsequent steps regardless of the runner's default PATH configuration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Re-validation After Addressing Review CommentsTested the updated composite action (with pip PATH fix from commit cf3a9f1) on ITKCuberille: Test 1: Clean code (expect PASS) — ITKCuberille#98Result: PASSED — lint job Test 2: Deliberate violation (expect FAIL) — ITKCuberille#99Result: FAILED — lint job Review comment responses
Both WIP PRs will be closed after this review. |
Summary
Convert the clang-format linter from a Docker-based action (
FROM ubuntu:18.04) to a composite action that runs directly on the GitHub Actions runner usingprefix-dev/setup-pixi@v0.9.4.Problems fixed
1. Docker Hub rate limiting (401/429)
The Dockerfile pulls
ubuntu:18.04(EOL since April 2023) from Docker Hub. GitHub Actions shared runners share IP pools and frequently hit Docker Hub's anonymous rate limits (100 pulls/6hrs), causing intermittent failures across all ~55 ITK remote modules.2. Transient pixi download failures (HTTP 502)
The entrypoint.sh installs pixi via
curl -fsSL https://pixi.sh/install.sh | bashwhich has no retry logic. Transient CDN failures (HTTP 502 Bad Gateway) cause the linter to fail even when the code is correctly formatted.Solution
Replace with a composite action that:
prefix-dev/setup-pixi@v0.9.4for reliable pixi installation with built-in caching and retrycurl --retry 3 --retry-delay 10 --retry-all-errorsfor ITK config file downloadserror-message,itk-branch) and behaviorBefore vs After
ubuntu:18.04from Docker Hubcurl | bash(no retry)setup-pixi@v0.9.4(cached, retries)wget(no retry)curl --retry 3Test plan
@composite-actionbranch.pre-commit-config.yaml🤖 Generated with Claude Code