Update GitHub Actions config to switch Ubuntu 16.04 jobs to Docker containers.

The Ubuntu 16.04 environment is scheduled to be removed from GitHub Actions
in September 2021. Migrate those jobs to Docker containers or Ubuntu 18.04.

Also, added some older compilers. Ported CMake tests from Travis CI.

Based on https://github.com/boostorg/core/pull/95.
Closes https://github.com/boostorg/core/pull/95.
This commit is contained in:
Andrey Semashev
2021-09-06 01:11:33 +03:00
parent 9ff312e2fb
commit cd6847aee8

View File

@ -1,3 +1,9 @@
# Copyright 2020-2021 Peter Dimov
# 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:
@ -14,32 +20,48 @@ concurrency:
env:
GIT_FETCH_JOBS: 8
UBSAN_OPTIONS: print_stacktrace=1
jobs:
posix:
defaults:
run:
shell: bash
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-16.04
os: ubuntu-20.04
container: ubuntu:16.04
install: g++-4.7
- toolset: gcc-4.8
cxxstd: "03,11"
os: ubuntu-16.04
os: ubuntu-18.04
install: g++-4.8
- toolset: gcc-4.9
cxxstd: "03,11"
os: ubuntu-16.04
os: ubuntu-20.04
container: ubuntu:16.04
install: g++-4.9
- toolset: gcc-5
cxxstd: "03,11,14,1z"
os: ubuntu-16.04
os: ubuntu-20.04
container: ubuntu:16.04
- toolset: gcc-6
cxxstd: "03,11,14,1z"
os: ubuntu-16.04
os: ubuntu-18.04
install: g++-6
- toolset: gcc-7
cxxstd: "03,11,14,17"
@ -58,40 +80,51 @@ jobs:
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-16.04
os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.5
- toolset: clang
compiler: clang++-3.6
cxxstd: "03,11,14"
os: ubuntu-16.04
os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.6
- toolset: clang
compiler: clang++-3.7
cxxstd: "03,11,14"
os: ubuntu-16.04
os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.7
- toolset: clang
compiler: clang++-3.8
cxxstd: "03,11,14"
os: ubuntu-16.04
os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.8
- toolset: clang
compiler: clang++-3.9
cxxstd: "03,11,14"
os: ubuntu-16.04
os: ubuntu-18.04
install: clang-3.9
- toolset: clang
compiler: clang++-4.0
cxxstd: "03,11,14"
os: ubuntu-16.04
os: ubuntu-18.04
install: clang-4.0
- toolset: clang
compiler: clang++-5.0
cxxstd: "03,11,14,1z"
os: ubuntu-16.04
os: ubuntu-18.04
install: clang-5.0
- toolset: clang
compiler: clang++-6.0
@ -126,20 +159,49 @@ jobs:
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 tests
cmake_tests: 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 ${{matrix.install}}
sudo apt-get install -y ${{matrix.install}}
- name: Setup GCC Toolchain
if: matrix.gcc_toolchain
@ -166,18 +228,32 @@ jobs:
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
echo "CMAKE_BUILD_PARALLEL_LEVEL=$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
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
python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY
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 -d0 headers
./b2 headers
- name: Create user-config.jam
if: matrix.compiler
if: matrix.cmake_tests == '' && matrix.compiler != ''
run: |
echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam
if [ -n "$GCC_TOOLCHAIN_ROOT" ]
@ -187,10 +263,62 @@ jobs:
echo " ;" >> ~/user-config.jam
- name: Run tests
if: matrix.cmake_tests == ''
run: |
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
cd ../boost-root
./b2 -j $BUILD_JOBS libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release
B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "variant=debug,release")
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[@]}"
- name: Run CMake tests
if: matrix.cmake_tests != ''
run: |
cd ../boost-root
export CMAKE_TEST=1
mkdir __build_cmake_test__ && cd __build_cmake_test__
cmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=$LIBRARY ..
cmake --build . --target tests
ctest --output-on-failure
- name: Run CMake subdir tests
if: matrix.cmake_tests != ''
run: |
cd ../boost-root
export CMAKE_SUBDIR_TEST=1
cd libs/$LIBRARY/test/cmake_subdir_test && mkdir __build_cmake_subdir_test__ && cd __build_cmake_subdir_test__
cmake ..
cmake --build .
cmake --build . --target check
- name: Run CMake install tests
if: matrix.cmake_tests != ''
run: |
cd ../boost-root
export CMAKE_INSTALL_TEST=1
mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build . --target install
cd libs/$LIBRARY/test/cmake_install_test && mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
cmake --build .
cmake --build . --target check
windows:
strategy: