Skip to content

Commit 073394c

Browse files
authored
Enhance CI build time
1 parent 25d6f84 commit 073394c

File tree

6 files changed

+152
-118
lines changed

6 files changed

+152
-118
lines changed

.github/depends/boost.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ EOL
1111

1212
build_boost()
1313
{
14-
mkdir $3 || exit 1
1514
./b2 \
16-
-j4 \
1715
--toolset=$1 \
18-
--prefix=$3 \
16+
--prefix=$3/$2 \
1917
--with-test \
2018
--with-headers \
2119
--with-chrono \
@@ -50,6 +48,7 @@ while getopts "b:t:p:" c; do
5048
esac
5149
done
5250

51+
mkdir $prefix || exit 1
5352
wget https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2 || exit 1
5453
tar xf boost_1_76_0.tar.bz2 || exit 1
5554
cd boost_1_76_0

.github/depends/zlib.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ while getopts "b:t:p:" c; do
1515
case "$c" in
1616
b)
1717
bit="$OPTARG"
18-
[ "$bit" != "32" ] && [ "$bit" != "64" ] && usage && exit 1
18+
[ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
1919
;;
2020
p)
2121
prefix="$OPTARG"
@@ -26,15 +26,26 @@ while getopts "b:t:p:" c; do
2626
esac
2727
done
2828

29+
mkdir $prefix || exit 1
2930
wget https://zlib.net/zlib-1.2.11.tar.gz || exit 1
3031
tar -xf zlib-1.2.11.tar.gz || exit 1
3132
cd zlib-1.2.11
3233

33-
mkdir $prefix
34-
cmake \
34+
build()
35+
{
36+
cmake \
3537
-D CMAKE_BUILD_TYPE=Release \
36-
-D CMAKE_INSTALL_PREFIX=$prefix \
37-
-D CMAKE_C_FLAGS="-m${bit}" \
38-
-D CMAKE_SHARED_LINKER_FLAGS="-m${bit}" \
38+
-D CMAKE_INSTALL_PREFIX=$2/$1 \
39+
-D CMAKE_C_FLAGS="-m$1" \
40+
-D CMAKE_SHARED_LINKER_FLAGS="-m$1" \
41+
-B build$1 \
3942
-S .
40-
cmake --build . --target install
43+
cmake --build build$1 --target install
44+
}
45+
46+
if [ "$bit" = "both" ]; then
47+
build 32 $prefix
48+
build 64 $prefix
49+
else
50+
build $bit $prefix
51+
fi

.github/workflows/coverage.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v1
19-
- name: install depends
19+
- name: Install build dependencies
2020
run: |
2121
sudo apt-get update
22-
sudo apt-get install g++-10-multilib lcov -y
22+
sudo apt-get install g++-10 cmake lcov -y
2323
./ci/set_gcc_10.sh
2424
2525
- name: Cache boost
2626
id: cache-boost
2727
uses: actions/cache@v1
2828
with:
2929
path: ~/boost-prefix/
30-
key: ${{ runner.os }}-boost-64-1-76-0-20210613
30+
key: ${{ runner.os }}-boost-64-1-76-0-2021-08-09
3131

3232
- name: Build boost
3333
if: steps.cache-boost.outputs.cache-hit != 'true'
34-
run: ./.github/depends/boost.sh -b 64 -t gcc -p $HOME/boost-prefix/
34+
run: ./.github/depends/boost.sh -b 64 -t gcc -p $HOME/boost-prefix
3535

3636
- name: Cache zlib
3737
id: cache-zlib
3838
uses: actions/cache@v1
3939
with:
4040
path: ~/zlib-prefix/
41-
key: ${{ runner.os }}-zlib-64-1-2-11-20210613
41+
key: ${{ runner.os }}-zlib-64-1-2-11-2021-08-09
4242

4343
- name: Build zlib
4444
if: steps.cache-zlib.outputs.cache-hit != 'true'
45-
run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix/
45+
run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix
4646

4747
- name: Compile tests
4848
run: |
@@ -56,7 +56,7 @@ jobs:
5656
-D MSGPACK_BUILD_TESTS=ON \
5757
-D CMAKE_BUILD_TYPE=Debug \
5858
-D MSGPACK_GEN_COVERAGE=ON \
59-
-D CMAKE_PREFIX_PATH="$HOME/zlib-prefix;$HOME/boost-prefix" \
59+
-D CMAKE_PREFIX_PATH="$HOME/zlib-prefix/64;$HOME/boost-prefix/64" \
6060
-B build \
6161
-S . || exit 1
6262
cmake --build build --target all || exit 1

.github/workflows/gha.yml

Lines changed: 101 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -11,83 +11,79 @@ on:
1111

1212
jobs:
1313
macos:
14-
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) }}
14+
name: ${{ format('macOS (pattern {0})', matrix.pattern) }}
1515
runs-on: macos-latest
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
arch: [64]
20-
cxx: [98, 11, 14, 17, 20]
21-
sanitize: ["no", "undefined"]
22-
api: [1, 2, 3]
23-
char_sign: ["unsigned", "signed"]
24-
x3_parse: ["OFF", "ON"]
19+
pattern: [0, 1, 2, 3, 4]
2520
steps:
26-
- uses: actions/checkout@v1
21+
- uses: actions/checkout@v2
2722

