Skip to content

Commit 9f6356c

Browse files
authored
Support v16 (#37)
* feat: support clang v16 * feat: support clang v16 * save work * feat: add v16 15 to tag all image * fix: Update CI workflow
1 parent 70baa8e commit 9f6356c

File tree

6 files changed

+62
-28
lines changed

6 files changed

+62
-28
lines changed

.github/workflows/build-test-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
echo "start to test ..."
3333
tag=`dirname $file`
3434
if [ $tag == "all" ]; then
35-
clang_versions="14 13 12 11 10 9 8"
35+
clang_versions="16 15 14 13 12 11 10 9 8"
3636
for clang_version in ${clang_versions}; do
3737
docker run clang-tools:$tag clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
3838
docker run clang-tools:$tag clang-tidy-$clang_version --version | grep "LLVM version $clang_version"

.github/workflows/publish-image.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
name: Publish image
1+
name: Publish image to ghcr.io
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'which tag to publish'
8+
default: 'all'
9+
required: true
510

611
jobs:
712
publish:
813
runs-on: ubuntu-latest
914
steps:
1015
- name: Download image
1116
run: |
12-
docker pull xianpengshen/clang-tools:all
13-
docker tag xianpengshen/clang-tools:all ghcr.io/cpp-linter/clang-tools:all
17+
docker pull xianpengshen/clang-tools:${{ inputs.tag }}
18+
docker tag xianpengshen/clang-tools:${{ inputs.tag }} ghcr.io/cpp-linter/clang-tools:${{ inputs.tag }}
1419
- name: Login container registry
1520
run: |
1621
echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin
1722
env:
1823
CR_PAT: ${{ secrets.CR_PAT }}
1924
- name: Push image to container registry
20-
run: docker push ghcr.io/cpp-linter/clang-tools:all
25+
run: docker push ghcr.io/cpp-linter/clang-tools:${{ inputs.tag }}

.hadolint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
ignored:
22
- DL3008
33
- DL3018
4+
- SC2086

16/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ubuntu:22.04
2+
3+
ENV CLANG_VERSION 16
4+
5+
WORKDIR /src
6+
7+
RUN apt-get update \
8+
&& apt-get --no-install-recommends -y install lsb-release wget software-properties-common gnupg \
9+
&& wget --quiet https://apt.llvm.org/llvm.sh \
10+
&& chmod +x llvm.sh \
11+
&& ./llvm.sh $CLANG_VERSION && rm -rf llvm.sh \
12+
&& apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION \
13+
&& ln -s /usr/bin/clang-format-$CLANG_VERSION /usr/bin/clang-format \
14+
&& ln -s /usr/bin/clang-tidy-$CLANG_VERSION /usr/bin/clang-tidy \
15+
&& echo "--- Clang-format version ---" \
16+
&& clang-format --version \
17+
&& echo "--- Clang-tidy version ---" \
18+
&& clang-tidy --version \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
CMD [""]

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
Docker Hub [registry](https://hub.docker.com/r/xianpengshen/clang-tools)
1414

15-
* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `14`, `13`, `12`(default), `11`, `10`, `9`, `8`)
15+
* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `16`, `15`, `14`, `13`, `12`, `11`, `10`, `9`, `8`)
16+
* [`16`](https://github.com/cpp-linter/clang-tools/blob/master/16/Dockerfile)
1617
* [`15`](https://github.com/cpp-linter/clang-tools/blob/master/15/Dockerfile)
1718
* [`14`](https://github.com/cpp-linter/clang-tools/blob/master/14/Dockerfile)
1819
* [`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)
2829

2930
GitHub Packages [registry](https://github.com/cpp-linter/clang-tools/pkgs/container/clang-tools)
3031

31-
* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `14`, `13`, `12`(default), `11`, `10`, `9`, `8`)
32+
* [`all`](https://github.com/cpp-linter/clang-tools/blob/master/all/Dockerfile) (include tags `16`, `15`, `14`, `13`, `12`, `11`, `10`, `9`, `8`)
3233

3334
## How to use this image
3435

all/Dockerfile

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,39 @@
11
FROM ubuntu:20.04
22

3-
ARG DEFAULT_VERSION=12
3+
LABEL org.cpp-linter.source="https://github.com/cpp-linter/clang-tools"
4+
LABEL org.cpp-linter.maitainer="Peter Shen ([email protected])"
45

56
ENV CLANG_VERSIONS="12 11 10 9 8"
67

7-
LABEL org.opencontainers.image.source="https://github.com/cpp-linter/clang-tools"
8-
9-
RUN apt-get update \
10-
&& for CLANG_VERSION in ${CLANG_VERSIONS}; do \
8+
RUN set -ex \
9+
&& apt-get update \
10+
&& for CLANG_VERSION in $CLANG_VERSIONS; do \
1111
apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \
12-
&& rm -rf /var/lib/apt/lists/* \
13-
&& ln -s /usr/bin/clang-format-$DEFAULT_VERSION /usr/bin/clang-format \
14-
&& ln -s /usr/bin/clang-tidy-$DEFAULT_VERSION /usr/bin/clang-tidy \
15-
&& mv /etc/apt/sources.list /etc/apt/sources.list.focal
12+
&& rm -rf /var/lib/apt/lists/*
1613

17-
ENV CLANG_VERSIONS="14 13"
1814

19-
# clang 13, 14 packages exist in jammy
20-
COPY sources.list.jammy /etc/apt/sources.list
15+
ENV CLANG_VERSIONS="16 15 14 13"
2116

22-
RUN apt-get update \
23-
&& for CLANG_VERSION in ${CLANG_VERSIONS}; do \
24-
apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \
25-
&& mv /etc/apt/sources.list.focal /etc/apt/sources.list \
26-
&& rm -rf /var/lib/apt/lists/* \
27-
&& echo "--- Clang-format version ---" \
28-
&& clang-format --version \
29-
&& echo "--- Clang-tidy version ---" \
30-
&& clang-tidy --version
17+
WORKDIR /tmp
18+
19+
RUN set -ex \
20+
&& apt-get update \
21+
&& apt-get --no-install-recommends -y install lsb-release wget software-properties-common gnupg \
22+
&& wget --quiet https://apt.llvm.org/llvm.sh \
23+
&& chmod +x llvm.sh \
24+
&& for CLANG_VERSION in $CLANG_VERSIONS; do \
25+
./llvm.sh $CLANG_VERSION \
26+
&& apt-get --no-install-recommends -y install clang-format-$CLANG_VERSION clang-tidy-$CLANG_VERSION; done \
27+
&& rm llvm.sh \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
31+
# Integrity testing
32+
ENV CLANG_VERSIONS="16 15 14 13 12 11 10 9 8"
33+
RUN set -ex \
34+
&& for VERSION in $CLANG_VERSIONS; do \
35+
clang-format-$VERSION --version \
36+
clang-tidy-$VERSION --version; done
3137

3238
WORKDIR /src
3339

0 commit comments

Comments
 (0)