Skip to content

refactor: clang-tools Dockerfiles #64

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
Sep 24, 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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @shenxianpeng
62 changes: 24 additions & 38 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
push:
branches: [ master ]
paths:
- '**Dockerfile'
- 'Dockerfile*'
- 'docker-bake.hcl'
pull_request:
branches: [ master ]
paths:
- '**Dockerfile'
- 'Dockerfile*'
- 'docker-bake.hcl'
workflow_dispatch:

Expand All @@ -25,53 +25,39 @@ jobs:
- name: Check formatting
run: make install-deps && make lint

- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]

- name: Login container registries
run: |
echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin
docker login -u '${{ secrets.DOCKER_USERNAME }}' -p '${{ secrets.DOCKER_PASSWORD }}'
env:
CR_PAT: ${{ secrets.CR_PAT }}

- name: Build & Test Images
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ "$file" == *"Dockerfile" ]]; then
set -e
tag=`dirname $file`
echo "start to build clang-tools:$tag"
docker buildx bake --file docker-bake.hcl clang-tools-$tag
- name: Check buildx bake
run: docker buildx bake --file docker-bake.hcl --print

echo "start to test clang-tools:$tag"
if [ $tag == "all" ]; then
clang_versions="16 15 14 13 12 11 10 9 8"
for clang_version in ${clang_versions}; do
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
done
elif [[ "$tag" == *"alpine"* ]]; then
docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-format --version | grep -E "clang-format version"
docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-tidy --version | grep "LLVM version"
else
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
fi
fi
done
- name: Build all images
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: docker buildx bake --file docker-bake.hcl

- name: Publish Images
- name: Test all images
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ "$file" == *"Dockerfile" ]]; then
tag=`dirname $file`
docker buildx bake --file docker-bake.hcl --push clang-tools-$tag
fi
echo "start to test clang-tools:all"
clang_versions="17 16 15 14 13 12 11 10 9"
for clang_version in ${clang_versions}; do
docker run ghcr.io/cpp-linter/clang-tools:all clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
docker run ghcr.io/cpp-linter/clang-tools:all clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
done

all_tags="17 16 15 14 13 12 11 10 9 8 7"
for tag in ${all_tags}; do
echo "start to test clang-tools:tag"
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
done
# docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-format --version | grep -E "clang-format version"
# docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-tidy --version | grep "LLVM version"

- name: Publish All Images
- name: Publish all images
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'
run: docker buildx bake --file docker-bake.hcl --push clang-tools
run: docker buildx bake --file docker-bake.hcl --push
6 changes: 3 additions & 3 deletions .github/workflows/snyk-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:
push:
branches: [ master ]
paths:
- '**Dockerfile'
- 'Dockerfile*'
pull_request:
branches: [ master ]
paths:
- '**Dockerfile'
- 'Dockerfile*'

jobs:
snyk:
Expand All @@ -33,7 +33,7 @@ jobs:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: xianpengshen/clang-tools:all
args: --severity-threshold=high --file=all/Dockerfile
args: --severity-threshold=high --file=Dockerfile.all

- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v2
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repos:
- id: hadolint-docker
args:
[
--ignore,DL3006,
--ignore,DL3008,
--ignore,DL3018,
--ignore,SC2086,
Expand Down
26 changes: 0 additions & 26 deletions 10/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions 11/Dockerfile

This file was deleted.

23 changes: 0 additions & 23 deletions 12-alpine/Dockerfile

This file was deleted.

26 changes: 0 additions & 26 deletions 12/Dockerfile

This file was deleted.

31 changes: 0 additions & 31 deletions 13/Dockerfile

This file was deleted.

42 changes: 0 additions & 42 deletions 13/sources.list.jammy

This file was deleted.

31 changes: 0 additions & 31 deletions 14/Dockerfile

This file was deleted.

42 changes: 0 additions & 42 deletions 14/sources.list.jammy

This file was deleted.

Loading