update CI: use workflow from boost.Any

This commit is contained in:
Antony Polukhin
2021-04-21 20:47:14 +03:00
parent c1c098fac1
commit 46695ffb86

View File

@@ -6,10 +6,10 @@ on:
branches: branches:
- master - master
- develop - develop
- githubactions*
- feature/** - feature/**
- fix/**
- pr/** env:
UBSAN_OPTIONS: print_stacktrace=1
jobs: jobs:
posix: posix:
@@ -17,164 +17,174 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- name: "GCC-8" - toolset: gcc-4.8
buildtype: "boost" cxxstd: "03,11"
packages: "g++-8" os: ubuntu-16.04
packages_to_remove: "" install: g++-4.8
os: "ubuntu-16.04" - toolset: gcc-7
llvm_os: "" cxxstd: "03,11,14,17"
llvm_ver: "" os: ubuntu-18.04
b2_args: "cxxstd=98,03,11,14,1z toolset=gcc-8 cxxflags=\"--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD\" linkflags=\"--coverage -lasan -lubsan\"" - toolset: gcc-9
gcovtool: "gcov-8" cxxstd: "03,11,14,17,2a"
- name: "GCC-4.6" os: ubuntu-18.04
buildtype: "boost" - toolset: gcc-10
packages: "g++-4.6" cxxstd: "03,11,14,17,2a"
packages_to_remove: "" os: ubuntu-18.04
os: "ubuntu-16.04" cxxflags: "cxxflags=--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined"
llvm_os: "" linkflags: "linkflags=--coverage -lasan -lubsan"
llvm_ver: "" gcov_tool: "gcov-10"
b2_args: "cxxstd=98,0x toolset=gcc-4.6 cxxflags=\"--coverage -DBOOST_TRAVISCI_BUILD\" linkflags=\"--coverage\"" - toolset: clang
gcovtool: "gcov-4.6" compiler: clang++-3.7
- name: "Clang-7" cxxstd: "03,11,14"
buildtype: "boost" os: ubuntu-16.04
packages: "clang++-7 llvm-7" install: clang-3.7
packages_to_remove: "" - toolset: clang
os: "ubuntu-16.04" compiler: clang++-9
llvm_os: "xenial" cxxstd: "03,11,14,17,2a"
llvm_ver: "7" os: ubuntu-20.04
b2_args: "cxxstd=98,03,11,14,1z toolset=clang-7 cxxflags=\"--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD\" linkflags=\"--coverage -fsanitize=address,leak,undefined\"" cxxflags: "cxxflags=--coverage"
gcovtool: "gcov_for_clang.sh" linkflags: "linkflags=--coverage"
- name: "Clang-3.8, libc++" gcov_tool: "llvm-cov-9 gcov"
buildtype: "boost" - toolset: clang
packages: "libc++-dev llvm-3.8" compiler: clang++-10
packages_to_remove: "" cxxstd: "03,11,14,17,2a"
os: "ubuntu-16.04" os: ubuntu-20.04
llvm_os: "" - toolset: clang
llvm_ver: "3.8" cxxstd: "03,11,14,17,2a"
b2_args: "cxxstd=03,11,14 toolset=clang-libc++ cxxflags=\"--coverage -fsanitize=address,leak,undefined -fno-sanitize-recover=undefined -DBOOST_TRAVISCI_BUILD\" linkflags=\"--coverage -fsanitize=address,leak,undefined\"" os: macos-10.15
gcovtool: "gcov_for_clang.sh" cxxflags: "cxxflags=-fsanitize=address,undefined -fno-sanitize-recover=undefined"
linkflags: "linkflags=-fsanitize=address,undefined"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }} runs-on: ${{matrix.os}}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Check if running in container
if: matrix.container != ''
run: echo "GHA_CONTAINER=${{ matrix.container }}" >> $GITHUB_ENV
- name: Install packages - name: Install packages
shell: bash if: matrix.install
env: run: sudo apt install ${{matrix.install}}
CI_LLVM_OS: ${{ matrix.llvm_os }}
CI_LLVM_VER: ${{ matrix.llvm_ver }} - name: Setup Boost
CI_PACKAGES: ${{ matrix.packages }}
CI_PACKAGES_TO_REMOVE: ${{ matrix.packages_to_remove }}
run: | run: |
set -ex echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
LIBRARY=${GITHUB_REPOSITORY#*/}
ci_print_packages_info() { echo LIBRARY: $LIBRARY
if [ -n "$CI_DEBUG" ]; then echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
echo $1 echo GITHUB_BASE_REF: $GITHUB_BASE_REF
whoami echo GITHUB_REF: $GITHUB_REF
dpkg -l REF=${GITHUB_BASE_REF:-$GITHUB_REF}
echo "Checking /usr/local" REF=${REF#refs/heads/}
ls -al /usr/local echo REF: $REF
echo "Checking clang" BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
which clang++ || true echo BOOST_BRANCH: $BOOST_BRANCH
clang++ --version || true cd ..
ls -al /etc/alternatives git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git boost-root
ls -al /usr/bin/c* cd boost-root
fi cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
} git submodule update --init --depth 10 --jobs 2 tools/boostdep tools/inspect libs/filesystem
python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 3" filesystem
ci_remove_packages() { python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 3" $LIBRARY
if [ -n "$CI_PACKAGES_TO_REMOVE" ]; then
echo "About to run sudo apt-get purge -y $CI_PACKAGES_TO_REMOVE"
sudo apt-get purge -y $CI_PACKAGES_TO_REMOVE
fi
}
ci_linux_cxx_install() {
echo "About to run linux-cxx-install.sh"
wget https://raw.githubusercontent.com/boostorg/boost-ci/master/ci/drone/linux-cxx-install.sh
chmod +x linux-cxx-install.sh
mv linux-cxx-install.sh .github/
PACKAGES=$CI_PACKAGES LLVM_OS=$CI_LLVM_OS LLVM_VER=$CI_LLVM_VER .github/linux-cxx-install.sh
echo "Done with linux-cxx-install.sh"
}
ci_print_packages_info "Before package removal or install"
ci_remove_packages
ci_linux_cxx_install
ci_print_packages_info "After package removal and install"
- name: Prepare Boost libraries and Test
shell: bash
env:
CI_LLVM_VER: ${{ matrix.llvm_ver }}
CI_B2_ARGS: ${{ matrix.b2_args }}
CI_GCOVTOOL: ${{ matrix.gcovtool }}
CI_GIT_BRANCH: ${{ github.base_ref }}
run: |
set -ex
export CI_PROJECT_DIR=$(pwd)
export CI_GIT_BRANCH=${CI_GIT_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}
export CI_REPO_NAME=$(basename $GITHUB_REPOSITORY)
BOOST_BRANCH=develop && [ "$CI_GIT_BRANCH" == "master" ] && BOOST_BRANCH=master || true
IGNORE_COVERAGE=''
BOOST_LIBS_FOLDER=$(basename $CI_REPO_NAME)
UBSAN_OPTIONS=print_stacktrace=1
LSAN_OPTIONS=verbosity=1:log_threads=1
BOOST=$HOME/boost-local
git clone -b $BOOST_BRANCH --depth 10 https://github.com/boostorg/boost.git $BOOST
cd $BOOST
git submodule update --init --depth 10 --jobs 2 tools/build tools/boostdep tools/inspect libs/filesystem
python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST/libs/filesystem
echo "Testing $BOOST/libs/$BOOST_LIBS_FOLDER moved from $CI_PROJECT_DIR, branch $BOOST_BRANCH"
rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true
cp -rp $CI_PROJECT_DIR $BOOST/libs/$BOOST_LIBS_FOLDER
python tools/boostdep/depinst/depinst.py --git_args "--depth 10 --jobs 2" $BOOST_LIBS_FOLDER
git status
./bootstrap.sh ./bootstrap.sh
./b2 headers ./b2 -d0 headers
./b2 -j4 variant=debug tools/inspect/build ./b2 -j4 variant=debug tools/inspect/build
echo "using gcc ;" >> ~/user-config.jam
echo "using clang ;" >> ~/user-config.jam
if [ -n "$CI_LLVM_VER" ]; then echo "using clang : ${CI_LLVM_VER} : clang++-${CI_LLVM_VER} ;" >> ~/user-config.jam; fi
echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
echo '==================================> TEST' - name: Create user-config.jam
if: matrix.compiler
run: |
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
sh -c "../../../b2 -j2 $CI_B2_ARGS" - name: Run tests
../../../dist/bin/inspect .. -license -copyright -crlf -end -path_name -tab -ascii -apple_macro -assert_macro -deprecated_macro -minmax -unnamed run: |
cd ../boost-root
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release "${{matrix.cxxflags}}" "${{matrix.linkflags}}" "${{matrix.launcher}}"
dist/bin/inspect libs/$LIBRARY/test
echo '==================================> AFTER_SUCCESS' - name: Prepare coverage data
if: matrix.gcov_tool
run: |
mkdir -p $GITHUB_WORKSPACE/coveralls
mkdir -p $CI_PROJECT_DIR/coverals echo -e "#!/bin/bash\nexec ${{matrix.gcov_tool}} \"\$@\"" > $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $CI_PROJECT_DIR/coverals/ \; chmod +x $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh
find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $CI_PROJECT_DIR/coverals/ \; wget https://github.com/linux-test-project/lcov/archive/v1.15.zip
find ../../../bin.v2/ -name "*.da" -exec cp "{}" $CI_PROJECT_DIR/coverals/ \; unzip v1.15.zip
find ../../../bin.v2/ -name "*.no" -exec cp "{}" $CI_PROJECT_DIR/coverals/ \; LCOV="`pwd`/lcov-1.15/bin/lcov --gcov-tool $GITHUB_WORKSPACE/coveralls/gcov_wrapper.sh"
wget https://github.com/linux-test-project/lcov/archive/v1.14.zip
unzip v1.14.zip echo "$LCOV --directory $GITHUB_WORKSPACE/coveralls --base-directory `pwd`/libs/$LIBRARY/test --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info"
LCOV="`pwd`/lcov-1.14/bin/lcov --gcov-tool $CI_GCOVTOOL" $LCOV --directory ../boost-root/bin.v2/libs/$LIBRARY/ --base-directory ../boost-root/ --capture --output-file $GITHUB_WORKSPACE/coveralls/coverage.info
mkdir -p ~/.local/bin $LCOV --remove $GITHUB_WORKSPACE/coveralls/coverage.info "/usr*" "*/$LIBRARY/test/*" ${{matrix.ignore_coverage}} "*/$LIBRARY/tests/*" "*/$LIBRARY/examples/*" "*/$LIBRARY/example/*" -o $GITHUB_WORKSPACE/coveralls/coverage.info
echo -e "#!/bin/bash\nexec llvm-cov-${CI_LLVM_VER} gcov \"\$@\"" > ~/.local/bin/gcov_for_clang.sh
chmod 755 ~/.local/bin/gcov_for_clang.sh cd ../boost-root
echo "$LCOV --directory $CI_PROJECT_DIR/coverals --base-directory `pwd` --capture --output-file $CI_PROJECT_DIR/coverals/coverage.info" OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$LIBRARY\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
$LCOV --directory $CI_PROJECT_DIR/coverals --base-directory `pwd` --capture --output-file $CI_PROJECT_DIR/coverals/coverage.info
cd $BOOST
$LCOV --remove $CI_PROJECT_DIR/coverals/coverage.info "/usr*" "*/$BOOST_LIBS_FOLDER/test/*" $IGNORE_COVERAGE "*/$BOOST_LIBS_FOLDER/tests/*" "*/$BOOST_LIBS_FOLDER/examples/*" "*/$BOOST_LIBS_FOLDER/example/*" -o $CI_PROJECT_DIR/coverals/coverage.info
OTHER_LIBS=`grep "submodule .*" .gitmodules | sed 's/\[submodule\ "\(.*\)"\]/"\*\/boost\/\1\.hpp" "\*\/boost\/\1\/\*"/g'| sed "/\"\*\/boost\/$BOOST_LIBS_FOLDER\/\*\"/d" | sed ':a;N;$!ba;s/\n/ /g'`
echo $OTHER_LIBS echo $OTHER_LIBS
eval "$LCOV --remove $CI_PROJECT_DIR/coverals/coverage.info $OTHER_LIBS -o $CI_PROJECT_DIR/coverals/coverage.info" eval "$LCOV --remove $GITHUB_WORKSPACE/coveralls/coverage.info $OTHER_LIBS -o $GITHUB_WORKSPACE/coveralls/coverage.info"
- name: Coveralls - name: Coveralls
uses: coverallsapp/github-action@master uses: coverallsapp/github-action@master
if: matrix.gcov_tool
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverals/coverage.info path-to-lcov: ./coveralls/coverage.info
parallel: true
windows:
strategy:
fail-fast: false
matrix:
include:
- toolset: msvc-14.1
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2016
- toolset: msvc-14.2
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2019
- toolset: gcc
cxxstd: "03,11,14,17,2a"
addrmd: 64
os: windows-2019
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
git submodule update --init tools/boostdep
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
cmd /c bootstrap
b2 -d0 headers
- name: Run tests
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
finish:
needs: posix
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true