-
-
Notifications
You must be signed in to change notification settings - Fork 50
175 lines (165 loc) · 6.24 KB
/
ci_tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Copyright 2019 - 2024 Alexander Grund
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
name: CI Tests
on:
pull_request:
push:
branches:
- master
- develop
- bugfix/**
- feature/**
- fix/**
- pr/**
concurrency:
group: ${{format('ci_tests{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
env:
GIT_FETCH_JOBS: 8
NET_RETRY_COUNT: 5
B2_CI_VERSION: 1
jobs:
NativeCMakeBuild:
defaults:
run:
shell: bash
strategy:
matrix:
os: [ubuntu-22.04, windows-2019]
buildType: [Debug, Release]
standalone: [Boost, Standalone]
shared_lib: [ON, OFF]
generator: ['Visual Studio 16 2019', 'MinGW Makefiles', 'Unix Makefiles']
exclude:
- os: ubuntu-22.04
generator: MinGW Makefiles
- os: ubuntu-22.04
generator: Visual Studio 16 2019
- os: ubuntu-22.04
buildType: Debug
runs-on: ${{matrix.os}}
env:
DEP_DIR: ${{github.workspace}}/dependencies
BOOST_VERSION: 1.56.0
steps:
- uses: actions/checkout@v4
- name: Sanity check version
run: grep -E 'set\(_version [0-9]' CMakeLists.txt
- uses: actions/cache@v4
id: cache-boost
with:
path: ${{env.DEP_DIR}}
key: ${{matrix.os}}-${{matrix.generator}}-${{env.BOOST_VERSION}}
# Install newer CMake to be able to find Boost
- name: Install CMake
if: runner.os == 'Linux' && matrix.standalone == 'Boost'
run: wget -qO- https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz | sudo tar --strip-components=1 -xzC /usr/local
- name: Set BOOST_ROOT
if: matrix.standalone == 'Boost'
run: echo "BOOST_ROOT=${DEP_DIR//\\/\/}/boost_${BOOST_VERSION//./_}" >> $GITHUB_ENV
# Install Boost
- uses: actions/checkout@v4
if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true'
with:
repository: boostorg/boost
ref: boost-${{env.BOOST_VERSION}}
path: __buildBoost
fetch-depth: 1
- name: Build Boost
if: matrix.standalone == 'Boost' && steps.cache-boost.outputs.cache-hit != 'true'
run: |
cd __buildBoost
git submodule update --init --jobs 3 tools/boostdep libs/filesystem tools/inspect libs/wave # Last 2 are required for pre-1.64
(cd tools/boostdep && git fetch && git checkout boost-1.73.0 && git checkout boost-1.63.0 -- depinst/exceptions.txt)
python tools/boostdep/depinst/depinst.py --include tools --exclude test --git_args '--jobs 3' filesystem
[[ "${{matrix.os}}" =~ "windows" ]] && toolset=mingw || toolset=gcc
./bootstrap.sh --with-toolset="$toolset" --with-libraries=system,filesystem threading=multi || (cat bootstrap.log && false)
sed -i 's/mingw/gcc/' project-config.jam
[[ "${{matrix.generator}}" =~ "Visual Studio" ]] && toolset=msvc-14.0 || toolset=gcc
./b2 headers
./b2 link=static toolset=$toolset address-model=64 -j$(nproc) --prefix="$BOOST_ROOT" install
cd ..
rm -r __buildBoost || true
- name: Create standalone
if: matrix.standalone == 'Standalone'
run: |
bash tools/create_standalone.sh "$PWD/../nowide_standalone"
rm -rf *
cp -r ../nowide_standalone/* .
mkdir build
- name: Configure
working-directory: build
run: |
extraFlags="-DBoost_DEBUG=ON -DBoost_NO_BOOST_CMAKE=ON -DCMAKE_INSTALL_PREFIX=~/.local"
if ! [[ "${{matrix.generator}}" =~ "Visual Studio" ]]; then
# Enable warning to find missing defines, especially important for the standalone version
extraFlags="$extraFlags -DCMAKE_CXX_FLAGS=-Wundef"
fi
cmake -DCMAKE_BUILD_TYPE=${{matrix.buildType}} -DBUILD_SHARED_LIBS=${{matrix.shared_lib}} -G "${{matrix.generator}}" $extraFlags ..
- name: Build
run: cmake --build build --config ${{matrix.buildType}} --target tests
# Run test with both bash and powershell and watch for "Using std::cin" on bash but not on powershell
- name: Test
working-directory: build
run: ctest --output-on-failure -C ${{matrix.buildType}} --verbose
- name: Test on PowerShell
working-directory: build
shell: powershell
if: runner.os == 'Windows'
run: ctest --output-on-failure -C ${{matrix.buildType}} --verbose
- name: Install
run: cmake --build build --config ${{matrix.buildType}} --target install
- name: Test consumption
working-directory: build
run: |
rm -r *
cmake -DBOOST_NOWIDE_INSTALL_TEST=ON -DBoost_ARCHITECTURE=-x64 -DCMAKE_PREFIX_PATH=~/.local -G "${{matrix.generator}}" ../test/cmake_test
cmake --build . --config ${{matrix.buildType}}
ctest --output-on-failure -C ${{matrix.buildType}}
CreateDocuTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create documentation
run: |
sudo apt-get install -y doxygen
bash doc/gendoc.sh
CreateBoostDocuTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch Boost.CI
uses: actions/checkout@v4
with:
repository: boostorg/boost-ci
ref: master
path: boost-ci-cloned
- name: Get CI scripts folder
run: cp -r boost-ci-cloned/ci . && rm -rf boost-ci-cloned
- name: Setup Boost
run: source ci/github/install.sh
- name: Create documentation
run: |
sudo apt-get install -y doxygen
B2_TARGETS=libs/$SELF/doc ci/build.sh
CheckFormatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DoozyX/clang-format-lint-action@v0.11
with:
exclude: './doc'
clangFormatVersion: 10
- name: Check line endings
run: |
if grep -r -l $'\r' --exclude-dir="\.git" --exclude-dir="html"; then
echo "Found files windows style line endings (CRLF). Please fix!"
exit 1
fi
- name: Check for tabs
run: |
if grep -r -l $'\t' --exclude-dir="\.git" --exclude-dir="html"; then
echo "Found files with TABs. Please fix!"
exit 1
fi