From f6bdb17fd99edfdb15dda64d772ec55b34cce160 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 12 Sep 2021 18:28:02 +0300 Subject: [PATCH] Updated GitHub Actions config for better configurability. Reworked extra package installation and added explicit specification of external package sources. Moved some common constants to environment variables. Removed installation of unneeded packages in the containers. --- .github/workflows/ci.yml | 205 +++++++++++++++++++++++++++++++-------- 1 file changed, 162 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a188bf..04e03fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,8 @@ concurrency: env: GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + DEFAULT_BUILD_VARIANT: debug,release jobs: posix: @@ -31,150 +33,202 @@ jobs: fail-fast: false matrix: include: + # Linux, gcc - toolset: gcc-4.4 cxxstd: "98,0x" os: ubuntu-20.04 container: ubuntu:16.04 - install: g++-4.4 + install: + - g++-4.4 + sources: + - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.6 cxxstd: "03,0x" os: ubuntu-20.04 container: ubuntu:16.04 - install: g++-4.6 + install: + - g++-4.6 + sources: + - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.7 cxxstd: "03,11" os: ubuntu-20.04 container: ubuntu:16.04 - install: g++-4.7 + install: + - g++-4.7 - toolset: gcc-4.8 cxxstd: "03,11" os: ubuntu-18.04 - install: g++-4.8 + install: + - g++-4.8 - toolset: gcc-4.9 cxxstd: "03,11" os: ubuntu-20.04 container: ubuntu:16.04 - install: g++-4.9 + install: + - g++-4.9 - toolset: gcc-5 cxxstd: "03,11,14,1z" os: ubuntu-20.04 container: ubuntu:16.04 + install: + - g++-5 - toolset: gcc-6 cxxstd: "03,11,14,1z" os: ubuntu-18.04 - install: g++-6 + install: + - g++-6 - toolset: gcc-7 cxxstd: "03,11,14,17" os: ubuntu-18.04 + install: + - g++-7 - toolset: gcc-8 cxxstd: "03,11,14,17,2a" os: ubuntu-18.04 - install: g++-8 + install: + - g++-8 - toolset: gcc-9 cxxstd: "03,11,14,17,2a" os: ubuntu-18.04 + install: + - g++-9 - toolset: gcc-10 cxxstd: "03,11,14,17,20" os: ubuntu-20.04 + install: + - g++-10 - toolset: gcc-11 cxxstd: "03,11,14,17,20" os: ubuntu-20.04 - install: g++-11 + install: + - g++-11 + sources: + - "ppa:ubuntu-toolchain-r/test" - name: UBSAN toolset: gcc-11 cxxstd: "03,11,14,17,20" ubsan: 1 os: ubuntu-20.04 - install: g++-11 + install: + - g++-11 + sources: + - "ppa:ubuntu-toolchain-r/test" + # Linux, clang - toolset: clang compiler: clang++-3.5 cxxstd: "03,11" os: ubuntu-20.04 container: ubuntu:16.04 - install: clang-3.5 + install: + - clang-3.5 - toolset: clang compiler: clang++-3.6 cxxstd: "03,11,14" os: ubuntu-20.04 container: ubuntu:16.04 - install: clang-3.6 + install: + - clang-3.6 - toolset: clang compiler: clang++-3.7 cxxstd: "03,11,14" os: ubuntu-20.04 container: ubuntu:16.04 - install: clang-3.7 + install: + - clang-3.7 - toolset: clang compiler: clang++-3.8 cxxstd: "03,11,14" os: ubuntu-20.04 container: ubuntu:16.04 - install: clang-3.8 + install: + - clang-3.8 - toolset: clang compiler: clang++-3.9 cxxstd: "03,11,14" os: ubuntu-18.04 - install: clang-3.9 + install: + - clang-3.9 - toolset: clang compiler: clang++-4.0 cxxstd: "03,11,14" os: ubuntu-18.04 - install: clang-4.0 + install: + - clang-4.0 - toolset: clang compiler: clang++-5.0 cxxstd: "03,11,14,1z" os: ubuntu-18.04 - install: clang-5.0 + install: + - clang-5.0 - toolset: clang compiler: clang++-6.0 cxxstd: "03,11,14,17" os: ubuntu-18.04 - install: clang-6.0 + install: + - clang-6.0 - toolset: clang compiler: clang++-7 cxxstd: "03,11,14,17" os: ubuntu-18.04 - install: clang-7 + install: + - clang-7 + # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode - toolset: clang compiler: clang++-8 cxxstd: "03,11,14,17,2a" os: ubuntu-18.04 - install: clang-8 + install: + - clang-8 + - g++-7 gcc_toolchain: 7 - toolset: clang compiler: clang++-9 cxxstd: "03,11,14,17,2a" os: ubuntu-20.04 - install: clang-9 + install: + - clang-9 - toolset: clang compiler: clang++-10 cxxstd: "03,11,14,17,20" os: ubuntu-20.04 + install: + - clang-10 - toolset: clang compiler: clang++-11 cxxstd: "03,11,14,17,20" os: ubuntu-20.04 + install: + - clang-11 - toolset: clang compiler: clang++-12 cxxstd: "03,11,14,17,20" os: ubuntu-20.04 + install: + - clang-12 - toolset: clang compiler: clang++-12 cxxstd: "03,11,14,17,20" - os: ubuntu-20.04 - install: libc++-12-dev libc++abi-12-dev cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ + os: ubuntu-20.04 + install: + - clang-12 + - libc++-12-dev + - libc++abi-12-dev - name: UBSAN toolset: clang compiler: clang++-12 cxxstd: "03,11,14,17,20" - ubsan: 1 - os: ubuntu-20.04 - install: libc++-12-dev libc++abi-12-dev cxxflags: -stdlib=libc++ linkflags: -stdlib=libc++ + ubsan: 1 + os: ubuntu-20.04 + install: + - clang-12 + - libc++-12-dev + - libc++abi-12-dev - toolset: clang cxxstd: "03,11,14,17,2a" @@ -188,20 +242,77 @@ jobs: container: ${{matrix.container}} steps: - - name: Setup container - if: matrix.container + - name: Setup environment run: | - echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV - apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 install -y sudo software-properties-common tzdata wget curl apt-transport-https make apt-file unzip libssl-dev build-essential autotools-dev autoconf automake g++ libc++-helpers python ruby cpio gcc-multilib g++-multilib pkgconf python3 ccache libpython-dev git cmake + if [ -f "/etc/debian_version" ] + then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] + then + echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV + if [ -f "/etc/debian_version" ] + then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ python python3 git cmake + fi + fi + git config --global pack.threads 0 - uses: actions/checkout@v2 - name: Install packages if: matrix.install run: | - for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done - sudo apt-get update - sudo apt-get install -y ${{matrix.install}} + SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) + SOURCES=(${{join(matrix.sources, ' ')}}) + for key in "${SOURCE_KEYS[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + wget -O - "$key" | sudo apt-key add - && break || sleep 2 + done + done + if [ ${#SOURCES[@]} -gt 0 ] + then + APT_ADD_REPO_COMMON_ARGS=("-y") + APT_ADD_REPO_HAS_SOURCE_ARGS=0 + SOFTWARE_PROPERTIES_VERSION="$(dpkg-query --showformat='${Version}' --show software-properties-common)" + if dpkg --compare-versions "$SOFTWARE_PROPERTIES_VERSION" ge "0.96.24.20" + then + APT_ADD_REPO_COMMON_ARGS+=("-n") + fi + if dpkg --compare-versions "$SOFTWARE_PROPERTIES_VERSION" ge "0.98.10" + then + APT_ADD_REPO_HAS_SOURCE_ARGS=1 + fi + for source in "${SOURCES[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") + if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] + then + case "$source" in + "ppa:"*) + APT_ADD_REPO_ARGS+=("-P") + ;; + "deb "*) + APT_ADD_REPO_ARGS+=("-S") + ;; + *) + APT_ADD_REPO_ARGS+=("-U") + ;; + esac + fi + APT_ADD_REPO_ARGS+=("$source") + sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 + done + done + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} - name: Setup GCC Toolchain if: matrix.gcc_toolchain @@ -249,24 +360,32 @@ jobs: fi DEPINST_ARGS+=("$LIBRARY") python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" - ./bootstrap.sh - ./b2 headers - - - name: Create user-config.jam - if: matrix.cmake_tests == '' && matrix.compiler != '' - run: | - echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam - if [ -n "$GCC_TOOLCHAIN_ROOT" ] + if [ -z "${{matrix.cmake_tests}}" ] then - echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi fi - echo " ;" >> ~/user-config.jam - name: Run tests if: matrix.cmake_tests == '' run: | cd ../boost-root - B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "variant=debug,release") + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}") + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi if [ -n "${{matrix.threading}}" ] then B2_ARGS+=("threading=${{matrix.threading}}")