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 name: CI
on: on:
@ -14,32 +20,48 @@ concurrency:
env: env:
GIT_FETCH_JOBS: 8 GIT_FETCH_JOBS: 8
UBSAN_OPTIONS: print_stacktrace=1
jobs: jobs:
posix: posix:
defaults:
run:
shell: bash
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: 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 - toolset: gcc-4.7
cxxstd: "03,11" cxxstd: "03,11"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
install: g++-4.7 install: g++-4.7
- toolset: gcc-4.8 - toolset: gcc-4.8
cxxstd: "03,11" cxxstd: "03,11"
os: ubuntu-16.04 os: ubuntu-18.04
install: g++-4.8 install: g++-4.8
- toolset: gcc-4.9 - toolset: gcc-4.9
cxxstd: "03,11" cxxstd: "03,11"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
install: g++-4.9 install: g++-4.9
- toolset: gcc-5 - toolset: gcc-5
cxxstd: "03,11,14,1z" cxxstd: "03,11,14,1z"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
- toolset: gcc-6 - toolset: gcc-6
cxxstd: "03,11,14,1z" cxxstd: "03,11,14,1z"
os: ubuntu-16.04 os: ubuntu-18.04
install: g++-6 install: g++-6
- toolset: gcc-7 - toolset: gcc-7
cxxstd: "03,11,14,17" cxxstd: "03,11,14,17"
@ -58,40 +80,51 @@ jobs:
cxxstd: "03,11,14,17,20" cxxstd: "03,11,14,17,20"
os: ubuntu-20.04 os: ubuntu-20.04
install: g++-11 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 - toolset: clang
compiler: clang++-3.5 compiler: clang++-3.5
cxxstd: "03,11" cxxstd: "03,11"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.5 install: clang-3.5
- toolset: clang - toolset: clang
compiler: clang++-3.6 compiler: clang++-3.6
cxxstd: "03,11,14" cxxstd: "03,11,14"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.6 install: clang-3.6
- toolset: clang - toolset: clang
compiler: clang++-3.7 compiler: clang++-3.7
cxxstd: "03,11,14" cxxstd: "03,11,14"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.7 install: clang-3.7
- toolset: clang - toolset: clang
compiler: clang++-3.8 compiler: clang++-3.8
cxxstd: "03,11,14" cxxstd: "03,11,14"
os: ubuntu-16.04 os: ubuntu-20.04
container: ubuntu:16.04
install: clang-3.8 install: clang-3.8
- toolset: clang - toolset: clang
compiler: clang++-3.9 compiler: clang++-3.9
cxxstd: "03,11,14" cxxstd: "03,11,14"
os: ubuntu-16.04 os: ubuntu-18.04
install: clang-3.9 install: clang-3.9
- toolset: clang - toolset: clang
compiler: clang++-4.0 compiler: clang++-4.0
cxxstd: "03,11,14" cxxstd: "03,11,14"
os: ubuntu-16.04 os: ubuntu-18.04
install: clang-4.0 install: clang-4.0
- toolset: clang - toolset: clang
compiler: clang++-5.0 compiler: clang++-5.0
cxxstd: "03,11,14,1z" cxxstd: "03,11,14,1z"
os: ubuntu-16.04 os: ubuntu-18.04
install: clang-5.0 install: clang-5.0
- toolset: clang - toolset: clang
compiler: clang++-6.0 compiler: clang++-6.0
@ -126,71 +159,166 @@ jobs:
compiler: clang++-12 compiler: clang++-12
cxxstd: "03,11,14,17,20" cxxstd: "03,11,14,17,20"
os: ubuntu-20.04 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 - toolset: clang
cxxstd: "03,11,14,17,2a" cxxstd: "03,11,14,17,2a"
os: macos-10.15 os: macos-10.15
- name: CMake tests
cmake_tests: 1
os: ubuntu-20.04
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}
container: ${{matrix.container}}
steps: 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 - uses: actions/checkout@v2
- name: Install packages - name: Install packages
if: matrix.install if: matrix.install
run: | run: |
sudo apt-get update for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done
sudo apt-get install ${{matrix.install}} sudo apt-get update
sudo apt-get install -y ${{matrix.install}}
- name: Setup GCC Toolchain - name: Setup GCC Toolchain
if: matrix.gcc_toolchain if: matrix.gcc_toolchain
run: | run: |
GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain"
echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV
MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
mkdir -p "$GCC_TOOLCHAIN_ROOT" mkdir -p "$GCC_TOOLCHAIN_ROOT"
ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include"
ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin"
mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" 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}}" ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}"
- name: Setup Boost - name: Setup Boost
run: | run: |
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/} LIBRARY=${GITHUB_REPOSITORY#*/}
echo LIBRARY: $LIBRARY echo LIBRARY: $LIBRARY
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo GITHUB_BASE_REF: $GITHUB_BASE_REF echo GITHUB_BASE_REF: $GITHUB_BASE_REF
echo GITHUB_REF: $GITHUB_REF echo GITHUB_REF: $GITHUB_REF
REF=${GITHUB_BASE_REF:-$GITHUB_REF} REF=${GITHUB_BASE_REF:-$GITHUB_REF}
REF=${REF#refs/heads/} REF=${REF#refs/heads/}
echo REF: $REF echo REF: $REF
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
echo BOOST_BRANCH: $BOOST_BRANCH echo BOOST_BRANCH: $BOOST_BRANCH
cd .. BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null)
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV
cd boost-root echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV
mkdir -p libs/$LIBRARY DEPINST_ARGS=()
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY GIT_VERSION="$(git --version | sed -e 's/git version //')"
git submodule update --init tools/boostdep if $(dpkg --compare-versions "$GIT_VERSION" ge 2.8.0)
python tools/boostdep/depinst/depinst.py --git_args "--jobs $GIT_FETCH_JOBS" $LIBRARY then
./bootstrap.sh DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
./b2 -d0 headers 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: Create user-config.jam - name: Create user-config.jam
if: matrix.compiler if: matrix.cmake_tests == '' && matrix.compiler != ''
run: | run: |
echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam
if [ -n "$GCC_TOOLCHAIN_ROOT" ] if [ -n "$GCC_TOOLCHAIN_ROOT" ]
then then
echo -n " : <compileflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" <linkflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam echo -n " : <compileflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" <linkflags>\"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam
fi fi
echo " ;" >> ~/user-config.jam echo " ;" >> ~/user-config.jam
- name: Run tests - name: Run tests
if: matrix.cmake_tests == ''
run: | run: |
BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) cd ../boost-root
cd ../boost-root B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "variant=debug,release")
./b2 -j $BUILD_JOBS libs/$LIBRARY/test 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: windows:
strategy: strategy:
@ -218,27 +346,27 @@ jobs:
- name: Setup Boost - name: Setup Boost
shell: cmd shell: cmd
run: | run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY% echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY% echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV% echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF% echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF% echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF% if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH% echo BOOST_BRANCH: %BOOST_BRANCH%
cd .. 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 cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\ xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY% python tools/boostdep/depinst/depinst.py --git_args "--jobs %GIT_FETCH_JOBS%" %LIBRARY%
cmd /c bootstrap cmd /c bootstrap
b2 -d0 headers b2 -d0 headers
- name: Run tests - name: Run tests
shell: cmd shell: cmd
run: | run: |
cd ../boost-root cd ../boost-root
b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release b2 -j %NUMBER_OF_PROCESSORS% libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release