2823
- name: Cache boost
2924
id: cache-boost
30-
uses: actions/cache@v1
25+
uses: actions/cache@v2
3126
with:
3227
path: ~/boost-prefix/
33-
key: ${{ runner.os }}-boost-1-76-0-20210612
28+
key: ${{ runner.os }}-boost-1-76-0-2021-08-09
3429

3530
- name: Build boost
3631
if: steps.cache-boost.outputs.cache-hit != 'true'
37-
run: ./.github/depends/boost.sh -b ${{ matrix.arch }} -t clang -p $HOME/boost-prefix/
32+
run: ./.github/depends/boost.sh -b 64 -t clang -p $HOME/boost-prefix
3833

3934
- name: Cache zlib
4035
id: cache-zlib
41-
uses: actions/cache@v1
36+
uses: actions/cache@v2
4237
with:
4338
path: ~/zlib-prefix/
44-
key: ${{ runner.os }}-zlib-${{ matrix.arch }}-1-2-11-20210623
39+
key: ${{ runner.os }}-zlib-1-2-11-2021-08-09
4540

4641
- name: Build zlib
4742
if: steps.cache-zlib.outputs.cache-hit != 'true'
48-
run: ./.github/depends/zlib.sh -b ${{ matrix.arch }} -p $HOME/zlib-prefix/
43+
run: ./.github/depends/zlib.sh -b 64 -p $HOME/zlib-prefix
4944

5045
- name: Build and test
5146
shell: bash
5247
run: |
53-
if [[ (${{ matrix.cxx }} -eq 98 || ${{ matrix.cxx }} -lt 14) && "${{ matrix.x3_parse }}" == "ON" ]]; then
54-
echo "X3 parse is only supported with C++14 or newer - skip this configuration"
55-
exit 0
56-
fi
57-
58-
export ARCH="${{ matrix.arch }}"
59-
export API_VERSION="${{ matrix.api }}"
60-
export CHAR_SIGN="${{ matrix.char_sign }}"
61-
export X3_PARSE="${{ matrix.x3_parse }}"
62-
63-
if [ "${{ matrix.cxx }}" == "98" ]; then
64-
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
65-
else
66-
export MSGPACK_CXX_VERSION="MSGPACK_CXX${{ matrix.cxx }}=ON"
67-
fi
68-
69-
if [ "${{ matrix.sanitize }}" != "no" ]; then
70-
export SANITIZE="-fsanitize=${{ matrix.sanitize }} -fno-sanitize-recover=all"
71-
fi
48+
# default configuration - overwrite its params later depending on matrix.pattern
49+
export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
50+
export ARCH=64
51+
export API_VERSION=3
52+
export CHAR_SIGN="signed"
53+
export X3_PARSE="OFF"
54+
export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all"
55+
56+
case ${{ matrix.pattern }} in
57+
0)
58+
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
59+
;;
60+
1)
61+
export API_VERSION=1
62+
;;
63+
2)
64+
export API_VERSION=2
65+
;;
66+
3)
67+
export X3_PARSE="ON"
68+
;;
69+
4)
70+
export CHAR_SIGN="unsigned"
71+
;;
72+
esac
7273
7374
# build and test
7475
export CXX="clang++"
75-
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh
76+
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
7677
7778
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
7879
7980
linux:
80-
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) }}
81+
name: ${{ format('Linux (pattern {0})', matrix.pattern) }}
8182
runs-on: ubuntu-20.04
8283
strategy:
8384
fail-fast: false
8485
matrix:
85-
arch: [32, 64]
86-
cxx: [98, 11, 14, 17, 20]
87-
sanitize: ["no", "undefined"]
88-
api: [1, 2, 3]
89-
char_sign: ["unsigned", "signed"]
90-
x3_parse: ["OFF", "ON"]
86+
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
9187
steps:
9288
- uses: actions/checkout@v2
9389

@@ -96,67 +92,95 @@ jobs:
9692
run: |
9793
sudo apt-get update
9894
sudo apt-get install g++-10 cmake valgrind -y
99-
if [ ${{ matrix.arch }} == 32 ]; then
100-
sudo apt-get install g++-10-multilib -y
101-
fi
95+
sudo apt-get install g++-10-multilib -y # for 32-bit compile
10296
./ci/set_gcc_10.sh
10397
10498
- name: Cache boost
10599
id: cache-boost
106-
uses: actions/cache@v1
100+
uses: actions/cache@v2
107101
with:
108102
path: ~/boost-prefix/
109-
key: ${{ runner.os }}-boost-${{ matrix.arch }}-1-76-0-20210613
103+
key: ${{ runner.os }}-boost-1-76-0-2021-08-09
110104

