Enhance CI build time

This commit is contained in:
Daniil Kovalev 2021-08-10 01:05:53 +03:00 committed by GitHub
parent 25d6f84f3c
commit 073394cbba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 150 additions and 116 deletions

View File

@ -11,11 +11,9 @@ EOL
build_boost() build_boost()
{ {
mkdir $3 || exit 1
./b2 \ ./b2 \
-j4 \
--toolset=$1 \ --toolset=$1 \
--prefix=$3 \ --prefix=$3/$2 \
--with-test \ --with-test \
--with-headers \ --with-headers \
--with-chrono \ --with-chrono \
@ -50,6 +48,7 @@ while getopts "b:t:p:" c; do
esac esac
done done
mkdir $prefix || exit 1
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1 wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1
tar xf boost_1_76_0.tar.bz2 || exit 1 tar xf boost_1_76_0.tar.bz2 || exit 1
cd boost_1_76_0 cd boost_1_76_0

View File

@ -15,7 +15,7 @@ while getopts "b:t:p:" c; do
case "$c" in case "$c" in
b) b)
bit="$OPTARG" bit="$OPTARG"
[ "$bit" != "32" ] && [ "$bit" != "64" ] && usage && exit 1 [ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
;; ;;
p) p)
prefix="$OPTARG" prefix="$OPTARG"
@ -26,15 +26,26 @@ while getopts "b:t:p:" c; do
esac esac
done done
mkdir $prefix || exit 1
wget https://zlib.net/zlib-1.2.11.tar.gz || exit 1 wget https://zlib.net/zlib-1.2.11.tar.gz || exit 1
tar -xf zlib-1.2.11.tar.gz || exit 1 tar -xf zlib-1.2.11.tar.gz || exit 1
cd zlib-1.2.11 cd zlib-1.2.11
mkdir $prefix build()
cmake \ {
cmake \
-D CMAKE_BUILD_TYPE=Release \ -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=$prefix \ -D CMAKE_INSTALL_PREFIX=$2/$1 \
-D CMAKE_C_FLAGS="-m${bit}" \ -D CMAKE_C_FLAGS="-m$1" \
-D CMAKE_SHARED_LINKER_FLAGS="-m${bit}" \ -D CMAKE_SHARED_LINKER_FLAGS="-m$1" \
-B build$1 \
-S . -S .
cmake --build . --target install cmake --build build$1 --target install
}
if [ "$bit" = "both" ]; then
build 32 $prefix
build 64 $prefix
else
build $bit $prefix
fi

View File

@ -16,10 +16,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: install depends - name: Install build dependencies
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install g++-10-multilib lcov -y sudo apt-get install g++-10 cmake lcov -y
./ci/set_gcc_10.sh ./ci/set_gcc_10.sh
- name: Cache boost - name: Cache boost
@ -27,22 +27,22 @@ jobs:
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/boost-prefix/ path: ~/boost-prefix/
key: ${{ runner.os }}-boost-64-1-76-0-20210613 key: ${{ runner.os }}-boost-64-1-76-0-2021-08-09
- name: Build boost - name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true' if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b 64 -t gcc -p $HOME/boost-prefix/ run: ./.github/depends/boost.sh -b 64 -t gcc -p $HOME/boost-prefix
- name: Cache zlib - name: Cache zlib
id: cache-zlib id: cache-zlib
uses: actions/cache@v1 uses: actions/cache@v1
with: with:
path: ~/zlib-prefix/ path: ~/zlib-prefix/
key: ${{ runner.os }}-zlib-64-1-2-11-20210613 key: ${{ runner.os }}-zlib-64-1-2-11-2021-08-09
- name: Build zlib - name: Build zlib
if: steps.cache-zlib.outputs.cache-hit != 'true' if: steps.cache-zlib.outputs.cache-hit != 'true'
run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix/ run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix
- name: Compile tests - name: Compile tests
run: | run: |
@ -56,7 +56,7 @@ jobs:
-D MSGPACK_BUILD_TESTS=ON \ -D MSGPACK_BUILD_TESTS=ON \
-D CMAKE_BUILD_TYPE=Debug \ -D CMAKE_BUILD_TYPE=Debug \
-D MSGPACK_GEN_COVERAGE=ON \ -D MSGPACK_GEN_COVERAGE=ON \
-D CMAKE_PREFIX_PATH="$HOME/zlib-prefix;$HOME/boost-prefix" \ -D CMAKE_PREFIX_PATH="$HOME/zlib-prefix/64;$HOME/boost-prefix/64" \
-B build \ -B build \
-S . || exit 1 -S . || exit 1
cmake --build build --target all || exit 1 cmake --build build --target all || exit 1

View File

