|
| 1 | +# |
1 | 2 | # Copyright 2020-2021 Peter Dimov |
2 | 3 | # Copyright 2021 Andrey Semashev |
3 | | -# Copyright 2021 Alexander Grund |
4 | | -# Copyright 2022 James E. King III |
5 | | -# Copyright 2023 Matt Borland |
| 4 | +# Copyright 2021-2024 Alexander Grund |
| 5 | +# Copyright 2022-2025 James E. King III |
6 | 6 | # |
7 | 7 | # Distributed under the Boost Software License, Version 1.0. |
8 | 8 | # (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) |
| 9 | +# |
| 10 | +# This workflow uses the Boost.CI reusable workflow which builds a variety of |
| 11 | +# configurations of your project, runs tests, and generates code coverage reports. |
| 12 | +# |
| 13 | +# To use it, copy this file into your repository as `.github/workflows/ci.yml` and |
| 14 | +# customize it appropriately. |
| 15 | +# |
9 | 16 | --- |
10 | | -name: CI |
| 17 | +name: Boost.CI |
11 | 18 |
|
12 | 19 | on: |
13 | 20 | pull_request: |
|
18 | 25 | - bugfix/** |
19 | 26 | - feature/** |
20 | 27 | - fix/** |
| 28 | + - github/** |
21 | 29 | - pr/** |
22 | | - |
23 | | -concurrency: |
24 | | - group: ${{format('{0}:{1}', github.repository, github.ref)}} |
25 | | - cancel-in-progress: true |
26 | | - |
27 | | -env: |
28 | | - GIT_FETCH_JOBS: 8 |
29 | | - NET_RETRY_COUNT: 5 |
30 | | - B2_CI_VERSION: 1 |
31 | | - B2_VARIANT: debug,release |
32 | | - B2_LINK: shared,static |
33 | | - LCOV_BRANCH_COVERAGE: 0 |
34 | | - CODECOV_NAME: Github Actions |
35 | | - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true |
| 30 | + paths-ignore: |
| 31 | + - LICENSE |
| 32 | + - meta/** |
| 33 | + - README.md |
36 | 34 |
|
37 | 35 | jobs: |
38 | | - posix: |
39 | | - defaults: |
40 | | - run: |
41 | | - shell: bash |
42 | | - |
43 | | - strategy: |
44 | | - fail-fast: false |
45 | | - matrix: |
46 | | - include: |
47 | | - # Linux, gcc |
48 | | - - { compiler: gcc-5, cxxstd: '03,11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' } |
49 | | - - { compiler: gcc-6, cxxstd: '03,11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } |
50 | | - - { compiler: gcc-7, cxxstd: '03,11,14,17', os: ubuntu-20.04 } |
51 | | - - { compiler: gcc-8, cxxstd: '03,11,14,17,2a', os: ubuntu-20.04 } |
52 | | - - { compiler: gcc-9, cxxstd: '03,11,14,17,2a', os: ubuntu-20.04 } |
53 | | - - { compiler: gcc-10, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } |
54 | | - - { compiler: gcc-11, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } |
55 | | - - { compiler: gcc-12, cxxstd: '03,11,14,17,20', os: ubuntu-22.04 } |
56 | | - - { name: GCC w/ sanitizers, sanitize: yes, |
57 | | - compiler: gcc-12, cxxstd: '03,11,14,17,20', os: ubuntu-22.04 } |
58 | | - #- { name: Collect coverage, coverage: yes, |
59 | | - # compiler: gcc-8, cxxstd: '03,11', os: ubuntu-20.04, install: 'g++-8-multilib', address-model: '32,64' } |
60 | | - |
61 | | - # Linux, clang |
62 | | - - { compiler: clang-5.0, cxxstd: '03,11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' } |
63 | | - - { compiler: clang-6.0, cxxstd: '03,11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } |
64 | | - - { compiler: clang-7, cxxstd: '03,11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } |
65 | | - # Note: clang-8 does not fully support C++20, so it is not compatible with some libstdc++ versions in this mode |
66 | | - - { compiler: clang-8, cxxstd: '03,11,14,17,2a', os: ubuntu-22.04, container: 'ubuntu:18.04', install: 'clang-8 g++-7', gcc_toolchain: 7 } |
67 | | - - { compiler: clang-9, cxxstd: '03,11,14,17,2a', os: ubuntu-20.04 } |
68 | | - - { compiler: clang-10, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } |
69 | | - - { compiler: clang-11, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } |
70 | | - - { compiler: clang-12, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } |
71 | | - # Clang isn't compatible with libstdc++-13, so use the slightly older one |
72 | | - - { compiler: clang-13, cxxstd: '03,11,14,17,20', os: ubuntu-22.04, install: 'clang-13 g++-12', gcc_toolchain: 12 } |
73 | | - - { compiler: clang-14, cxxstd: '03,11,14,17,20', os: ubuntu-22.04, install: 'clang-14 g++-12', gcc_toolchain: 12 } |
74 | | - - { compiler: clang-15, cxxstd: '03,11,14,17,20', os: ubuntu-22.04, install: 'clang-15 g++-12', gcc_toolchain: 12 } |
75 | | - - { compiler: clang-16, cxxstd: '11,14,17,20,2b', os: ubuntu-latest, container: 'ubuntu:23.04' } |
76 | | - - { compiler: clang-17, cxxstd: '11,14,17,20,2b', os: ubuntu-latest, container: 'ubuntu:23.10' } |
77 | | - |
78 | | - # libc++ |
79 | | - - { compiler: clang-6.0, cxxstd: '03,11,14', os: ubuntu-22.04, container: 'ubuntu:18.04', stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } |
80 | | - - { compiler: clang-12, cxxstd: '03,11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } |
81 | | - - { name: Clang w/ sanitizers, sanitize: yes, |
82 | | - compiler: clang-12, cxxstd: '03,11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } |
83 | | - |
84 | | - # OSX, clang |
85 | | - - { compiler: clang, cxxstd: '03,11,14,17,20', os: macos-12 } |
86 | | - - { name: MacOS w/ clang and sanitizers, |
87 | | - compiler: clang, cxxstd: '03,11,14,17,20,2b', os: macos-13, sanitize: yes } |
88 | | - |
89 | | - timeout-minutes: 120 |
90 | | - runs-on: ${{matrix.os}} |
91 | | - container: ${{matrix.container}} |
92 | | - env: {B2_USE_CCACHE: 1} |
93 | | - |
94 | | - steps: |
95 | | - - name: Setup environment |
96 | | - run: | |
97 | | - if [ -f "/etc/debian_version" ]; then |
98 | | - echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV |
99 | | - export DEBIAN_FRONTEND=noninteractive |
100 | | - fi |
101 | | - if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then |
102 | | - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update |
103 | | - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl |
104 | | - # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 |
105 | | - curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg |
106 | | - for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done |
107 | | - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update |
108 | | - osver=$(lsb_release -sr | cut -f1 -d.) |
109 | | - pkgs="g++ git" |
110 | | - # Ubuntu 22+ has only Python 3 in the repos |
111 | | - if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then |
112 | | - pkgs+=" python-is-python3 libpython3-dev" |
113 | | - else |
114 | | - pkgs+=" python libpython-dev" |
115 | | - fi |
116 | | - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs |
117 | | - fi |
118 | | - # For jobs not compatible with ccache, use "ccache: no" in the matrix |
119 | | - if [[ "${{ matrix.ccache }}" == "no" ]]; then |
120 | | - echo "B2_USE_CCACHE=0" >> $GITHUB_ENV |
121 | | - fi |
122 | | - git config --global pack.threads 0 |
123 | | -
|
124 | | - - uses: actions/checkout@v3 |
125 | | - with: |
126 | | - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' |
127 | | - fetch-depth: ${{ matrix.coverage && '0' || '1' }} |
128 | | - |
129 | | - - name: Cache ccache |
130 | | - uses: actions/cache@v3 |
131 | | - if: env.B2_USE_CCACHE |
132 | | - with: |
133 | | - path: ~/.ccache |
134 | | - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} |
135 | | - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- |
136 | | - |
137 | | - - name: Fetch Boost.CI |
138 | | - uses: actions/checkout@v3 |
139 | | - with: |
140 | | - repository: boostorg/boost-ci |
141 | | - ref: master |
142 | | - path: boost-ci-cloned |
143 | | - |
144 | | - - name: Get CI scripts folder |
145 | | - run: | |
146 | | - # Copy ci folder if not testing Boost.CI |
147 | | - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . |
148 | | - rm -rf boost-ci-cloned |
149 | | -
|
150 | | - - name: Install packages |
151 | | - if: startsWith(matrix.os, 'ubuntu') |
152 | | - run: | |
153 | | - SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) |
154 | | - SOURCES=(${{join(matrix.sources, ' ')}}) |
155 | | - # Add this by default |
156 | | - SOURCES+=(ppa:ubuntu-toolchain-r/test) |
157 | | - for key in "${SOURCE_KEYS[@]}"; do |
158 | | - for i in {1..$NET_RETRY_COUNT}; do |
159 | | - keyfilename=$(basename -s .key $key) |
160 | | - curl -sSL --retry ${NET_RETRY_COUNT:-5} "$key" | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/${keyfilename} && break || sleep 10 |
161 | | - done |
162 | | - done |
163 | | - for source in "${SOURCES[@]}"; do |
164 | | - for i in {1..$NET_RETRY_COUNT}; do |
165 | | - sudo add-apt-repository $source && break || sleep 10 |
166 | | - done |
167 | | - done |
168 | | - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update |
169 | | - if [[ -z "${{matrix.install}}" ]]; then |
170 | | - pkgs="${{matrix.compiler}}" |
171 | | - pkgs="${pkgs/gcc-/g++-}" |
172 | | - else |
173 | | - pkgs="${{matrix.install}}" |
174 | | - fi |
175 | | - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs |
176 | | -
|
177 | | - - name: Setup GCC Toolchain |
178 | | - if: matrix.gcc_toolchain |
179 | | - run: | |
180 | | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" |
181 | | - echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV |
182 | | - if ! command -v dpkg-architecture; then |
183 | | - apt-get install -y dpkg-dev |
184 | | - fi |
185 | | - MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" |
186 | | - mkdir -p "$GCC_TOOLCHAIN_ROOT" |
187 | | - ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" |
188 | | - ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" |
189 | | - mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" |
190 | | - ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" |
191 | | -
|
192 | | - - name: Setup Boost |
193 | | - env: |
194 | | - B2_ADDRESS_MODEL: ${{matrix.address-model}} |
195 | | - B2_COMPILER: ${{matrix.compiler}} |
196 | | - B2_CXXSTD: ${{matrix.cxxstd}} |
197 | | - B2_SANITIZE: ${{matrix.sanitize}} |
198 | | - B2_STDLIB: ${{matrix.stdlib}} |
199 | | - # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. |
200 | | - # B2_DEFINES: ${{matrix.defines}} |
201 | | - # Variables set here (to non-empty) will override the top-level environment variables, e.g. |
202 | | - # B2_VARIANT: ${{matrix.variant}} |
203 | | - # Set the (B2) target(s) to build, defaults to the test folder of the current library |
204 | | - # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` |
205 | | - # B2_TARGETS: libs/foo/test//bar |
206 | | - run: source ci/github/install.sh |
207 | | - |
208 | | - #- name: Setup coverage collection |
209 | | - # if: matrix.coverage |
210 | | - # run: ci/github/codecov.sh "setup" |
211 | | - |
212 | | - - name: Run tests |
213 | | - if: '!matrix.coverity' |
214 | | - run: ci/build.sh |
215 | | - |
216 | | - #- name: Upload coverage |
217 | | - # if: matrix.coverage |
218 | | - # run: ci/codecov.sh "upload" |
219 | | - |
220 | | - windows: |
221 | | - defaults: |
222 | | - run: |
223 | | - shell: cmd |
224 | | - strategy: |
225 | | - fail-fast: false |
226 | | - matrix: |
227 | | - include: |
228 | | - - { toolset: msvc-14.2, cxxstd: '14,17,20', addrmd: '32,64', os: windows-2019 } |
229 | | - - { toolset: msvc-14.3, cxxstd: '14,17,20,latest',addrmd: '32,64', os: windows-2022 } |
230 | | - #- { name: Collect coverage, coverage: yes, |
231 | | - # toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 } |
232 | | - - { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 } |
233 | | - #- { toolset: gcc, cxxstd: '03,11,14,17,2a', addrmd: '64', os: windows-2019 } |
234 | | - |
235 | | - runs-on: ${{matrix.os}} |
236 | | - |
237 | | - steps: |
238 | | - - uses: actions/checkout@v3 |
239 | | - |
240 | | - - name: Fetch Boost.CI |
241 | | - uses: actions/checkout@v3 |
242 | | - with: |
243 | | - repository: boostorg/boost-ci |
244 | | - ref: master |
245 | | - path: boost-ci-cloned |
246 | | - - name: Get CI scripts folder |
247 | | - run: | |
248 | | - REM Copy ci folder if not testing Boost.CI |
249 | | - if "%GITHUB_REPOSITORY%" == "%GITHUB_REPOSITORY:boost-ci=%" xcopy /s /e /q /i /y boost-ci-cloned\ci .\ci |
250 | | - rmdir /s /q boost-ci-cloned |
251 | | -
|
252 | | - - name: Setup Boost |
253 | | - run: ci\github\install.bat |
254 | | - |
255 | | - - name: Run tests |
256 | | - if: '!matrix.coverage' |
257 | | - run: ci\build.bat |
258 | | - env: |
259 | | - B2_TOOLSET: ${{matrix.toolset}} |
260 | | - B2_CXXSTD: ${{matrix.cxxstd}} |
261 | | - B2_ADDRESS_MODEL: ${{matrix.addrmd}} |
262 | | - |
263 | | - MSYS2: |
264 | | - defaults: |
265 | | - run: |
266 | | - shell: msys2 {0} |
267 | | - strategy: |
268 | | - fail-fast: false |
269 | | - matrix: |
270 | | - include: |
271 | | - # - { sys: MINGW32, compiler: gcc, cxxstd: '03,11,17,20' } |
272 | | - - { sys: MINGW64, compiler: gcc, cxxstd: '03,11,17,20' } |
273 | | - |
274 | | - runs-on: windows-latest |
275 | | - |
276 | | - steps: |
277 | | - - uses: actions/checkout@v3 |
278 | | - |
279 | | - - name: Setup MSYS2 environment |
280 | | - uses: msys2/setup-msys2@v2 |
281 | | - with: |
282 | | - msystem: ${{matrix.sys}} |
283 | | - update: true |
284 | | - install: git python |
285 | | - pacboy: gcc:p cmake:p ninja:p |
286 | | - |
287 | | - - name: Fetch Boost.CI |
288 | | - uses: actions/checkout@v3 |
289 | | - with: |
290 | | - repository: boostorg/boost-ci |
291 | | - ref: master |
292 | | - path: boost-ci-cloned |
293 | | - - name: Get CI scripts folder |
294 | | - run: | |
295 | | - # Copy ci folder if not testing Boost.CI |
296 | | - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . |
297 | | - rm -rf boost-ci-cloned |
298 | | -
|
299 | | - - name: Setup Boost |
300 | | - env: |
301 | | - B2_COMPILER: ${{matrix.compiler}} |
302 | | - B2_CXXSTD: ${{matrix.cxxstd}} |
303 | | - B2_SANITIZE: ${{matrix.sanitize}} |
304 | | - B2_STDLIB: ${{matrix.stdlib}} |
305 | | - run: ci/github/install.sh |
306 | | - |
307 | | - - name: Run tests |
308 | | - run: ci/build.sh |
| 36 | + call-boost-ci: |
| 37 | + name: Run Boost.CI |
| 38 | + uses: boostorg/boost-ci/.github/workflows/reusable.yml@master |
| 39 | + # Example of customization: |
| 40 | + # with: |
| 41 | + # enable_reflection: true |
| 42 | + # enable_windows: false |
| 43 | + with: |
| 44 | + exclude_compiler: 'icpx-2025' # Invalid commands errors |
| 45 | + exclude_cxxstd: '2b' # Clang-16 + 2b has issues with libstdc++ compat |
| 46 | + enable_cmake: false |
| 47 | + enable_cygwin : false |
| 48 | + enable_multiarch: false |
| 49 | + secrets: |
| 50 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments