44 push :
55 branches : [ master ]
66 paths :
7- - ' ** Dockerfile'
7+ - ' Dockerfile* '
88 - ' docker-bake.hcl'
99 pull_request :
1010 branches : [ master ]
1111 paths :
12- - ' ** Dockerfile'
12+ - ' Dockerfile* '
1313 - ' docker-bake.hcl'
1414 workflow_dispatch :
1515
@@ -25,53 +25,39 @@ jobs:
2525 - name : Check formatting
2626 run : make install-deps && make lint
2727
28- - name : Get changed files
29- id : changed-files
30- uses : tj-actions/changed-files@v18.4
31-
3228 - name : Login container registries
3329 run : |
3430 echo $CR_PAT | docker login ghcr.io -u shenxianpeng --password-stdin
3531 docker login -u '${{ secrets.DOCKER_USERNAME }}' -p '${{ secrets.DOCKER_PASSWORD }}'
3632 env :
3733 CR_PAT : ${{ secrets.CR_PAT }}
3834
39- - name : Build & Test Images
40- run : |
41- for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
42- if [[ "$file" == *"Dockerfile" ]]; then
43- set -e
44- tag=`dirname $file`
45- echo "start to build clang-tools:$tag"
46- docker buildx bake --file docker-bake.hcl clang-tools-$tag
35+ - name : Check buildx bake
36+ run : docker buildx bake --file docker-bake.hcl --print
4737
48- echo "start to test clang-tools:$tag"
49- if [ $tag == "all" ]; then
50- clang_versions="16 15 14 13 12 11 10 9 8"
51- for clang_version in ${clang_versions}; do
52- docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
53- docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
54- done
55- elif [[ "$tag" == *"alpine"* ]]; then
56- docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-format --version | grep -E "clang-format version"
57- docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-tidy --version | grep "LLVM version"
58- else
59- docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
60- docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
61- fi
62- fi
63- done
38+ - name : Build all images
39+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
40+ run : docker buildx bake --file docker-bake.hcl
6441
65- - name : Publish Images
42+ - name : Test all images
6643 if : github.event_name == 'push' && github.ref == 'refs/heads/master'
6744 run : |
68- for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
69- if [[ "$file" == *"Dockerfile" ]]; then
70- tag=`dirname $file`
71- docker buildx bake --file docker-bake.hcl --push clang-tools-$tag
72- fi
45+ echo "start to test clang-tools:all"
46+ clang_versions="17 16 15 14 13 12 11 10 9"
47+ for clang_version in ${clang_versions}; do
48+ docker run ghcr.io/cpp-linter/clang-tools:all clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
49+ docker run ghcr.io/cpp-linter/clang-tools:all clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
50+ done
51+
52+ all_tags="17 16 15 14 13 12 11 10 9 8 7"
53+ for tag in ${all_tags}; do
54+ echo "start to test clang-tools:tag"
55+ docker run ghcr.io/cpp-linter/clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
56+ docker run ghcr.io/cpp-linter/clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
7357 done
58+ # docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-format --version | grep -E "clang-format version"
59+ # docker run ghcr.io/cpp-linter/clang-tools:$tag-3.18 clang-tidy --version | grep "LLVM version"
7460
75- - name : Publish All Images
61+ - name : Publish all images
7662 if : github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master'
77- run : docker buildx bake --file docker-bake.hcl --push clang-tools
63+ run : docker buildx bake --file docker-bake.hcl --push
0 commit comments