@ -11,83 +11,79 @@ on:
jobs: jobs:
macos: macos:
name: ${{ format('macOS arch={0} cxx{1} san={2} api={3} char={4} x3={5}', matrix.arch, matrix.cxx, matrix.sanitize, matrix.api, matrix.char_sign, matrix.x3_parse) }} name: ${{ format('macOS (pattern {0})', matrix.pattern) }}
runs-on: macos-latest runs-on: macos-latest
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
arch: [64] pattern: [0, 1, 2, 3, 4]
cxx: [98, 11, 14, 17, 20]
sanitize: ["no", "undefined"]
api: [1, 2, 3]
char_sign: ["unsigned", "signed"]
x3_parse: ["OFF", "ON"]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Cache boost - name: Cache boost
id: cache-boost id: cache-boost
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/boost-prefix/ path: ~/boost-prefix/
key: ${{ runner.os }}-boost-1-76-0-20210612 key: ${{ runner.os }}-boost-1-76-0-2021-08-09
- name: Build boost - name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true' if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b ${{ matrix.arch }} -t clang -p $HOME/boost-prefix/ run: ./.github/depends/boost.sh -b 64 -t clang -p $HOME/boost-prefix
- name: Cache zlib - name: Cache zlib
id: cache-zlib id: cache-zlib
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/zlib-prefix/ path: ~/zlib-prefix/
key: ${{ runner.os }}-zlib-${{ matrix.arch }}-1-2-11-20210623 key: ${{ runner.os }}-zlib-1-2-11-2021-08-09
- name: Build zlib - name: Build zlib
if: steps.cache-zlib.outputs.cache-hit != 'true' if: steps.cache-zlib.outputs.cache-hit != 'true'
run: ./.github/depends/zlib.sh -b ${{ matrix.arch }} -p $HOME/zlib-prefix/ run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix
- name: Build and test - name: Build and test
shell: bash shell: bash
run: | run: |
if [[ (${{ matrix.cxx }} -eq 98 || ${{ matrix.cxx }} -lt 14) && "${{ matrix.x3_parse }}" == "ON" ]]; then # default configuration - overwrite its params later depending on matrix.pattern
echo "X3 parse is only supported with C++14 or newer - skip this configuration" export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
exit 0 export ARCH=64
fi export API_VERSION=3
export CHAR_SIGN="signed"
export X3_PARSE="OFF"
export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all"
export ARCH="${{ matrix.arch }}" case ${{ matrix.pattern }} in
export API_VERSION="${{ matrix.api }}" 0)
export CHAR_SIGN="${{ matrix.char_sign }}"
export X3_PARSE="${{ matrix.x3_parse }}"
if [ "${{ matrix.cxx }}" == "98" ]; then
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF" export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
else ;;
export MSGPACK_CXX_VERSION="MSGPACK_CXX${{ matrix.cxx }}=ON" 1)
fi export API_VERSION=1
;;
if [ "${{ matrix.sanitize }}" != "no" ]; then 2)
export SANITIZE="-fsanitize=${{ matrix.sanitize }} -fno-sanitize-recover=all" export API_VERSION=2
fi ;;
3)
export X3_PARSE="ON"
;;
4)
export CHAR_SIGN="unsigned"
;;
esac
# build and test # build and test
export CXX="clang++" export CXX="clang++"
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
linux: linux:
name: ${{ format('Linux {0} arch={1} cxx{2} san={3} api={4} char={5} x3={6}', matrix.compiler, matrix.arch, matrix.cxx, matrix.sanitize, matrix.api, matrix.char_sign, matrix.x3_parse) }} name: ${{ format('Linux (pattern {0})', matrix.pattern) }}
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
arch: [32, 64] pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
cxx: [98, 11, 14, 17, 20]
sanitize: ["no", "undefined"]
api: [1, 2, 3]
char_sign: ["unsigned", "signed"]
x3_parse: ["OFF", "ON"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -96,67 +92,95 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install g++-10 cmake valgrind -y sudo apt-get install g++-10 cmake valgrind -y
if [ ${{ matrix.arch }} == 32 ]; then sudo apt-get install g++-10-multilib -y # for 32-bit compile
sudo apt-get install g++-10-multilib -y
fi
./ci/set_gcc_10.sh ./ci/set_gcc_10.sh
- name: Cache boost - name: Cache boost
id: cache-boost id: cache-boost
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/boost-prefix/ path: ~/boost-prefix/
key: ${{ runner.os }}-boost-${{ matrix.arch }}-1-76-0-20210613 key: ${{ runner.os }}-boost-1-76-0-2021-08-09
- name: Build boost - name: Build boost
if: steps.cache-boost.outputs.cache-hit != 'true' if: steps.cache-boost.outputs.cache-hit != 'true'
run: ./.github/depends/boost.sh -b ${{ matrix.arch }} -t gcc -p $HOME/boost-prefix/ run: ./.github/depends/boost.sh -b both -t gcc -p $HOME/boost-prefix
- name: Cache zlib - name: Cache zlib
id: cache-zlib id: cache-zlib
uses: actions/cache@v1 uses: actions/cache@v2
with: with:
path: ~/zlib-prefix/ path: ~/zlib-prefix/
key: ${{ runner.os }}-zlib-${{ matrix.arch }}-1-2-11-20210613 key: ${{ runner.os }}-zlib-1-2-11-2021-08-09
- name: Build zlib - name: Build zlib
if: steps.cache-zlib.outputs.cache-hit != 'true' if: steps.cache-zlib.outputs.cache-hit != 'true'
run: ./.github/depends/zlib.sh -b ${{ matrix.arch }} -p $HOME/zlib-prefix/ run: ./.github/depends/zlib.sh -b both -p $HOME/zlib-prefix
- name: Build and test - name: Build and test
shell: bash shell: bash
run: | run: |
if [[ (${{ matrix.cxx }} -eq 98 || ${{ matrix.cxx }} -lt 14) && "${{ matrix.x3_parse }}" == "ON" ]]; then # default configuration - overwrite its params later depending on matrix.pattern
echo "X3 parse is only supported with C++14 or newer - skip this configuration" export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
exit 0 export ARCH=64
fi export API_VERSION=3
export CHAR_SIGN="signed"
export X3_PARSE="OFF"
export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all"
export ACTION="ci/build_cmake.sh"
export ARCH="${{ matrix.arch }}" case ${{ matrix.pattern }} in
export API_VERSION="${{ matrix.api }}" 0)
export CHAR_SIGN="${{ matrix.char_sign }}"
export X3_PARSE="${{ matrix.x3_parse }}"
if [ "${{ matrix.cxx }}" == "98" ]; then
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF" export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
else ;;
export MSGPACK_CXX_VERSION="MSGPACK_CXX${{ matrix.cxx }}=ON" 1)
fi export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
;;
if [ "${{ matrix.sanitize }}" != "no" ]; then 2)
export SANITIZE="-fsanitize=${{ matrix.sanitize }} -fno-sanitize-recover=all" export MSGPACK_CXX_VERSION="MSGPACK_CXX14=ON"
fi ;;
3)
export MSGPACK_CXX_VERSION="MSGPACK_CXX17=ON"
;;
4)
export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
;;
5)
export ARCH=32
;;
6)
export API_VERSION=2
;;
7)
export API_VERSION=1
;;
8)
export CHAR_SIGN="unsigned"
;;
9)
export X3_PARSE="ON"
;;
10)
export ACTION="ci/build_regression.sh"
;;
11)
export ARCH=32
export CHAR_SIGN="unsigned"
export X3_PARSE="ON"
;;
esac
# build and test # build and test
# g++ # g++
export CXX="g++-10" export CXX="g++-10"
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
# clang++ # clang++
# with ubsan clang inserts undefined reference to `__mulodi4' on 32-bit build - skip this configuration # with ubsan clang inserts undefined reference to `__mulodi4' on 32-bit build - skip this configuration
if ! [[ "${{ matrix.sanitize }}" == "undefined" && $ARCH -eq 32 ]]; then if ! [[ $SANITIZE != "" && $ARCH -eq 32 ]]; then
export CXX="clang++-10" export CXX="clang++-10"
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
fi fi
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2 cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
@ -169,16 +193,16 @@ jobs:
# MSVC2019 only supports /std:c++14, /std:c++17 and /std:c++latest # MSVC2019 only supports /std:c++14, /std:c++17 and /std:c++latest
cxx: [14, 17, 20] cxx: [14, 17, 20]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v2
- name: Cache vcpkg - name: Cache vcpkg dependencies
id: cache-vcpkg id: cache-vcpkg
uses: actions/cache@v1.0.3 uses: actions/cache@v2
with: with:
path: C:/vcpkg/installed/x64-windows path: C:/vcpkg/installed/x64-windows
key: ${{ runner.os }}-vcpkg-01072021 key: ${{ runner.os }}-vcpkg-2021-08-09
- name: Build dependencies - name: Install vcpkg dependencies
if: steps.cache-vcpkg.outputs.cache-hit != 'true' if: steps.cache-vcpkg.outputs.cache-hit != 'true'
shell: powershell shell: powershell
run: | run: |

