Skip to content

Commit 572295b

Browse files
hjmjohnsonclaude
andcommitted
ENH: Convert from Docker action to composite action
Replace the Docker-based action (FROM ubuntu:18.04) with a composite action that runs directly on the GitHub Actions runner. This fixes two recurring CI reliability issues: 1. Docker Hub rate limiting (401/429) pulling ubuntu:18.04 (EOL) which intermittently breaks the linter across all remote modules. 2. Transient pixi download failures (HTTP 502) from the raw curl-pipe-to-bash install method. The composite action uses: - prefix-dev/setup-pixi@v0.9.4 for reliable pixi installation with built-in caching and retry - curl --retry for resilient downloads of ITK configuration files - Direct runner execution (no Docker pull needed) The Dockerfile and entrypoint.sh are retained for backwards compatibility but are no longer referenced by action.yml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6d1758b commit 572295b

1 file changed

Lines changed: 69 additions & 5 deletions

File tree

action.yml

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,72 @@ inputs:
99
description: 'The Git branch of the ITK repository to fetch .clang-format from.'
1010
default: 'main'
1111
runs:
12-
using: 'docker'
13-
image: 'Dockerfile'
14-
args:
15-
- ${{ inputs.error-message }}
16-
- ${{ inputs.itk-branch }}
12+
using: 'composite'
13+
steps:
14+
- name: Fetch ITK clang-format configuration
15+
shell: bash
16+
run: |
17+
set -euo pipefail
18+
ITK_BRANCH="${{ inputs.itk-branch }}"
19+
20+
# Fetch the .clang-format file from the specified branch
21+
if ! test -f ./.clang-format; then
22+
echo "Downloading ITK .clang-format from ${ITK_BRANCH}"
23+
curl --retry 3 --retry-delay 10 --retry-all-errors -fsSL \
24+
"https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${ITK_BRANCH}/.clang-format" \
25+
-o .clang-format
26+
fi
27+
28+
# Fetch the clang-format runner script
29+
curl --retry 3 --retry-delay 10 --retry-all-errors -fsSL \
30+
"https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${ITK_BRANCH}/Utilities/Maintenance/clang-format.bash" \
31+
-o clang-format.bash
32+
chmod +x ./clang-format.bash
33+
34+
# Determine clang-format version from ITK pre-commit config
35+
if test "${ITK_BRANCH}" != "release-5.4" -a "${ITK_BRANCH}" != "release"; then
36+
curl --retry 3 --retry-delay 10 --retry-all-errors -fsSL \
37+
"https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${ITK_BRANCH}/.pre-commit-config.yaml" \
38+
-o ITK.pre-commit-config.yaml
39+
CLANG_FORMAT_VERSION=$(grep -A 1 "mirrors-clang-format" ITK.pre-commit-config.yaml | tail -n 1 | cut -d: -f2 | tr -d ' v')
40+
echo "CLANG_FORMAT_VERSION=${CLANG_FORMAT_VERSION}" >> $GITHUB_ENV
41+
fi
42+
43+
- name: Install pixi
44+
if: env.CLANG_FORMAT_VERSION != ''
45+
uses: prefix-dev/setup-pixi@v0.9.4
46+
47+
- name: Install clang-format via pixi
48+
if: env.CLANG_FORMAT_VERSION != ''
49+
shell: bash
50+
run: |
51+
pixi global install clang-format==${{ env.CLANG_FORMAT_VERSION }}
52+
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
53+
# Find the installed clang-format and add to PATH
54+
PIXI_ENV_PATH=$(pixi global list 2>/dev/null | grep -o '/[^ ]*envs/clang-format' || echo "")
55+
if [ -n "${PIXI_ENV_PATH}" ]; then
56+
echo "${PIXI_ENV_PATH}/bin" >> $GITHUB_PATH
57+
fi
58+
# Also check common pixi global install locations
59+
for p in "$HOME/.pixi/envs/clang-format/bin" "$HOME/.pixi/envs/default/bin"; do
60+
[ -d "$p" ] && echo "$p" >> $GITHUB_PATH
61+
done
62+
63+
- name: Run clang-format check
64+
shell: bash
65+
run: |
66+
set -euo pipefail
67+
./clang-format.bash --tracked
68+
if ! git diff-index --diff-filter=M --quiet HEAD -- ':!.clang-format'; then
69+
echo "::error ::${{ inputs.error-message }}"
70+
echo ""
71+
echo "Changes required:"
72+
echo ""
73+
echo "Files:"
74+
git diff-index --diff-filter=M --name-only HEAD -- ':!.clang-format'
75+
echo ""
76+
echo "Changes:"
77+
git diff HEAD -- ':!.clang-format'
78+
exit 1
79+
fi
80+
echo "clang-format ITK Coding Style check completed successfully."

0 commit comments

Comments
 (0)