111105
- name: Build boost
112106
if: steps.cache-boost.outputs.cache-hit != 'true'
113-
run: ./.github/depends/boost.sh -b ${{ matrix.arch }} -t gcc -p $HOME/boost-prefix/
107+
run: ./.github/depends/boost.sh -b both -t gcc -p $HOME/boost-prefix
114108

115109
- name: Cache zlib
116110
id: cache-zlib
117-
uses: actions/cache@v1
111+
uses: actions/cache@v2
118112
with:
119113
path: ~/zlib-prefix/
120-
key: ${{ runner.os }}-zlib-${{ matrix.arch }}-1-2-11-20210613
114+
key: ${{ runner.os }}-zlib-1-2-11-2021-08-09
121115

122116
- name: Build zlib
123117
if: steps.cache-zlib.outputs.cache-hit != 'true'
124-
run: ./.github/depends/zlib.sh -b ${{ matrix.arch }} -p $HOME/zlib-prefix/
118+
run: ./.github/depends/zlib.sh -b both -p $HOME/zlib-prefix
125119

126120
- name: Build and test
127121
shell: bash
128122
run: |
129-
if [[ (${{ matrix.cxx }} -eq 98 || ${{ matrix.cxx }} -lt 14) && "${{ matrix.x3_parse }}" == "ON" ]]; then
130-
echo "X3 parse is only supported with C++14 or newer - skip this configuration"
131-
exit 0
132-
fi
133-
134-
export ARCH="${{ matrix.arch }}"
135-
export API_VERSION="${{ matrix.api }}"
136-
export CHAR_SIGN="${{ matrix.char_sign }}"
137-
export X3_PARSE="${{ matrix.x3_parse }}"
138-
139-
if [ "${{ matrix.cxx }}" == "98" ]; then
140-
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
141-
else
142-
export MSGPACK_CXX_VERSION="MSGPACK_CXX${{ matrix.cxx }}=ON"
143-
fi
144-
145-
if [ "${{ matrix.sanitize }}" != "no" ]; then
146-
export SANITIZE="-fsanitize=${{ matrix.sanitize }} -fno-sanitize-recover=all"
147-
fi
123+
# default configuration - overwrite its params later depending on matrix.pattern
124+
export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
125+
export ARCH=64
126+
export API_VERSION=3
127+
export CHAR_SIGN="signed"
128+
export X3_PARSE="OFF"
129+
export SANITIZE="-fsanitize=undefined -fno-sanitize-recover=all"
130+
export ACTION="ci/build_cmake.sh"
131+
132+
case ${{ matrix.pattern }} in
133+
0)
134+
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=OFF"
135+
;;
136+
1)
137+
export MSGPACK_CXX_VERSION="MSGPACK_CXX11=ON"
138+
;;
139+
2)
140+
export MSGPACK_CXX_VERSION="MSGPACK_CXX14=ON"
141+
;;
142+
3)
143+
export MSGPACK_CXX_VERSION="MSGPACK_CXX17=ON"
144+
;;
145+
4)
146+
export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
147+
;;
148+
5)
149+
export ARCH=32
150+
;;
151+
6)
152+
export API_VERSION=2
153+
;;
154+
7)
155+
export API_VERSION=1
156+
;;
157+
8)
158+
export CHAR_SIGN="unsigned"
159+
;;
160+
9)
161+
export X3_PARSE="ON"
162+
;;
163+
10)
164+
export ACTION="ci/build_regression.sh"
165+
;;
166+
11)
167+
export ARCH=32
168+
export CHAR_SIGN="unsigned"
169+
export X3_PARSE="ON"
170+
;;
171+
esac
148172
149173
# build and test
150174
151175
# g++
152176
export CXX="g++-10"
153-
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh
177+
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
154178
155179
# clang++
156180
# with ubsan clang inserts undefined reference to `__mulodi4' on 32-bit build - skip this configuration
157-
if ! [[ "${{ matrix.sanitize }}" == "undefined" && $ARCH -eq 32 ]]; then
181+
if ! [[ $SANITIZE != "" && $ARCH -eq 32 ]]; then
158182
export CXX="clang++-10"
159-
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh
183+
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
160184
fi
161185
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
162186
@@ -169,16 +193,16 @@ jobs:
169193
# MSVC2019 only supports /std:c++14, /std:c++17 and /std:c++latest
170194
cxx: [14, 17, 20]
171195
steps:
172-
- uses: actions/checkout@v1
196+
- uses: actions/checkout@v2
173197

174-
- name: Cache vcpkg
198+
- name: Cache vcpkg dependencies
175199
id: cache-vcpkg
176-
uses: actions/cache@v1.0.3
200+
uses: actions/cache@v2
177201
with:
178202
path: C:/vcpkg/installed/x64-windows
179-
key: ${{ runner.os }}-vcpkg-01072021
203+
key: ${{ runner.os }}-vcpkg-2021-08-09
180204

181-
- name: Build dependencies
205+
- name: Install vcpkg dependencies
182206
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
183207
shell: powershell
184208
run: |

0 commit comments

Comments
 (0)