22
22
jobs :
23
23
build-ci-container-tooling :
24
24
if : github.repository_owner == 'llvm'
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
25
+ runs-on : ubuntu-24.04
36
26
steps :
37
27
- name : Checkout LLVM
38
28
uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -47,36 +37,42 @@ jobs:
47
37
id : vars
48
38
run : |
49
39
tag=$(git rev-parse --short=12 HEAD)
50
- container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/amd64/ci-ubuntu-24.04-${{ matrix.container_name }}"
51
- echo "container-name=$container_name" >> $GITHUB_OUTPUT
52
- echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
53
- echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
40
+ container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/amd64/ci-ubuntu-24.04"
41
+ echo "container-name-format=$container_name-code-format" >> $GITHUB_OUTPUT
42
+ echo "container-name-lint=$container_name-code-lint" >> $GITHUB_OUTPUT
43
+ echo "container-name-format-tag=$container_name-format:$tag" >> $GITHUB_OUTPUT
44
+ echo "container-name-lint-tag=$container_name-lint:$tag" >> $GITHUB_OUTPUT
45
+ echo "container-format-filename=$(echo $container_name-format:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
46
+ echo "container-lint-filename=$(echo $container_name-lint:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
54
47
- name : Build container
55
48
run : |
56
- podman build --target ${{ matrix.target }} \
49
+ podman build --target ci-container-code-format \
50
+ -f .github/workflows/containers/github-action-ci-tooling/Dockerfile \
51
+ -t ${{ steps.vars.outputs.container-name-format-tag }} .
52
+ podman build --target ci-container-code-lint \
57
53
-f .github/workflows/containers/github-action-ci-tooling/Dockerfile \
58
- -t ${{ steps.vars.outputs.container-name-tag }} .
54
+ -t ${{ steps.vars.outputs.container-name-lint- tag }} .
59
55
60
56
# Save the container so we have it in case the push fails. This also
61
57
# allows us to separate the push step into a different job so we can
62
58
# maintain minimal permissions while building the container.
63
59
- name : Save container image
64
60
run : |
65
- podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
61
+ podman save ${{ steps.vars.outputs.container-name-format-tag }} > ${{ steps.vars.outputs.container-format-filename }}
62
+ podman save ${{ steps.vars.outputs.container-name-lint-tag }} > ${{ steps.vars.outputs.container-lint-filename }}
66
63
67
64
- name : Upload container image
68
65
uses : actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
69
66
with :
70
- name : container-amd64-${{ matrix.container_name }}
67
+ name : container-amd64
71
68
path : " *.tar"
72
69
retention-days : 14
73
70
74
71
- name : Test Container
75
72
run : |
76
- for image in ${{ steps.vars.outputs.container-name-tag }}; do
77
- # Use --pull=never to ensure we are testing the just built image.
78
- podman run --pull=never --rm -it $image /usr/bin/bash -x -c 'cd $HOME && ${{ matrix.check_line }}'
79
- done
73
+ # Use --pull=never to ensure we are testing the just built image.
74
+ podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-format-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-format --version | grep version && black --version | grep black'
75
+ podman run --pull=never --rm -it ${{ steps.vars.outputs.container-name-lint-tag }} /usr/bin/bash -x -c 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
80
76
81
77
push-ci-container :
82
78
if : github.event_name == 'push'
0 commit comments