From 2123e5cc3576e9100084deb443db851fa26a284c Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 5 Sep 2021 21:00:10 +0300 Subject: [PATCH] Added GitHub Actions config file. --- .github/workflows/ci.yml | 303 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..774b9de --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,303 @@ +# Copyright 2021 Andrey Semashev +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + +name: CI + +on: + pull_request: + push: + branches: + - master + - develop + - feature/** + +concurrency: + group: ${{format('{0}:{1}', github.repository, github.ref)}} + cancel-in-progress: true + +env: + GIT_FETCH_JOBS: 8 + +defaults: + run: + shell: bash + +jobs: + posix: + strategy: + fail-fast: false + matrix: + include: + - toolset: gcc-4.4 + cxxstd: "98,0x" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: g++-4.4 + - toolset: gcc-4.6 + cxxstd: "03,0x" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: g++-4.6 + - toolset: gcc-4.7 + cxxstd: "03,11" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: g++-4.7 + - toolset: gcc-4.8 + cxxstd: "03,11" + os: ubuntu-18.04 + install: g++-4.8 + - toolset: gcc-4.9 + cxxstd: "03,11" + os: ubuntu-20.04 + container: ubuntu:16.04 + install: g++-4.9 + extra_tests: 1 + - toolset: gcc-5 + cxxstd: "03,11,14,1z" + os: ubuntu-20.04 + container: ubuntu:16.04 + - toolset: gcc-6 + cxxstd: "03,11,14,1z" + os: ubuntu-18.04 + install: g++-6 + - toolset: gcc-7 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + - toolset: gcc-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + install: g++-8 + - toolset: gcc-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + - toolset: gcc-10 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + - toolset: gcc-11 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + install: g++-11 + - name: UBSAN + toolset: gcc-11 + cxxstd: "03,11,14,17,20" + ubsan: 1 + os: ubuntu-20.04 + install: g++-11 + + - toolset: clang + compiler: clang++-3.5 + cxxstd: "03,11" + os: ubuntu-20.04 + container: ubuntu:16.04 + 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 + - toolset: clang + compiler: clang++-3.7 + cxxstd: "03,11,14" + os: ubuntu-20.04 + container: ubuntu:16.04 + 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 + - toolset: clang + compiler: clang++-3.9 + cxxstd: "03,11,14" + os: ubuntu-18.04 + install: clang-3.9 + - toolset: clang + compiler: clang++-4.0 + cxxstd: "03,11,14" + os: ubuntu-18.04 + install: clang-4.0 + - toolset: clang + compiler: clang++-5.0 + cxxstd: "03,11,14,1z" + os: ubuntu-18.04 + install: clang-5.0 + - toolset: clang + compiler: clang++-6.0 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + install: clang-6.0 + - toolset: clang + compiler: clang++-7 + cxxstd: "03,11,14,17" + os: ubuntu-18.04 + install: clang-7 + - toolset: clang + compiler: clang++-8 + cxxstd: "03,11,14,17,2a" + os: ubuntu-18.04 + install: clang-8 + gcc_toolchain: 7 + - toolset: clang + compiler: clang++-9 + cxxstd: "03,11,14,17,2a" + os: ubuntu-20.04 + install: clang-9 + - toolset: clang + compiler: clang++-10 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + - toolset: clang + compiler: clang++-11 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + - toolset: clang + compiler: clang++-12 + cxxstd: "03,11,14,17,20" + os: ubuntu-20.04 + - 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++ + - 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++ + + - toolset: clang + cxxstd: "03,11,14,17,2a" + os: macos-10.15 + + - name: CMake self-test + cmake_test: 1 + os: ubuntu-20.04 + + runs-on: ${{ matrix.os }} + container: ${{ matrix.container }} + + steps: + - name: Setup container + if: matrix.container + 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 + + - 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}} + + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" + + - name: Setup Boost + run: | + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + DEPINST_ARGS=() + GIT_VERSION="$(git --version | sed -e 's/git version //')" + if $(dpkg --compare-versions "$GIT_VERSION" ge 2.8.0) + then + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + fi + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + if [ -n "${{matrix.extra_tests}}" ] + then + DEPINST_ARGS+=("--include" "example") + fi + DEPINST_ARGS+=("$LIBRARY") + python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + ./bootstrap.sh + ./b2 headers + + - name: Run CMake tests + if: matrix.cmake_test + run: | + cd ../boost-root + mkdir __build_static__ && cd __build_static__ + cmake ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + cd .. + mkdir __build_shared__ && cd __build_shared__ + cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake + cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS + + - name: Create user-config.jam + if: matrix.cmake_test == '' && matrix.compiler != '' + run: | + 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 + + - name: Run tests + if: matrix.cmake_test == '' + run: | + cd ../boost-root + if [ -n "${{matrix.extra_tests}}" ] + then + export BOOST_FILESYSTEM_TEST_WITH_EXAMPLES=1 + fi + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}") + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="print_stacktrace=1" + B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + fi + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}"