Skip to content

Commit feeb863

Browse files
committed
resolve PR comments
1 parent dcaf7ba commit feeb863

File tree

2 files changed

+31
-49
lines changed

2 files changed

+31
-49
lines changed

.github/workflows/build-ci-container-tooling.yml

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,7 @@ on:
2222
jobs:
2323
build-ci-container-tooling:
2424
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
3626
steps:
3727
- name: Checkout LLVM
3828
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -47,36 +37,42 @@ jobs:
4737
id: vars
4838
run: |
4939
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
5447
- name: Build container
5548
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 \
5753
-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 }} .
5955
6056
# Save the container so we have it in case the push fails. This also
6157
# allows us to separate the push step into a different job so we can
6258
# maintain minimal permissions while building the container.
6359
- name: Save container image
6460
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 }}
6663
6764
- name: Upload container image
6865
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
6966
with:
70-
name: container-amd64-${{ matrix.container_name }}
67+
name: container-amd64
7168
path: "*.tar"
7269
retention-days: 14
7370

7471
- name: Test Container
7572
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'
8076
8177
push-ci-container:
8278
if: github.event_name == 'push'
Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
FROM docker.io/library/ubuntu:24.04 AS llvm-downloader
1+
ARG LLVM_VERSION=21.1.0
22

3-
ENV LLVM_VERSION=21.1.1
3+
FROM ubuntu:24.04 AS llvm-downloader
4+
ARG LLVM_VERSION
45

56
RUN apt-get update && \
67
apt-get install -y wget xz-utils && \
@@ -11,9 +12,7 @@ RUN apt-get update && \
1112

1213

1314
FROM docker.io/library/ubuntu:24.04 AS base
14-
1515
ENV LLVM_SYSROOT=/opt/llvm
16-
ENV LLVM_VERSION=21.1.1
1716

1817
# Need nodejs for some of the GitHub actions.
1918
# Need git for git-clang-format.
@@ -23,50 +22,37 @@ RUN apt-get update && \
2322
nodejs \
2423
sudo \
2524
# These are needed by the premerge pipeline.
26-
# Pip and venv are used to install dependent python packages.
25+
# Pip is used to install dependent python packages.
2726
python3-pip \
28-
python3-venv \
2927
python-is-python3 && \
3028
apt-get clean && \
3129
rm -rf /var/lib/apt/lists/*
3230

33-
34-
# Create a new user to avoid test failures related to a lack of expected
35-
# permissions issues in some tests. Set the user id to 1001 as that is the
36-
# user id that Github Actions uses to perform the checkout action.
37-
RUN useradd gha -u 1001 -m -s /bin/bash
38-
39-
# Also add the user to passwordless sudoers so that we can install software
40-
# later on without having to rebuild the container.
41-
RUN adduser gha sudo
42-
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
43-
44-
USER gha
4531
WORKDIR /home/gha
4632

4733

4834
FROM base AS ci-container-code-format
35+
ARG LLVM_VERSION
4936

5037
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-format ${LLVM_SYSROOT}/bin/clang-format
5138

5239
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
5340

5441
# Install dependencies for 'pr-code-format.yml' job
55-
COPY llvm/utils/git/requirements_formatting.txt /home/gha/requirements_formatting.txt
56-
RUN python -m venv venv && \
57-
venv/bin/pip install -r /home/gha/requirements_formatting.txt && \
58-
rm /home/gha/requirements_formatting.txt
42+
COPY llvm/utils/git/requirements_formatting.txt requirements_formatting.txt
43+
RUN pip install -r requirements_formatting.txt -break-system-packages && \
44+
rm requirements_formatting.txt
5945

6046

6147
FROM base AS ci-container-code-lint
48+
ARG LLVM_VERSION
6249

6350
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy ${LLVM_SYSROOT}/bin/
6451
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
6552

6653
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}
6754

6855
# Install dependencies for 'pr-code-lint.yml' job
69-
COPY llvm/utils/git/requirements_linting.txt /home/gha/requirements_linting.txt
70-
RUN python -m venv venv && \
71-
venv/bin/pip install -r /home/gha/requirements_linting.txt && \
72-
rm /home/gha/requirements_linting.txt
56+
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
57+
RUN pip install -r requirements_linting.txt --break-system-packages && \
58+
rm requirements_linting.txt

0 commit comments

Comments
 (0)