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

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 09:22:12 PST 2023


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

>From 4f4be4babc3c8e1303f63e103bd0b3a64667032f 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

---
 .github/workflows/libcxx-build-and-test.yaml  | 135 ++++++++++++++++
 libcxx/utils/ci/actions-runner/Dockerfile     | 147 ++++++++++++++++++
 .../ci/actions-runner/docker-compose.yml      |   7 +
 libcxx/utils/ci/run-buildbot                  |   4 +-
 4 files changed, 291 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/libcxx-build-and-test.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-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml
new file mode 100644
index 000000000000000..f5d813d0c22a14b
--- /dev/null
+++ b/.github/workflows/libcxx-build-and-test.yaml
@@ -0,0 +1,135 @@
+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:
+  stage1:
+    runs-on: libcxx-runners-16
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      matrix:
+        config: [ 'generic-cxx26', '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"
+  stage2:
+    runs-on: libcxx-runners-16
+    needs: [ stage1  ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      max-parallel: 4
+      matrix:
+        config: [ 'generic-cxx11', 'generic-cxx14', 'generic-cxx17',
+                  'generic-cxx20', 'generic-cxx23' ]
+        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: 'clang-18'
+          CXX: 'clang++-18'
+      - uses: actions/upload-artifact at v3
+        if: always()
+        with:
+          name: ${{ matrix.config }}-results
+          path: |
+            "**/test-results.xml"
+            "**/*.abilist"
+  stage3-sanitizers:
+    runs-on: libcxx-runners-16
+    needs: [ stage1, stage2 ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      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"
+  stage3-remainder:
+    runs-on: libcxx-runners-8
+    needs: [ stage1, stage2 ]
+    continue-on-error: false
+    strategy:
+      fail-fast: true
+      max-parallel: 8
+      matrix:
+        config: [ 'generic-no-threads', 'generic-no-filesystem', 'generic-no-random_device',
+                 'generic-no-localization', 'generic-no-unicode', 'generic-no-wide-characters',
+                 'generic-no-experimental', 'generic-no-exceptions',
+                 'generic-abi-unstable',  'generic-hardening-mode-fast',
+                 'generic-hardening-mode-fast-with-abi-breaks', 'generic-hardening-mode-extensive',
+                'generic-hardening-mode-debug']
+    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 llvm-commits mailing list