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 }} 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/16/Dockerfile b/16/Dockerfile new file mode 100644 index 0000000..3d5db4c --- /dev/null +++ b/16/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:22.04 + +ENV CLANG_VERSION 16 + +WORKDIR /src + +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 \ + && ./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 ---" \ + && clang-format --version \ + && echo "--- Clang-tidy version ---" \ + && clang-tidy --version \ + && rm -rf /var/lib/apt/lists/* + +CMD [""] 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 fecae10..7e74842 100644 --- a/all/Dockerfile +++ b/all/Dockerfile @@ -1,33 +1,39 @@ FROM ubuntu:20.04 -ARG DEFAULT_VERSION=12 +LABEL org.cpp-linter.source="https://github.com/cpp-linter/clang-tools" +LABEL org.cpp-linter.maitainer="Peter Shen (xianpeng.shen@gmail.com)" 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 \ +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/* \ - && 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" -# clang 13, 14 packages exist in jammy -COPY sources.list.jammy /etc/apt/sources.list +ENV CLANG_VERSIONS="16 15 14 13" -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/* \ - && echo "--- Clang-format version ---" \ - && clang-format --version \ - && echo "--- Clang-tidy version ---" \ - && clang-tidy --version +WORKDIR /tmp + +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 \ + ./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/* + + +# Integrity testing +ENV CLANG_VERSIONS="16 15 14 13 12 11 10 9 8" +RUN set -ex \ + && for VERSION in $CLANG_VERSIONS; do \ + clang-format-$VERSION --version \ + clang-tidy-$VERSION --version; done WORKDIR /src