View File

@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
mkdir $CXX-build || exit 1 build_dir="$CXX-build"
mkdir $CXX-prefix || exit 1 prefix_dir="`pwd`/$CXX-prefix"
mkdir $build_dir || exit 1
mkdir $prefix_dir || exit 1
if [ "${ARCH}" == "32" ] if [ "${ARCH}" == "32" ]; then
then
export BIT32="ON" export BIT32="ON"
export ARCH_FLAG="-m32" export ARCH_FLAG="-m32"
else else
@ -13,7 +14,7 @@ else
fi fi
cmake \ cmake \
-D CMAKE_PREFIX_PATH="$HOME/boost-prefix;$HOME/zlib-prefix" \ -D CMAKE_PREFIX_PATH="${HOME}/boost-prefix/${ARCH};${HOME}/zlib-prefix/${ARCH}" \
-D MSGPACK_BUILD_TESTS=ON \ -D MSGPACK_BUILD_TESTS=ON \
-D ${MSGPACK_CXX_VERSION} \ -D ${MSGPACK_CXX_VERSION} \
-D MSGPACK_32BIT=${BIT32} \ -D MSGPACK_32BIT=${BIT32} \
@ -21,17 +22,16 @@ cmake \
-D MSGPACK_DEFAULT_API_VERSION=${API_VERSION} \ -D MSGPACK_DEFAULT_API_VERSION=${API_VERSION} \
-D MSGPACK_USE_X3_PARSE=${X3_PARSE} \ -D MSGPACK_USE_X3_PARSE=${X3_PARSE} \
-D CMAKE_CXX_FLAGS="${CXXFLAGS} ${ARCH_FLAG}" \ -D CMAKE_CXX_FLAGS="${CXXFLAGS} ${ARCH_FLAG}" \
-D CMAKE_INSTALL_PREFIX=`pwd`/$CXX-prefix \ -D CMAKE_INSTALL_PREFIX=$prefix_dir \
-B $CXX-build \ -B $build_dir \
-S . || exit 1 -S . || exit 1
cmake --build $CXX-build --target install || exit 1 cmake --build $build_dir --target install || exit 1
ctest -VV --test-dir $CXX-build || exit 1 ctest -VV --test-dir $build_dir || exit 1
if [ "${ARCH}" != "32" ] && [ `uname` = "Linux" ] if [ "${ARCH}" != "32" ] && [ `uname` = "Linux" ]; then
then ctest -T memcheck --test-dir $build_dir | tee memcheck.log
ctest -T memcheck --test-dir $CXX-build | tee memcheck.log
ret=${PIPESTATUS[0]} ret=${PIPESTATUS[0]}
if [ $ret -ne 0 ] if [ $ret -ne 0 ]
@ -46,16 +46,15 @@ then
fi fi
fi fi
if [ "${ARCH}" != "32" ] if [ "${ARCH}" != "32" ]; then
then
cd test-install || exit 1 cd test-install || exit 1
mkdir $CXX-build mkdir $build_dir
cmake \ cmake \
-D CMAKE_PREFIX_PATH="`pwd`/../$CXX-prefix;$HOME/boost-prefix" \ -D CMAKE_PREFIX_PATH="$prefix_dir;${HOME}/boost-prefix/${ARCH}" \
-B $CXX-build \ -B $build_dir \
-S . || exit 1 -S . || exit 1
cmake --build $CXX-build --target all || exit 1 cmake --build $build_dir --target all || exit 1
$CXX-build/test-install || exit 1 $build_dir/test-install || exit 1
fi fi

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
mkdir build || exit 1 build_dir="$CXX-build"
mkdir $build_dir || exit 1
if [ "${ARCH}" == "32" ] if [ "${ARCH}" == "32" ]
then then
@ -9,16 +10,16 @@ then
fi fi
cmake \ cmake \
-D CMAKE_PREFIX_PATH="$HOME/boost-prefix;$HOME/zlib-prefix" \ -D CMAKE_PREFIX_PATH="${HOME}/boost-prefix/${ARCH};${HOME}/zlib-prefix/${ARCH}" \
-D MSGPACK_FUZZ_REGRESSION="ON" \ -D MSGPACK_FUZZ_REGRESSION="ON" \
-D ${MSGPACK_CXX_VERSION} \ -D ${MSGPACK_CXX_VERSION} \
-D MSGPACK_CHAR_SIGN=${CHAR_SIGN} \ -D MSGPACK_CHAR_SIGN=${CHAR_SIGN} \
-D MSGPACK_DEFAULT_API_VERSION=${API_VERSION} \ -D MSGPACK_DEFAULT_API_VERSION=${API_VERSION} \
-D MSGPACK_USE_X3_PARSE=${X3_PARSE} \ -D MSGPACK_USE_X3_PARSE=${X3_PARSE} \
-D CMAKE_CXX_FLAGS="${CXXFLAGS}" \ -D CMAKE_CXX_FLAGS="${CXXFLAGS}" \
-B build \ -B $build_dir \
-S . || exit 1 -S . || exit 1
cmake --build . --target all || exit 1 cmake --build $build_dir --target all || exit 1
ctest -VV --test-dir build || exit 1 ctest -VV --test-dir $build_dir || exit 1