[llvm] [workflows] Build a container for running CI on github actions (PR #75286)

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 22:36:12 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

<details>
<summary>Changes</summary>

Using a container will allow us to have similar testing environments on both the GitHub hosted runners and the self-hosted runners.

---
Full diff: https://github.com/llvm/llvm-project/pull/75286.diff


2 Files Affected:

- (added) .github/workflows/build-ci-container.yml (+51) 
- (added) .github/workflows/containers/github-action-ci/Dockerfile (+26) 


``````````diff
diff --git a/.github/workflows/build-ci-container.yml b/.github/workflows/build-ci-container.yml
new file mode 100644
index 00000000000000..9d2d18f7679734
--- /dev/null
+++ b/.github/workflows/build-ci-container.yml
@@ -0,0 +1,51 @@
+
+name: Build CI Container
+
+permissions:
+  contents: read
+
+on:
+  push:
+    branches:
+      - main
+    paths:
+      - .github/workflows/build-ci-container.yml
+      - '.github/workflows/containers/github-action-ci/**'
+  pull_request:
+    branches:
+      - main
+    paths:
+      - .github/workflows/build-ci-container.yml
+      - '.github/workflows/containers/github-action-ci/**'
+
+jobs:
+  build-ci-container:
+    if: github.repository_owner == 'llvm'
+    runs-on: ubuntu-latest
+    permissions:
+      packages: write
+    steps:
+      - name: Write Variables
+        id: vars
+        run: |
+          echo "container-name=ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04" >> $GITHUB_OUTPUT
+
+      - name: Checkout LLVM
+        uses: actions/checkout at v4
+
+      - name: Build Container
+        working-directory: ./.github/workflows/containers/github-action-ci/
+        run: |
+          # TODO: Ideally, we would give each container build a unique name,
+          # but we have limited space in the container registry, so we can't
+          # do this until we implement some kind of garbage collection for
+          # old containers.
+          podman build -t ${{ steps.vars.outputs.container-name }} .
+
+      - name: Push Container
+        if: github.event_name == 'push'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        run: |
+          podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
+          podman push ${{ steps.vars.outputs.container-name }}
diff --git a/.github/workflows/containers/github-action-ci/Dockerfile b/.github/workflows/containers/github-action-ci/Dockerfile
new file mode 100644
index 00000000000000..5bde8e5e6b6aa2
--- /dev/null
+++ b/.github/workflows/containers/github-action-ci/Dockerfile
@@ -0,0 +1,26 @@
+FROM docker.io/library/ubuntu:22.04
+
+# swig is needed for lldb docs.
+
+# abi-dumper, autoconf, and pkg-config are required for the abi-dump workflow.
+# abi-compliance-checker is needed for the abi-compare workflow.
+# python3-setuptools and python3-psutil are required for the release-lit task.
+# Need to install curl for hendrikmuhs/ccache-action
+# Need nodejs for some of the GitHub actions.
+RUN apt-get update && \
+    apt-get install -y \
+    abi-compliance-checker \
+    abi-dumper \
+    autoconf \
+    cmake \
+    curl \
+    doxygen \
+    graphviz \
+    nodejs \
+    ninja-build \
+    pkg-config \
+    python3-github \
+    python3-psutil \
+    python3-setuptools \
+    swig \
+    texlive-font-utils

``````````

</details>


https://github.com/llvm/llvm-project/pull/75286


More information about the llvm-commits mailing list