object-introspection/.circleci/config.yml
Alastair Robertson b00958378b CI: Split build and test into separate jobs
This will give us more flexibility later, e.g. allowing different steps
for GCC and Clang (as needed for code coverage), or letting us
parallelise our tests across multiple machines.
2023-02-02 14:21:41 +00:00

151 lines
3.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
- 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 >>
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_TESTS=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
steps:
- attach_workspace:
at: .
- run:
name: Install dependencies
command: |
sudo apt-get update
sudo apt-get install -y \
clang-12 \
libgflags-dev \
llvm-12-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$(nproc) \
--no-compress-output --output-on-failure \
--exclude-regex 'TestTypes\/ComparativeTest\..*' \
--schedule-random --timeout 30 --repeat until-pass:2 \
--output-junit results.xml
- store_test_results:
path: build/test/results.xml