object-introspection/.circleci/config.yml
Alastair Robertson 5971643101 Pass in CodeCov.io token through CI env var
CodeCov's docs say that a token isn't required for a public repository,
but our uploads have been broken for a few weeks at this point and
passing in the token fixes them...
2023-04-21 14:42:15 +01:00

208 lines
5.9 KiB
YAML

version: 2.1
workflows:
object-introspection:
jobs:
- lint
- build:
name: build-gcc
cc: /usr/bin/gcc
cxx: /usr/bin/g++
- test:
name: test-gcc
requires:
- build-gcc
- coverage:
requires:
- test-gcc
- build:
name: build-clang
cc: /usr/bin/clang-12
cxx: /usr/bin/clang++-12
- test:
name: test-clang
requires:
- build-clang
executors:
ubuntu-docker:
docker:
- image: ubuntu:jammy
resource_class: small
big-boy:
machine:
image: ubuntu-2204:2022.10.2
resource_class: 2xlarge
jobs:
lint:
executor: ubuntu-docker
steps:
- run:
name: Install dependencies
command: |
apt-get update
apt-get install -y \
clang-format \
git \
python3-pip
# click broke semver with 8.1.0, causing issues for black
pip install click==8.0.0 black isort
- checkout
- run:
name: clang-format
command: |
git ls-files '*.cpp' '*.h' | xargs clang-format --fallback-style=Google -i
git ls-files '*.py' | xargs black
git ls-files '*.py' | xargs isort
git diff --exit-code
- run:
name: python linting
command: |
black --check --diff test/
isort --check --diff test/
build:
# TODO this job could be run in Docker
executor: big-boy
parameters:
cc:
type: string
cxx:
type: string
environment:
CC: << parameters.cc >>
CXX: << parameters.cxx >>
working_directory:
/tmp/object-introspection
steps:
- run:
name: Install dependencies
command: |
sudo apt-get update
sudo apt-get install -y \
bison \
build-essential \
clang-12 \
cmake \
flex \
gawk \
libboost-all-dev \
libbz2-dev \
libcap2-bin \
libclang-12-dev \
libcurl4-gnutls-dev \
libdouble-conversion-dev \
libdw-dev \
libfmt-dev \
libgflags-dev \
libgmock-dev \
libgoogle-glog-dev \
libgtest-dev \
libjemalloc-dev \
libmsgpack-dev \
libzstd-dev \
llvm-12-dev \
ninja-build \
pkg-config \
python3-setuptools
pip3 install toml
environment:
DEBIAN_FRONTEND: noninteractive
- checkout
- run:
name: Build
command: |
cmake -G Ninja -B build/ -DWITH_FLAKY_TESTS=Off -DCODE_COVERAGE=On
cmake --build build/
# Testing rubbish:
cp test/ci.oid.toml build/testing.oid.toml
- persist_to_workspace:
root: .
paths:
- build/*
- extern/*
- types/*
test:
executor: big-boy
working_directory:
/tmp/object-introspection
steps:
- attach_workspace:
at: .
- run:
name: Install dependencies
command: |
sudo apt-get update
sudo apt-get install -y \
clang-12 \
libboost-all-dev \
libgflags-dev \
llvm-12-dev \
libfmt-dev \
libjemalloc-dev
- run:
name: Test
environment:
# disable drgn multithreading as tests are already run in parallel
OMP_NUM_THREADS: 1
command: |
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
ctest --test-dir build/test/ --test-action Test -j 16 \
--no-compress-output --output-on-failure \
--schedule-random --timeout 60 \
--output-junit results.xml
- store_test_results:
path: build/test/results.xml
- persist_to_workspace:
# Save code coverage data
root: .
paths:
- build/*
coverage:
executor: ubuntu-docker
working_directory:
/tmp/object-introspection
steps:
- run:
name: Install dependencies
command: |
apt-get update
apt-get install -y \
curl \
git \
gpg \
lcov
- checkout
- attach_workspace:
at: .
- run:
name: Code Coverage
when: always
command: |
lcov --directory . --capture --rc lcov_branch_coverage=1 --output-file coverage.info
lcov --extract coverage.info '/tmp/object-introspection/src/*' '/tmp/object-introspection/include/*' --rc lcov_branch_coverage=1 --output-file coverage.info
lcov --list --rc lcov_branch_coverage=1 coverage.info
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
shasum -a 256 -c codecov.SHA256SUM
chmod +x codecov
# It appears that codecov wants to scan through all directories
# other than "build", looking for files to upload, even if we
# specify a file name on the command line.
#
# "extern" is huge and makes uploading the coverage report take
# forever. Delete it for a speedup.
rm -rf extern
./codecov -Z -f coverage.info -t $CODECOV_TOKEN