Skip to content

Commit a7c8360

Browse files
committed
Compare GCC-8 and GCC-13 coverage
1 parent 1813b73 commit a7c8360

File tree

1 file changed

+188
-15
lines changed

1 file changed

+188
-15
lines changed

.github/workflows/ci.yml

Lines changed: 188 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2020-2021 Peter Dimov
22
# Copyright 2021 Andrey Semashev
3-
# Copyright 2021-2025 Alexander Grund
3+
# Copyright 2021 Alexander Grund
44
# Copyright 2022 James E. King III
55
#
66
# Distributed under the Boost Software License, Version 1.0.
@@ -18,25 +18,198 @@ on:
1818
- bugfix/**
1919
- feature/**
2020
- fix/**
21-
- github/**
2221
- pr/**
23-
paths-ignore:
24-
- LICENSE
25-
- meta/**
26-
- README.md
2722

2823
concurrency:
2924
group: ${{format('{0}:{1}', github.repository, github.ref)}}
3025
cancel-in-progress: true
3126

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+
3236
jobs:
33-
call-boost-ci:
34-
name: Run Boost.CI
35-
uses: boostorg/boost-ci/.github/workflows/reusable.yml@master
36-
with:
37-
branch_coverage: false
38-
secrets:
39-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
40-
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
41-
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
37+
posix:
38+
defaults:
39+
run:
40+
shell: bash
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
# Linux, gcc
47+
- { name: Collect coverage, coverage: yes,
48+
compiler: gcc-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04, install: 'g++-8-multilib', address-model: '32,64' }
49+
- { name: Collect coverage, coverage: yes,
50+
compiler: gcc-13, cxxstd: '11,14,17,2a', os: ubuntu-24.04, install: 'g++-13-multilib', address-model: '32,64' }
51+
52+
timeout-minutes: 120
53+
runs-on: ${{matrix.os}}
54+
container:
55+
image: ${{matrix.container}}
56+
volumes:
57+
- /node20217:/node20217:rw,rshared
58+
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
59+
env: {B2_USE_CCACHE: 1}
60+
61+
steps:
62+
- name: Setup environment
63+
run: |
64+
if [ -f "/etc/debian_version" ]; then
65+
echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV
66+
export DEBIAN_FRONTEND=noninteractive
67+
fi
68+
if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then
69+
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
70+
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl
71+
# Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80
72+
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
73+
for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done
74+
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
75+
osver=$(lsb_release -sr | cut -f1 -d.)
76+
pkgs="g++ git"
77+
# Ubuntu 22+ has only Python 3 in the repos
78+
if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then
79+
pkgs+=" python-is-python3 libpython3-dev"
80+
else
81+
pkgs+=" python libpython-dev"
82+
fi
83+
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs
84+
fi
85+
# For jobs not compatible with ccache, use "ccache: no" in the matrix
86+
if [[ "${{ matrix.ccache }}" == "no" ]]; then
87+
echo "B2_USE_CCACHE=0" >> $GITHUB_ENV
88+
fi
89+
git config --global pack.threads 0
90+
if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then
91+
# Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590
92+
curl -sL https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217
93+
fi
94+
! command -v cmake &> /dev/null || echo "B2_FLAGS=--nowide-enable-cmake" >> $GITHUB_ENV
95+
96+
- uses: actions/checkout@v4
97+
with:
98+
# For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary'
99+
fetch-depth: ${{ matrix.coverage && '0' || '1' }}
100+
101+
- name: Cache ccache
102+
uses: actions/cache@v4
103+
if: env.B2_USE_CCACHE
104+
with:
105+
path: ~/.ccache
106+
key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}}
107+
restore-keys: |
108+
${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-
109+
${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}
110+
111+
- name: Fetch Boost.CI
112+
uses: actions/checkout@v4
113+
with:
114+
repository: boostorg/boost-ci
115+
ref: master
116+
path: boost-ci-cloned
117+
118+
- name: Get CI scripts folder
119+
run: |
120+
# Copy ci folder if not testing Boost.CI
121+
[[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci .
122+
rm -rf boost-ci-cloned
123+
124+
- name: Install packages
125+
if: startsWith(matrix.os, 'ubuntu')
126+
run: |
127+
SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}})
128+
SOURCES=(${{join(matrix.sources, ' ')}})
129+
# Add this by default
130+
SOURCES+=(ppa:ubuntu-toolchain-r/test)
131+
for key in "${SOURCE_KEYS[@]}"; do
132+
for i in {1..$NET_RETRY_COUNT}; do
133+
keyfilename=$(basename -s .key $key)
134+
curl -sSL --retry ${NET_RETRY_COUNT:-5} "$key" | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/${keyfilename} && break || sleep 10
135+
done
136+
done
137+
for source in "${SOURCES[@]}"; do
138+
for i in {1..$NET_RETRY_COUNT}; do
139+
sudo add-apt-repository $source && break || sleep 10
140+
done
141+
done
142+
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
143+
if [[ -z "${{matrix.install}}" ]]; then
144+
pkgs="${{matrix.compiler}}"
145+
pkgs="${pkgs/gcc-/g++-}"
146+
else
147+
pkgs="${{matrix.install}}"
148+
fi
149+
sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs
150+
151+
- name: Setup GCC Toolchain
152+
if: matrix.gcc_toolchain
153+
run: |
154+
GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain"
155+
echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV
156+
if ! command -v dpkg-architecture; then
157+
apt-get install -y dpkg-dev
158+
fi
159+
MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
160+
mkdir -p "$GCC_TOOLCHAIN_ROOT"
161+
ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include"
162+
ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin"
163+
mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET"
164+
ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}"
165+
166+
- name: Setup multiarch
167+
if: matrix.multiarch
168+
run: |
169+
sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static
170+
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
171+
git clone https://github.com/jeking3/bdde.git
172+
echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH}
173+
echo "BDDE_DISTRO=${{ matrix.distro }}" >> ${GITHUB_ENV}
174+
echo "BDDE_EDITION=${{ matrix.edition }}" >> ${GITHUB_ENV}
175+
echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV}
176+
echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV}
177+
178+
- name: Setup Boost
179+
env:
180+
B2_ADDRESS_MODEL: ${{matrix.address-model}}
181+
B2_COMPILER: ${{matrix.compiler}}
182+
B2_CXXSTD: ${{matrix.cxxstd}}
183+
B2_SANITIZE: ${{matrix.sanitize}}
184+
B2_STDLIB: ${{matrix.stdlib}}
185+
run: source ci/github/install.sh
186+
187+
- name: Setup coverage collection
188+
if: matrix.coverage
189+
run: ci/github/codecov.sh "setup"
190+
191+
- name: Run tests
192+
if: '!matrix.coverity'
193+
run: ci/build.sh
194+
195+
- name: Run tests with simulated no LFS support
196+
env:
197+
B2_FLAGS: boost.nowide.lfs=no
198+
run: ci/build.sh
199+
200+
- name: Collect coverage
201+
if: matrix.coverage
202+
run: ci/codecov.sh "upload"
203+
env:
204+
BOOST_CI_CODECOV_IO_UPLOAD: skip
205+
206+
- name: Upload coverage
207+
if: matrix.coverage
208+
uses: codecov/codecov-action@v4
209+
with:
210+
disable_search: true
211+
file: coverage.info
212+
name: Github Actions
213+
token: ${{secrets.CODECOV_TOKEN}}
214+
verbose: true
42215

0 commit comments

Comments
 (0)