From 87866ff9e49704a477f685cbb5de3a23b6530ede Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 19 May 2023 14:42:50 +0000 Subject: [PATCH 1/5] feat: support clang v16 --- 16/Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 16/Dockerfile diff --git a/16/Dockerfile b/16/Dockerfile new file mode 100644 index 0000000..4f38634 --- /dev/null +++ b/16/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:22.04 + +ENV CLANG_VERSION 16 + +RUN apt-get update \ + && apt-get --no-install-recommends -y wget curl \ + && wget --progress=dot:giga https://apt.llvm.org/llvm.sh -O llvm_install.sh \ + && chmod +x llvm_install.sh \ + && llvm_install.sh $CLANG_VERSION \ + && apt-get --no-install-recommends -y clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION \ + && ln -s /usr/bin/clang-format-$CLANG_VERSION /usr/bin/clang-format \ + && ln -s /usr/bin/clang-tidy-$CLANG_VERSION /usr/bin/clang-tidy \ + && echo "--- Clang-format version ---" \ + && clang-format --version \ + && echo "--- Clang-tidy version ---" \ + && clang-tidy --version \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /src + +CMD [""] From 57285a851d4a614f23f85394b36409aa018b24ea Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sat, 20 May 2023 09:13:35 +0000 Subject: [PATCH 2/5] feat: support clang v16 --- 16/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/16/Dockerfile b/16/Dockerfile index 4f38634..3d5db4c 100644 --- a/16/Dockerfile +++ b/16/Dockerfile @@ -2,12 +2,14 @@ FROM ubuntu:22.04 ENV CLANG_VERSION 16 +WORKDIR /src + RUN apt-get update \ - && apt-get --no-install-recommends -y wget curl \ - && wget --progress=dot:giga https://apt.llvm.org/llvm.sh -O llvm_install.sh \ - && chmod +x llvm_install.sh \ - && llvm_install.sh $CLANG_VERSION \ - && apt-get --no-install-recommends -y clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION \ + && apt-get --no-install-recommends -y install lsb-release wget software-properties-common gnupg \ + && wget --quiet https://apt.llvm.org/llvm.sh \ + && chmod +x llvm.sh \ + && ./llvm.sh $CLANG_VERSION && rm -rf llvm.sh \ + && apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION \ && ln -s /usr/bin/clang-format-$CLANG_VERSION /usr/bin/clang-format \ && ln -s /usr/bin/clang-tidy-$CLANG_VERSION /usr/bin/clang-tidy \ && echo "--- Clang-format version ---" \ @@ -16,6 +18,4 @@ RUN apt-get update \ && clang-tidy --version \ && rm -rf /var/lib/apt/lists/* -WORKDIR /src - CMD [""] From 49d6efe54406e790dcf641b1e1d195137621ea01 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sat, 20 May 2023 09:26:55 +0000 Subject: [PATCH 3/5] save work --- all/Dockerfile | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/all/Dockerfile b/all/Dockerfile index fecae10..537d73e 100644 --- a/all/Dockerfile +++ b/all/Dockerfile @@ -1,18 +1,14 @@ FROM ubuntu:20.04 -ARG DEFAULT_VERSION=12 - ENV CLANG_VERSIONS="12 11 10 9 8" LABEL org.opencontainers.image.source="https://github.com/cpp-linter/clang-tools" RUN apt-get update \ - && for CLANG_VERSION in ${CLANG_VERSIONS}; do \ + && for CLANG_VERSION in "$CLANG_VERSIONS"; do \ apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ - && rm -rf /var/lib/apt/lists/* \ - && ln -s /usr/bin/clang-format-$DEFAULT_VERSION /usr/bin/clang-format \ - && ln -s /usr/bin/clang-tidy-$DEFAULT_VERSION /usr/bin/clang-tidy \ - && mv /etc/apt/sources.list /etc/apt/sources.list.focal + && rm -rf /var/lib/apt/lists/* + ENV CLANG_VERSIONS="14 13" @@ -20,14 +16,31 @@ ENV CLANG_VERSIONS="14 13" COPY sources.list.jammy /etc/apt/sources.list RUN apt-get update \ - && for CLANG_VERSION in ${CLANG_VERSIONS}; do \ + && for CLANG_VERSION in "$CLANG_VERSIONS"; do \ apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ && mv /etc/apt/sources.list.focal /etc/apt/sources.list \ - && rm -rf /var/lib/apt/lists/* \ - && echo "--- Clang-format version ---" \ - && clang-format --version \ - && echo "--- Clang-tidy version ---" \ - && clang-tidy --version + && rm -rf /var/lib/apt/lists/* + +ENV CLANG_VERSIONS="16 15" + +WORKDIR /tmp + +RUN apt-get update \ + && apt-get --no-install-recommends -y install lsb-release wget software-properties-common gnupg \ + && wget --quiet https://apt.llvm.org/llvm.sh \ + && chmod +x llvm.sh \ + && for CLANG_VERSION in "$CLANG_VERSIONS"; do \ + ./llvm.sh $CLANG_VERSION \ + apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ + && rm llvm.sh \ + && rm -rf /var/lib/apt/lists/* + +# Check versions + +ENV CLANG_VERSIONS="16 15 14 13 12 11 10 9 8" +RUN for VERSION in "$CLANG_VERSIONS"; do \ + clang-format-$VERSION --version \ + clang-tidy-$VERSION --version; done WORKDIR /src From 23e03593397a2a1947c2bb83364b01fffd7ce774 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sat, 20 May 2023 14:32:15 +0000 Subject: [PATCH 4/5] feat: add v16 15 to tag all image --- .hadolint.yaml | 1 + README.md | 5 +++-- all/Dockerfile | 39 ++++++++++++++++----------------------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.hadolint.yaml b/.hadolint.yaml index 95c61c4..002e0bc 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -1,3 +1,4 @@ ignored: - DL3008 - DL3018 + - SC2086 \ No newline at end of file diff --git a/README.md b/README.md index 3f6cf00..c60a6df 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,8 @@ Docker Hub [registry](https://hub.docker.com/r/xianpengshen/clang-tools) -* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `14`, `13`, `12`(default), `11`, `10`, `9`, `8`) +* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `16`, `15`, `14`, `13`, `12`, `11`, `10`, `9`, `8`) +* [`16`](https://github.com/cpp-linter/clang-tools/blob/master/16/Dockerfile) * [`15`](https://github.com/cpp-linter/clang-tools/blob/master/15/Dockerfile) * [`14`](https://github.com/cpp-linter/clang-tools/blob/master/14/Dockerfile) * [`13`](https://github.com/cpp-linter/clang-tools/blob/master/13/Dockerfile) @@ -28,7 +29,7 @@ Docker Hub [registry](https://hub.docker.com/r/xianpengshen/clang-tools) GitHub Packages [registry](https://github.com/cpp-linter/clang-tools/pkgs/container/clang-tools) -* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `14`, `13`, `12`(default), `11`, `10`, `9`, `8`) +* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `16`, `15`, `14`, `13`, `12`, `11`, `10`, `9`, `8`) ## How to use this image diff --git a/all/Dockerfile b/all/Dockerfile index 537d73e..7e74842 100644 --- a/all/Dockerfile +++ b/all/Dockerfile @@ -1,46 +1,39 @@ FROM ubuntu:20.04 -ENV CLANG_VERSIONS="12 11 10 9 8" +LABEL org.cpp-linter.source="https://github.com/cpp-linter/clang-tools" +LABEL org.cpp-linter.maitainer="Peter Shen (xianpeng.shen@gmail.com)" -LABEL org.opencontainers.image.source="https://github.com/cpp-linter/clang-tools" +ENV CLANG_VERSIONS="12 11 10 9 8" -RUN apt-get update \ - && for CLANG_VERSION in "$CLANG_VERSIONS"; do \ +RUN set -ex \ + && apt-get update \ + && for CLANG_VERSION in $CLANG_VERSIONS; do \ apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ && rm -rf /var/lib/apt/lists/* -ENV CLANG_VERSIONS="14 13" - -# clang 13, 14 packages exist in jammy -COPY sources.list.jammy /etc/apt/sources.list - -RUN apt-get update \ - && for CLANG_VERSION in "$CLANG_VERSIONS"; do \ - apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ - && mv /etc/apt/sources.list.focal /etc/apt/sources.list \ - && rm -rf /var/lib/apt/lists/* - -ENV CLANG_VERSIONS="16 15" +ENV CLANG_VERSIONS="16 15 14 13" WORKDIR /tmp -RUN apt-get update \ +RUN set -ex \ + && apt-get update \ && apt-get --no-install-recommends -y install lsb-release wget software-properties-common gnupg \ && wget --quiet https://apt.llvm.org/llvm.sh \ && chmod +x llvm.sh \ - && for CLANG_VERSION in "$CLANG_VERSIONS"; do \ + && for CLANG_VERSION in $CLANG_VERSIONS; do \ ./llvm.sh $CLANG_VERSION \ - apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ + && apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \ && rm llvm.sh \ && rm -rf /var/lib/apt/lists/* -# Check versions +# Integrity testing ENV CLANG_VERSIONS="16 15 14 13 12 11 10 9 8" -RUN for VERSION in "$CLANG_VERSIONS"; do \ - clang-format-$VERSION --version \ - clang-tidy-$VERSION --version; done +RUN set -ex \ + && for VERSION in $CLANG_VERSIONS; do \ + clang-format-$VERSION --version \ + clang-tidy-$VERSION --version; done WORKDIR /src From cd774db42ba48211a12130d778be77c79df590c3 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 21 May 2023 04:15:58 +0000 Subject: [PATCH 5/5] fix: Update CI workflow --- .github/workflows/build-test-publish.yml | 2 +- .github/workflows/publish-image.yml | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index d4d4906..fd11bc8 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -32,7 +32,7 @@ jobs: echo "start to test ..." tag=`dirname $file` if [ $tag == "all" ]; then - clang_versions="14 13 12 11 10 9 8" + clang_versions="16 15 14 13 12 11 10 9 8" for clang_version in ${clang_versions}; do docker run clang-tools:$tag clang-format-$clang_version --version | grep -E "clang-format version $clang_version" docker run clang-tools:$tag clang-tidy-$clang_version --version | grep "LLVM version $clang_version" diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index caf037b..12319b4 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -1,7 +1,12 @@ -name: Publish image +name: Publish image to ghcr.io on: workflow_dispatch: + inputs: + tag: + description: 'which tag to publish' + default: 'all' + required: true jobs: publish: @@ -9,12 +14,12 @@ jobs: steps: - name: Download image run: | - docker pull xianpengshen/clang-tools:all - docker tag xianpengshen/clang-tools:all ghcr.io/cpp-linter/clang-tools:all + docker pull xianpengshen/clang-tools:${{ inputs.tag }} + docker tag xianpengshen/clang-tools:${{ inputs.tag }} ghcr.io/cpp-linter/clang-tools:${{ inputs.tag }} - name: Login container registry run: | echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin env: CR_PAT: ${{ secrets.CR_PAT }} - name: Push image to container registry - run: docker push ghcr.io/cpp-linter/clang-tools:all + run: docker push ghcr.io/cpp-linter/clang-tools:${{ inputs.tag }}