[libcxx-commits] [libcxx] [llvm] test with libcxx workflow (PR #71836)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 14 07:43:59 PST 2023


https://github.com/EricWF updated https://github.com/llvm/llvm-project/pull/71836

>From 90b686df080d198ae8190fea16159c22072f60cd Mon Sep 17 00:00:00 2001
From: eric <eric at efcs.ca>
Date: Tue, 14 Nov 2023 09:51:59 -0500
Subject: [PATCH] Add workflows for libc++ to replace buildkite builders

---
 .../workflows/libcxx-example-workflow.yaml    | 157 ++++++++++++++++++
 libcxx/utils/ci/actions-runner/Dockerfile     | 147 ++++++++++++++++
 .../ci/actions-runner/docker-compose.yml      |   7 +
 libcxx/utils/ci/run-buildbot                  |   4 +-
 4 files changed, 313 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/libcxx-example-workflow.yaml
 create mode 100644 libcxx/utils/ci/actions-runner/Dockerfile
 create mode 100644 libcxx/utils/ci/actions-runner/docker-compose.yml

diff --git a/.github/workflows/libcxx-example-workflow.yaml b/.github/workflows/libcxx-example-workflow.yaml
new file mode 100644
index 000000000000000..c71fd312a4a54d8
--- /dev/null
+++ b/.github/workflows/libcxx-example-workflow.yaml
@@ -0,0 +1,157 @@
+name: Build and Test libc++
+
+on: pull_request
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+  cancel-in-progress: true
+
+permissions:
+  checks: write
+
+env:
+  CMAKE: "/opt/bin/cmake"
+
+# Comment
+jobs:
+  sanity:
+    runs-on: libcxx-runners-large
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      max-parallel: 4
+      matrix:
+        config: [ 'generic-cxx26']
+        cc: [ 'clang-18' ]
+        cxx: [ 'clang++-18' ]
+    steps:
+      - uses: actions/checkout at v4
+        with:
+          fetch-depth: 5
+      - name: ${{ matrix.config }}.${{ matrix.cxx }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: ${{ matrix.cc }}
+          CXX: ${{ matrix.cxx }}
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-${{ matrix.cxx }}-results
+          path: |
+            "**/test-results.xml"
+            "**/*.abilist"
+  gateway:
+    runs-on: libcxx-runners-large
+    needs: [ sanity ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      max-parallel: 4
+      matrix:
+        config: ['generic-cxx03', 'generic-modules']
+        cc: ['clang-18']
+        cxx: ['clang++-18']
+        include:
+          - config: 'generic-gcc'
+            cc: 'gcc-13'
+            cxx: 'g++-13'
+    steps:
+      - uses: actions/checkout at v4
+        with:
+          fetch-depth: 5
+      - name: ${{ matrix.config }}.${{ matrix.cxx }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: ${{ matrix.cc }}
+          CXX: ${{ matrix.cxx }}
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-${{ matrix.cxx }}-results
+          path: |
+            "**/test-results.xml"
+            "**/*.abilist"
+  legacy:
+      runs-on: libcxx-runners-large
+      continue-on-error: false
+      needs: [ gateway ]
+      strategy:
+        fail-fast: true
+        max-parallel: 4
+        matrix:
+          include:
+            - config: 'generic-gcc-cxx11'
+              cc: 'gcc-13'
+              cxx: 'g++-13'
+            - config: 'generic-cxx23'
+              cc: 'clang-16'
+              cxx: 'clang++-16'
+            - config: 'generic-cxx23'
+              cc: 'clang-17'
+              cxx: 'clang++-17'
+      steps:
+        - uses: actions/checkout at v4
+          with:
+            fetch-depth: 5
+        - name: ${{ matrix.config }}
+          run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+          env:
+            CC: ${{ matrix.cc }}
+            CXX: ${{ matrix.cxx }}
+        - uses: actions/upload-artifact at v3
+          if: always()
+          with:
+            name: ${{ matrix.config }}-results
+            path: |
+              "**/test-results.xml"
+              "**/*.abilist"
+  standards:
+    runs-on: libcxx-runners-large
+    needs: [ sanity, gateway ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      max-parallel: 4
+      matrix:
+        config: [ 'generic-cxx11', 'generic-cxx14', 'generic-cxx17',
+                  'generic-cxx20', 'generic-cxx23' ]
+    steps:
+      - uses: actions/checkout at v4
+        with:
+          fetch-depth: 5
+      - name: ${{ matrix.config }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: 'clang-18'
+          CXX: 'clang++-18'
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-results
+          path: |
+            "**/test-results.xml"
+            "**/*.abilist"
+  sanitizers:
+    runs-on: libcxx-runners-large
+    needs: [ sanity, legacy, standards ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      max-parallel: 4
+      matrix:
+        config: [ 'generic-asan', 'generic-msan', 'generic-tsan', 'generic-ubsan' ]
+    steps:
+      - uses: actions/checkout at v4
+        with:
+          fetch-depth: 5
+      - name: ${{ matrix.config }}
+        run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
+        env:
+          CC: clang-18
+          CXX: clang++-18
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-results
+          path: |
+            "**/test-results.xml"
+            "**/*.abilist"
diff --git a/libcxx/utils/ci/actions-runner/Dockerfile b/libcxx/utils/ci/actions-runner/Dockerfile
new file mode 100644
index 000000000000000..b2f38433cf415f8
--- /dev/null
+++ b/libcxx/utils/ci/actions-runner/Dockerfile
@@ -0,0 +1,147 @@
+#===----------------------------------------------------------------------===##
+#
+# 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
+#
+#===----------------------------------------------------------------------===##
+
+#
+# This Dockerfile describes the base image used to run the various libc++
+# build bots. By default, the image runs the Buildkite Agent, however one
+# can also just start the image with a shell to debug CI failures.
+#
+# To start a Buildkite Agent, run it as:
+#   $ docker run --env-file <secrets> -it $(docker build -q libcxx/utils/ci)
+#
+# The environment variables in `<secrets>` should be the ones necessary
+# to run a BuildKite agent:
+#
+#   BUILDKITE_AGENT_TOKEN=<token>
+#
+# If you're only looking to run the Docker image locally for debugging a
+# build bot, see the `run-buildbot-container` script located in this directory.
+#
+# A pre-built version of this image is maintained on DockerHub as ldionne/libcxx-builder.
+# To update the image, rebuild it and push it to ldionne/libcxx-builder (which
+# will obviously only work if you have permission to do so).
+#
+#   $ docker build -t ldionne/libcxx-builder libcxx/utils/ci
+#   $ docker push ldionne/libcxx-builder
+#
+
+FROM ghcr.io/actions/actions-runner:latest AS OTHER
+ENV GCC_LATEST_VERSION=13
+
+# Make sure apt-get doesn't try to prompt for stuff like our time zone, etc.
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN sudo apt-get update  \
+    && sudo apt-get install -y --no-install-recommends \
+        apt-transport-https \
+        apt-utils \
+        bash \
+        build-essential \
+        ca-certificates \
+        ccache \
+        cmake \
+        curl \
+        g++ \
+        gdb \
+        git \
+        gnupg \
+        language-pack-en \
+        language-pack-fr \
+        language-pack-ja \
+        language-pack-ru \
+        language-pack-zh-hans \
+        libedit-dev \
+        libncurses5-dev \
+        libpython3-dev \
+        libxml2-dev \
+        lsb-release \
+        ninja-build \
+        python3 \
+        python3-dev \
+        python3-distutils \
+        python3-psutil \
+        python3-venv \
+        software-properties-common \
+        swig3.0 \
+        uuid-dev \
+        uuid-runtime \
+        wget \
+    && sudo rm -rf /var/lib/apt/lists/*
+
+RUN sudo add-apt-repository ppa:ubuntu-toolchain-r/test \
+    && sudo apt-get update \
+    && sudo apt-get install -y \
+        gcc-$GCC_LATEST_VERSION \
+        g++-$GCC_LATEST_VERSION \
+        gcc-$((GCC_LATEST_VERSION - 1)) \
+        g++-$((GCC_LATEST_VERSION - 1)) \
+    && sudo rm -rf /var/lib/apt/lists/*
+
+# Install various tools used by the build or the test suite
+#RUN apt-get update && apt-get install -y ninja-build python3 python3-distutils python3-psutil git gdb ccache
+# TODO add ninja-build once 1.11 is available in Ubuntu, also remove the manual installation.
+
+RUN <<EOF
+ sudo wget -qO /usr/local/bin/ninja.gz https://github.com/ninja-build/ninja/releases/latest/download/ninja-linux.zip
+ sudo gunzip /usr/local/bin/ninja.gz
+ sudo chmod a+x /usr/local/bin/ninja
+EOF
+
+# These two are not enabled by default so generate them
+RUN <<EOF
+  sudo printf "fr_CA ISO-8859-1\ncs_CZ ISO-8859-2" >> /etc/locale.gen
+  sudo mkdir /usr/local/share/i1en/
+  sudo printf "fr_CA ISO-8859-1\ncs_CZ ISO-8859-2" >> /usr/local/share/i1en/SUPPORTED
+  sudo locale-gen
+EOF
+
+# Install Clang <latest>, <latest-1> and ToT, which are the ones we support.
+# We also install <latest-2> because we need to support the "latest-1" of the
+# current LLVM release branch, which is effectively the <latest-2> of the
+# tip-of-trunk LLVM. For example, after branching LLVM 14 but before branching
+# LLVM 15, we still need to have Clang 12 in this Docker image because the LLVM
+# 14 release branch CI uses it. The tip-of-trunk CI will never use Clang 12,
+# though.
+# LLVM POST-BRANCH bump version
+ENV LLVM_HEAD_VERSION=18
+
+RUN <<EOF
+  wget https://apt.llvm.org/llvm.sh -O /tmp/llvm.sh
+  sudo bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 3)) all # for CI transitions
+  sudo bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 2)) all # previous release
+  sudo bash /tmp/llvm.sh $(($LLVM_HEAD_VERSION - 1)) all # latest release
+  sudo bash /tmp/llvm.sh $LLVM_HEAD_VERSION          all # current ToT
+EOF
+
+# Install clang-scan-deps, which is required to build modules; always all supported versions.
+#RUN sudo apt-get update && sudo apt-get install -y clang-tools-$(($LLVM_HEAD_VERSION - 3)) \
+#                                         clang-tools-$(($LLVM_HEAD_VERSION - 2)) \
+#                                         clang-tools-$(($LLVM_HEAD_VERSION - 1)) \
+#                                         clang-tools-$LLVM_HEAD_VERSION \
+#     clang-format-$(($LLVM_HEAD_VERSION - 2)) clang-format-$(($LLVM_HEAD_VERSION - 1)) \
+#    clang-tidy-$(($LLVM_HEAD_VERSION - 2)) clang-tidy-$(($LLVM_HEAD_VERSION - 1)) clang-tidy-$LLVM_HEAD_VERSION \
+#    llvm-$(($LLVM_HEAD_VERSION - 2))-dev llvm-$(($LLVM_HEAD_VERSION - 1))-dev     llvm-$LLVM_HEAD_VERSION-dev \
+#                                     libclang-$(($LLVM_HEAD_VERSION - 2))-dev libclang-$(($LLVM_HEAD_VERSION - 1))-dev libclang-$LLVM_HEAD_VERSION-dev \
+#                                                                                                                       libomp5-$LLVM_HEAD_VERSION
+#
+# Install a newer CMake for modules
+# TODO Remove the duplicated installation when all runtimes can be build with CMake 3.28.
+RUN <<EOF
+  wget https://github.com/Kitware/CMake/releases/download/v3.21.1/cmake-3.21.1-linux-x86_64.sh -O /tmp/install-cmake.sh
+  sudo bash /tmp/install-cmake.sh --prefix=/usr --exclude-subdir --skip-license
+  rm /tmp/install-cmake.sh
+
+  wget https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.sh -O /tmp/install-cmake.sh
+  sudo bash /tmp/install-cmake.sh --prefix=/opt --exclude-subdir --skip-license
+  rm /tmp/install-cmake.sh
+
+  wget https://github.com/Kitware/CMake/releases/download/v3.28.0-rc4/cmake-3.28.0-rc4-linux-x86_64.sh -O /tmp/install-cmake.sh
+  sudo mkdir /opt/cmake-3.28
+  sudo bash /tmp/install-cmake.sh --prefix=/opt/cmake-3.28 --exclude-subdir --skip-license
+  rm /tmp/install-cmake.sh
+EOF
diff --git a/libcxx/utils/ci/actions-runner/docker-compose.yml b/libcxx/utils/ci/actions-runner/docker-compose.yml
new file mode 100644
index 000000000000000..824f77c6e73366d
--- /dev/null
+++ b/libcxx/utils/ci/actions-runner/docker-compose.yml
@@ -0,0 +1,7 @@
+version: '3.8'
+services:
+  libcxx-actions-runner:
+    build:
+      context: .
+      dockerfile: Dockerfile
+    image: ghcr.io/libcxx/libcxx-actions-runner:latest
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index fe99388a799be8a..d1b1e0f2e05fe47 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -137,7 +137,7 @@ function generate-cmake-base() {
           -DLIBUNWIND_ENABLE_WERROR=YES \
           -DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
           ${ENABLE_STD_MODULES} \
-          -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
+          -DLLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
           "${@}"
 }
 
@@ -372,7 +372,7 @@ bootstrapping-build)
           -DLLVM_TARGETS_TO_BUILD="host" \
           -DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
           -DLLVM_ENABLE_ASSERTIONS=ON \
-          -DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
+          -DLLVM_LIT_ARGS="-v --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
 
     echo "+++ Running the libc++ and libc++abi tests"
     ${NINJA} -vC "${BUILD_DIR}" check-runtimes



More information about the libcxx-commits mailing list