[libcxx-commits] [llvm] [libcxx] Add libcxx runners lite image for small github action tasks (PR #75278)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 12 19:36:43 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Eric (EricWF)

<details>
<summary>Changes</summary>



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


4 Files Affected:

- (added) .github/workflows/libcxx-runners-test.yaml (+33) 
- (added) libcxx/utils/ci/Dockerfile.runner-lite (+72) 
- (added) libcxx/utils/ci/ci-requirements.in (+14) 
- (modified) libcxx/utils/ci/docker-compose.yml (+7) 


``````````diff
diff --git a/.github/workflows/libcxx-runners-test.yaml b/.github/workflows/libcxx-runners-test.yaml
new file mode 100644
index 00000000000000..1a96e7284c10a6
--- /dev/null
+++ b/.github/workflows/libcxx-runners-test.yaml
@@ -0,0 +1,33 @@
+
+name: Libc++ Task Runners Test
+on:
+  pull_request:
+    paths:
+      - 'libcxx/**'
+      - 'libcxxabi/**'
+      - 'libunwind/**'
+      - 'runtimes/**'
+      - 'cmake/**'
+      - '.github/workflows/libcxx-runners-test.yaml'
+
+permissions:
+  contents: read # Default everything to read-only
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+  cancel-in-progress: true
+
+jobs:
+  stage1:
+    if: github.repository_owner == 'llvm'
+    runs-on: libcxx-runners-1-set
+    steps:
+      - name: Breathing
+        run: echo hello
+      - name: Test Python
+        run: python3 -c "import sys; print(sys.version)"
+      - name: Test Checkout
+        uses: actions/checkout at v4
+      - name: End Step
+        if: always()
+        run: echo "End Step"
diff --git a/libcxx/utils/ci/Dockerfile.runner-lite b/libcxx/utils/ci/Dockerfile.runner-lite
new file mode 100644
index 00000000000000..3a56930f9c4dfd
--- /dev/null
+++ b/libcxx/utils/ci/Dockerfile.runner-lite
@@ -0,0 +1,72 @@
+#===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+#===----------------------------------------------------------------------===##
+
+# HACK: We set the base image in the docker-compose file depending on the final target (buildkite vs github actions).
+# This means we have a much slower container build, but we can use the same Dockerfile for both targets.
+ARG BASE_IMAGE
+FROM $BASE_IMAGE AS runner-lite
+
+# Make sure apt-get doesn't try to prompt for stuff like our time zone, etc.
+ENV DEBIAN_FRONTEND=noninteractive
+
+# HACK: The github actions runner image already has sudo and requires its use. The buildkite base image does not.
+# Reconcile this.
+RUN <<EOF
+  apt-get update || true
+  apt-get install -y sudo || true
+  echo "ALL ALL = (ALL) NOPASSWD: ALL" | tee /etc/sudoers || true
+EOF
+
+RUN sudo apt-get update \
+    && sudo apt-get install -y \
+        python3 \
+        python3-distutils \
+        python3-psutil \
+        python3-venv \
+        python3-pip \
+        git \
+        gpg \
+        wget \
+        bash \
+        curl \
+        python3 \
+        python3-dev \
+        libpython3-dev \
+        uuid-dev \
+        libncurses5-dev \
+        lsb-release \
+        wget \
+        unzip \
+        software-properties-common \
+    && sudo rm -rf /var/lib/apt/lists/*
+
+
+ENV PATH="/home/runner/.local/bin:${PATH}"
+COPY ci-requirements.in /tmp/ci-requirements.in
+
+RUN python3 -m pip install --upgrade pip && python3 -m pip install pip-tools
+
+# Compile down the requirements.in file into an exact requirements.txt file. Use that to install the packages.
+RUN pip-compile /tmp/ci-requirements.in --output-file /tmp/ci-requirements.txt && \
+    python3 -m pip install -r /tmp/ci-requirements.txt
+
+# Create a default virtual environment for the runner user.
+RUN cd /home/runner && python3 -m venv ./pyenv && \
+    echo "source /home/runner/pyenv/bin/activate" >> /home/runner/.bashrc && \
+    . ./pyenv/bin/activate && \
+    python3 -m pip install -r /tmp/ci-requirements.txt \
+
+# Install 'act' for running github actions locally. This provides an alternative to the run-buildbot script
+# while still providing reproducability.
+RUN curl -s https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
+
+WORKDIR /home/runner
+USER runner
+
+
+
diff --git a/libcxx/utils/ci/ci-requirements.in b/libcxx/utils/ci/ci-requirements.in
new file mode 100644
index 00000000000000..e1d77c90f172db
--- /dev/null
+++ b/libcxx/utils/ci/ci-requirements.in
@@ -0,0 +1,14 @@
+beartype
+flask
+google-api-python-client
+matplotlib
+networkx
+pandas
+peewee
+psutil
+psycopg2-binary
+pydantic>=2.0.0
+Pygithub
+requests
+rich
+tqdm
diff --git a/libcxx/utils/ci/docker-compose.yml b/libcxx/utils/ci/docker-compose.yml
index 26b341ced41550..23d32a584832c8 100644
--- a/libcxx/utils/ci/docker-compose.yml
+++ b/libcxx/utils/ci/docker-compose.yml
@@ -23,6 +23,13 @@ services:
       args:
         BASE_IMAGE: ghcr.io/actions/actions-runner:2.311.0
         <<: *compiler_versions
+  actions-runner-lite:
+    image: ghcr.io/libcxx/actions-runner-lite:${TAG:-latest}
+    build:
+      context: .
+      dockerfile: Dockerfile.runner-lite
+      args:
+        BASE_IMAGE: ghcr.io/actions/actions-runner:2.311.0
   android-buildkite-builder:
     image: ghcr.io/libcxx/android-buildkite-builder:${TAG:-latest}
     build:

``````````

</details>


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


More information about the libcxx-commits mailing list