From 081a6bbe24002cca8f4f1cee3b51208992a0a556 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 17 May 2024 11:41:29 +0800 Subject: [PATCH] github: use fedora:40 image for testing instead of using ubuntu:jammy and setup-cpp action for prepearing the building toolchain, use fedora:40 container for building and testing. after switching to the github workflow based CI, we've been seeing test failures due to networking issue: ``` Failed to install llvm via system package manager Error: Command failed with exit code 35: curl -LJO https://apt.llvm.org/llvm.sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- 0:04:19 --:--:-- 0 curl: (35) OpenSSL SSL_connect: Broken pipe in connection to apt.llvm.org:443 ``` since fedora 40 comes with all the dependencies we need, let's build and test in a container with the fedora:40 image. with, hopefully the better CDN of the docker, and more reliable mirrors of fedora repositories, and the package retrievial machinary built into fedora's package management tools, we should have a more resilient CI. please note, in this change, we also * install git before checkout the repo. the reason is that, unlike the github-hosted runner, the fedora:40 image does not have `git` installed, so we have to install it manually before using "actions/checkout" action. * install clang-tools-extra when building with C++ modules enabled, because cmake and clang depend on clang-scan-deps to analyze the dependencies in betweener of C++20 modules. * use static library in "dev" build mode. this is to work around the issue where seastar allocator causes infinite recursive call if seastar is compiled as a shared library. this only happens when the tree is compiled with newer glibc. see also #2247 Signed-off-by: Kefu Chai --- .github/workflows/test.yaml | 55 +++++++++++++++++++++++------------- .github/workflows/tests.yaml | 7 ++--- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bf90f0696f1..ac7b638fedf 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -7,7 +7,6 @@ on: workflow_call: inputs: compiler: - # only the compilers supported by setup-cpp can be used description: 'the C++ compiler to use' type: string required: true @@ -33,7 +32,12 @@ on: jobs: test: runs-on: ubuntu-latest + container: fedora:40 steps: + - name: Install Git + run: | + sudo dnf -y install git + - uses: actions/checkout@v4 with: submodules: "${{ contains(inputs.enables, 'dpdk') }}" @@ -42,15 +46,19 @@ jobs: run: | sudo ./install-dependencies.sh - - name: Install ${{ inputs.compiler }} - uses: aminya/setup-cpp@master - with: - compiler: ${{ inputs.compiler }} - ccache: true - # ubuntu:latest comes with CMake 3.29, so we just need to install - # ninja. see - # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#tools - ninja: "${{ contains(inputs.enables, 'cxx-modules') }}" + - name: Install clang++ + if: ${{ inputs.compiler == 'clang++' }} + run: | + sudo dnf -y install clang + + - name: Install clang-scan-deps + if: ${{ contains(inputs.enables, 'cxx-modules') }} + run: | + sudo dnf -y install clang-tools-extra + + - name: Install ccache + run: | + sudo dnf -y install ccache - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 @@ -58,15 +66,24 @@ jobs: key: ${{ inputs.compiler }}-${{ inputs.standard }}-${{ inputs.mode }}-${{ inputs.enables }} - name: Configure - run: > - ./configure.py - --ccache - --c++-standard ${{ inputs.standard }} - --compiler $CXX - --c-compiler $CC - --mode ${{ inputs.mode }} - ${{ inputs.options }} - ${{ inputs.enables }} ; + run: | + if [ ${{ inputs.compiler }} = "clang++" ]; then + CC=clang + else + CC=gcc + fi + ./configure.py \ + --ccache \ + --c++-standard ${{ inputs.standard }} \ + --compiler ${{ inputs.compiler }} \ + --c-compiler $CC \ + --mode ${{ inputs.mode }} \ + ${{ inputs.options }} \ + ${{ inputs.enables }} + # this works around https://github.com/scylladb/seastar/issues/2247 + if [ ${{ inputs.mode }} = "dev" ]; then + sed -E -i 's|(BUILD_SHARED_LIBS:BOOL=)yes|\1no|' build/dev/CMakeCache.txt + fi; - name: Build run: cmake --build build/${{inputs.mode}} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index aafba28a9d7..5debb533902 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,8 +16,7 @@ jobs: strategy: fail-fast: false matrix: - # only the compilers supported by setup-cpp - compiler: [clang++-18, gcc-13] + compiler: [clang++, g++] standard: [20, 23] mode: [dev, debug, release] with: @@ -32,7 +31,7 @@ jobs: strategy: fail-fast: false with: - compiler: clang++-18 + compiler: clang++ standard: 23 mode: release enables: --enable-dpdk @@ -43,7 +42,7 @@ jobs: strategy: fail-fast: false with: - compiler: clang++-18 + compiler: clang++ standard: 23 mode: debug enables: --enable-cxx-modules