Add GitHub Actions config [ci skip]

This commit is contained in:
sdarwin
2021-03-04 18:22:48 +00:00
parent f882ab890d
commit 2bf2bba4be

191
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,191 @@
name: GitHub Actions CI
on:
pull_request:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**
jobs:
posix:
strategy:
fail-fast: false
matrix:
include:
- name: "GCC-8"
buildtype: "boost"
packages: "g++-8"
packages_to_remove: ""
os: "ubuntu-16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
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\""
gcovtool: "gcov-8"
- name: "GCC-4.6"
buildtype: "boost"
packages: "g++-4.6"
packages_to_remove: ""
os: "ubuntu-16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
b2_args: "cxxstd=98,0x toolset=gcc-4.6 cxxflags=\"--coverage -DBOOST_TRAVISCI_BUILD\" linkflags=\"--coverage\""
gcovtool: "gcov-4.6"
- name: "Clang-7"
buildtype: "boost"
packages: "clang++-7"
packages_to_remove: ""
os: "ubuntu-16.04"
cxx: "g++"
sources: ""
llvm_os: "xenial"
llvm_ver: "7"
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\""
gcovtool: "gcov_for_clang.sh"
- name: "Clang-3.8, libc++"
buildtype: "boost"
packages: "libc++-dev"
packages_to_remove: ""
os: "ubuntu-16.04"
cxx: "g++"
sources: ""
llvm_os: ""
llvm_ver: ""
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\""
gcovtool: "gcov_for_clang.sh"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Check if running in container
if: matrix.container != ''
run: echo "GHA_CONTAINER=${{ matrix.container }}" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: linux
shell: bash
env:
CXX: ${{ matrix.cxx }}
SOURCES: ${{ matrix.sources }}
LLVM_OS: ${{ matrix.llvm_os }}
LLVM_VER: ${{ matrix.llvm_ver }}
PACKAGES: ${{ matrix.packages }}
PACKAGES_TO_REMOVE: ${{ matrix.packages_to_remove }}
JOB_BUILDTYPE: ${{ matrix.buildtype }}
B2_ARGS: ${{ matrix.b2_args }}
GCOVTOOL: ${{ matrix.gcovtool }}
TRAVIS_BRANCH: ${{ github.base_ref }}
TRAVIS_OS_NAME: "linux"
run: |
echo '==================================> SETUP'
echo '==================================> PACKAGES'
sudo ln -s /usr/bin/llvm-cov-9 /usr/bin/llvm-cov
set -e
if [ -n "$PACKAGES_TO_REMOVE" ]; then sudo apt-get purge -y $PACKAGES_TO_REMOVE; fi
echo ">>>>> APT: REPO.."
for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done
if test -n "${LLVM_OS}" ; then
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
if test -n "${LLVM_VER}" ; then
sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS}-${LLVM_VER} main"
else
# Snapshot (i.e. trunk) build of clang
sudo -E apt-add-repository "deb http://apt.llvm.org/${LLVM_OS}/ llvm-toolchain-${LLVM_OS} main"
fi
fi
echo ">>>>> APT: UPDATE.."
sudo -E apt-get -o Acquire::Retries=3 update
if test -n "${SOURCES}" ; then
echo ">>>>> APT: INSTALL SOURCES.."
for SOURCE in $SOURCES; do
sudo -E apt-add-repository ppa:$SOURCE
done
fi
echo ">>>>> APT: INSTALL ${PACKAGES}.."
sudo -E DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y --no-install-suggests --no-install-recommends install ${PACKAGES}
echo '==================================> INSTALL AND COMPILE'
set -e
export TRAVIS_BUILD_DIR=$(pwd)
export TRAVIS_BRANCH=${TRAVIS_BRANCH:-$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')}
export VCS_COMMIT_ID=$GITHUB_SHA
export GIT_COMMIT=$GITHUB_SHA
export REPO_NAME=$(basename $GITHUB_REPOSITORY)
export USER=$(whoami)
export CC=${CC:-gcc}
export PATH=~/.local/bin:/usr/local/bin:$PATH
if [ "$JOB_BUILDTYPE" == "boost" ]; then
echo '==================================> INSTALL'
BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
IGNORE_COVERAGE=''
BOOST_LIBS_FOLDER=$(basename $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 $TRAVIS_BUILD_DIR, branch $BOOST_BRANCH"
rm -rf $BOOST/libs/$BOOST_LIBS_FOLDER || true
cp -rp $TRAVIS_BUILD_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
./b2 headers
./b2 -j4 variant=debug tools/inspect/build
echo "using gcc ;" >> ~/user-config.jam
echo "using clang ;" >> ~/user-config.jam
echo "using clang : 3.8 : clang++-3.8 ;" >> ~/user-config.jam
echo "using clang : 4 : clang++-4.0 ;" >> ~/user-config.jam
echo "using clang : 5 : clang++-5.0 ;" >> ~/user-config.jam
echo "using clang : 6 : clang++-6.0 ;" >> ~/user-config.jam
echo "using clang : 7 : clang++-7 ;" >> ~/user-config.jam
echo "using clang : 8 : clang++-8 ;" >> ~/user-config.jam
echo "using clang : libc++ : clang++-libc++ ;" >> ~/user-config.jam
cd $BOOST/libs/$BOOST_LIBS_FOLDER/test/
echo '==================================> SCRIPT'
sh -c "../../../b2 -j2 $B2_ARGS"
../../../dist/bin/inspect .. -license -copyright -crlf -end -path_name -tab -ascii -apple_macro -assert_macro -deprecated_macro -minmax -unnamed
echo '==================================> AFTER_SUCCESS'
mkdir -p $TRAVIS_BUILD_DIR/coverals
find ../../../bin.v2/ -name "*.gcda" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
find ../../../bin.v2/ -name "*.gcno" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
find ../../../bin.v2/ -name "*.da" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
find ../../../bin.v2/ -name "*.no" -exec cp "{}" $TRAVIS_BUILD_DIR/coverals/ \;
wget https://github.com/linux-test-project/lcov/archive/v1.14.zip
unzip v1.14.zip
LCOV="`pwd`/lcov-1.14/bin/lcov --gcov-tool $GCOVTOOL"
mkdir -p ~/.local/bin
echo -e '#!/bin/bash\nexec llvm-cov gcov "$@"' > ~/.local/bin/gcov_for_clang.sh
chmod 755 ~/.local/bin/gcov_for_clang.sh
echo "$LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info"
$LCOV --directory $TRAVIS_BUILD_DIR/coverals --base-directory `pwd` --capture --output-file $TRAVIS_BUILD_DIR/coverals/coverage.info
cd $BOOST
$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info "/usr*" "*/$BOOST_LIBS_FOLDER/test/*" $IGNORE_COVERAGE "*/$BOOST_LIBS_FOLDER/tests/*" "*/$BOOST_LIBS_FOLDER/examples/*" "*/$BOOST_LIBS_FOLDER/example/*" -o $TRAVIS_BUILD_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
eval "$LCOV --remove $TRAVIS_BUILD_DIR/coverals/coverage.info $OTHER_LIBS -o $TRAVIS_BUILD_DIR/coverals/coverage.info"
cd $TRAVIS_BUILD_DIR
sudo gem install coveralls-lcov || echo "ERROR. Failed to install coveralls-lcov"
coveralls-lcov coverals/coverage.info
fi