-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·49 lines (41 loc) · 1.8 KB
/
entrypoint.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -euo pipefail
set -x
error_message="$1"
itk_branch="$2"
git config --global --add safe.directory /github/workspace
cd "$GITHUB_WORKSPACE"
# Fetch the .clang-format file from the specified branch
wget https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${itk_branch}/.clang-format -O /ITK.clang-format
if test $itk_branch != "release-5.4" -a $itk_branch != "release"; then
# Use the same version of clang-format as used by ITK with its configuration
wget https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${itk_branch}/.pre-commit-config.yaml -O ./ITK.pre-commit-config.yaml
clang_format_version=$(grep -A 1 "mirrors-clang-format" ./ITK.pre-commit-config.yaml | tail -n 1 | cut -d: -f2 | tr -d ' v')
touch ${HOME}/.bashrc # The ~/.bashrc file must exist for pixi to initialize properly https://github.com/prefix-dev/pixi/pull/3051
curl -fsSL https://pixi.sh/install.sh | bash
export PATH=$HOME/.pixi/bin:$PATH
pixi init ..
pixi global install clang-format==$clang_format_version
export PATH=$PWD/../.pixi/envs/default/bin:$PATH
export PATH=$PWD/.pixi/envs/default/bin:$PATH
export PATH=/.pixi/envs/default/bin:$PATH
fi
wget https://raw.githubusercontent.com/InsightSoftwareConsortium/ITK/${itk_branch}/Utilities/Maintenance/clang-format.bash
chmod +x ./clang-format.bash
if ! test -f ./.clang-format; then
cp /ITK.clang-format ./.clang-format
fi
./clang-format.bash --tracked
if ! git diff-index --diff-filter=M --quiet HEAD -- ':!.clang-format'; then
echo "::error ::${error_message}"
echo ""
echo "Changes required:"
echo ""
echo "Files:"
git diff-index --diff-filter=M --name-only HEAD -- ':!.clang-format'
echo ""
echo "Changes:"
git diff HEAD -- ':!.clang-format'
exit 1
fi
echo "clang-format ITK Coding Style check completed successfully."