File tree Expand file tree Collapse file tree 3 files changed +14
-15
lines changed
Expand file tree Collapse file tree 3 files changed +14
-15
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ branding:
77
88inputs :
99 clang-format-version :
10- description : ' The major version of clang-format that you want to use.'
10+ description : ' The version of clang-format that you want to use. Use either major version, or exact one .'
1111 required : false
1212 default : ' 21'
1313 check-path :
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ format_diff() {
5656}
5757
5858CLANG_FORMAT_VERSION=" $1 "
59- CLANG_FORMAT_MAJOR_VERSION=${CLANG_FORMAT_VERSION%% .* }
59+ CLANG_FORMAT_MAJOR_VERSION=" ${CLANG_FORMAT_VERSION%% .* } "
6060CHECK_PATH=" $2 "
6161FALLBACK_STYLE=" $3 "
6262EXCLUDE_REGEX=" $4 "
Original file line number Diff line number Diff line change @@ -2,21 +2,20 @@ ARG UBUNTU_VERSION
22FROM ubuntu:${UBUNTU_VERSION}
33
44ARG CLANG_FORMAT_VERSION
5- ENV CLANG_FORMAT_MAJOR_VERSION=${CLANG_FORMAT_VERSION%%.*}
5+ ENV PIP_ROOT_USER_ACTION=ignore
6+ ENV PIP_BREAK_SYSTEM_PACKAGES=1
67
78RUN apt-get update \
8- && apt-get install --no-install-recommends -y \
9- clang-format-${CLANG_FORMAT_MAJOR_VERSION} \
10- && mv /usr/bin/clang-format-${CLANG_FORMAT_MAJOR_VERSION} /usr/bin/clang-format
11-
12- RUN [ $CLANG_FORMAT_VERSION != $CLANG_FORMAT_MAJOR_VERSION ] \
13- && apt-get install --no-install-recommends -y python-pip \
14- && pip install "clang-format~=$CLANG_FORMAT_VERSION" \
15- && mv -f "$(which clang-format)" /usr/bin/clang-format
16-
17- # Clean cache
18- RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
19- && apt-get clean -y && rm -rf /var/lib/apt/lists/*
9+ && apt-get install --no-install-recommends -y python3-pip \
10+ && pip install -v "$( \
11+ echo " $CLANG_FORMAT_VERSION" | grep -qF '.' \
12+ && echo " clang-format==${CLANG_FORMAT_VERSION}" \
13+ || echo " clang-format==${CLANG_FORMAT_VERSION}.*" \
14+ )" \
15+ # Clean cache
16+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
17+ && apt-get clean -y && rm -rf /var/lib/apt/lists/* \
18+ && mv /usr/local/bin/clang-format /usr/bin/clang-format
2019
2120WORKDIR /
2221
You can’t perform that action at this time.
0 commit comments