Skip to content

Support v16 #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 9 additions & 4 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
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:
runs-on: ubuntu-latest
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 }}
1 change: 1 addition & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ignored:
- DL3008
- DL3018
- SC2086
21 changes: 21 additions & 0 deletions 16/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 [""]
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
48 changes: 27 additions & 21 deletions all/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 ([email protected])"

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

Expand Down