8
8
branches :
9
9
- main
10
10
paths :
11
- - .github/workflows/build-ci-container-code-format.yml
12
- - ' .github/workflows/containers/github-action-ci-code-format/**'
13
- - llvm/utils/git/code-format-helper.py
11
+ - .github/workflows/build-ci-container-tooling.yml
12
+ - ' .github/workflows/containers/github-action-ci-tooling/**'
14
13
- llvm/utils/git/requirements_formatting.txt
15
- - llvm/utils/git/requirements_formatting .txt.in
14
+ - llvm/utils/git/requirements_linting .txt
16
15
pull_request :
17
16
paths :
18
- - .github/workflows/build-ci-container-code-format.yml
19
- - ' .github/workflows/containers/github-action-ci-code-format/**'
20
- - llvm/utils/git/code-format-helper.py
17
+ - .github/workflows/build-ci-container-tooling.yml
18
+ - ' .github/workflows/containers/github-action-ci-tooling/**'
21
19
- llvm/utils/git/requirements_formatting.txt
22
- - llvm/utils/git/requirements_formatting .txt.in
20
+ - llvm/utils/git/requirements_linting .txt
23
21
24
22
jobs :
25
- build-ci-container-code-format :
23
+ build-ci-container-tooling :
26
24
if : github.repository_owner == 'llvm'
27
25
runs-on : depot-ubuntu-24.04-16
26
+ strategy :
27
+ matrix :
28
+ target : [ci-container-code-format, ci-container-code-lint]
29
+ include :
30
+ - target : ci-container-code-format
31
+ container_name : code-format
32
+ check_line : clang-format --version | grep version
33
+ - target : ci-container-code-lint
34
+ container_name : code-lint
35
+ check_line : clang-tidy --version | grep version
28
36
steps :
29
37
- name : Checkout LLVM
30
38
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
31
39
with :
32
40
sparse-checkout : |
33
- .github/workflows/containers/github-action-ci-code-format /
41
+ .github/workflows/containers/github-action-ci-tooling /
34
42
llvm/utils/git/requirements_formatting.txt
43
+ llvm/utils/git/requirements_linting.txt
44
+ clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py
35
45
36
46
- name : Write Variables
37
47
id : vars
38
48
run : |
39
49
tag=$(git rev-parse --short=12 HEAD)
40
- container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/amd64/ci-ubuntu-24.04-code-format "
50
+ container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/amd64/ci-ubuntu-24.04-${{ matrix.container_name }} "
41
51
echo "container-name=$container_name" >> $GITHUB_OUTPUT
42
52
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
43
53
echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
44
54
- name : Build container
45
55
run : |
46
- podman build --target ci-container-code-format \
47
- -f .github/workflows/containers/github-action-ci-code-format /Dockerfile \
56
+ podman build --target ${{ matrix.target }} \
57
+ -f .github/workflows/containers/github-action-ci-tooling /Dockerfile \
48
58
-t ${{ steps.vars.outputs.container-name-tag }} .
49
59
50
60
# Save the container so we have it in case the push fails. This also
@@ -57,21 +67,21 @@ jobs:
57
67
- name : Upload container image
58
68
uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
59
69
with :
60
- name : container-amd64
70
+ name : container-amd64-${{ matrix.container_name }}
61
71
path : " *.tar"
62
72
retention-days : 14
63
73
64
74
- name : Test Container
65
75
run : |
66
76
for image in ${{ steps.vars.outputs.container-name-tag }}; do
67
77
# Use --pull=never to ensure we are testing the just built image.
68
- podman run --pull=never --rm -it $image /usr/bin/bash -x -c 'cd $HOME && clang-format --version | grep version '
78
+ podman run --pull=never --rm -it $image /usr/bin/bash -x -c 'cd $HOME && ${{ matrix.check_line }} '
69
79
done
70
80
71
81
push-ci-container :
72
82
if : github.event_name == 'push'
73
83
needs :
74
- - build-ci-container-code-format
84
+ - build-ci-container-tooling
75
85
permissions :
76
86
packages : write
77
87
runs-on : ubuntu-24.04
0 commit comments