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.
This commit is contained in:
Alastair Robertson 2023-02-01 10:03:42 -08:00 committed by Alastair Robertson
parent 8956ca5522
commit b00958378b

View File

@ -1,22 +1,41 @@
version: 2.1 version: 2.1
workflows: workflows:
build-test: object-introspection:
jobs: jobs:
- lint - lint
- build-test:
name: build-test-gcc - build:
name: build-gcc
cc: /usr/bin/gcc cc: /usr/bin/gcc
cxx: /usr/bin/g++ cxx: /usr/bin/g++
- build-test: - test:
name: build-test-clang name: test-gcc
requires:
- build-gcc
- build:
name: build-clang
cc: /usr/bin/clang-12 cc: /usr/bin/clang-12
cxx: /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: jobs:
lint: lint:
docker: executor: ubuntu-docker
- image: ubuntu:jammy
steps: steps:
- run: - run:
name: Install dependencies name: Install dependencies
@ -42,10 +61,9 @@ jobs:
black --check --diff test/ black --check --diff test/
isort --check --diff test/ isort --check --diff test/
build-test: build:
machine: # TODO this job could be run in Docker
image: ubuntu-2204:2022.10.2 executor: big-boy
resource_class: 2xlarge
parameters: parameters:
cc: cc:
type: string type: string
@ -55,11 +73,9 @@ jobs:
CC: << parameters.cc >> CC: << parameters.cc >>
CXX: << parameters.cxx >> CXX: << parameters.cxx >>
steps: steps:
- checkout
- run: - run:
name: Install dependencies name: Install dependencies
command: | command: |
sudo rm -f /etc/apt/sources.list.d/heroku.list
sudo apt-get update sudo apt-get update
sudo apt-get install -y \ sudo apt-get install -y \
bison \ bison \
@ -90,13 +106,34 @@ jobs:
pip3 install toml pip3 install toml
environment: environment:
DEBIAN_FRONTEND: noninteractive DEBIAN_FRONTEND: noninteractive
- checkout
- run: - run:
name: Build name: Build
command: | command: |
cmake -G Ninja -B build/ -DWITH_TESTS=On cmake -G Ninja -B build/ -DWITH_TESTS=On
cmake --build build/ -j 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: - run:
name: Test name: Test
environment: environment:
@ -104,7 +141,6 @@ jobs:
OMP_NUM_THREADS: 1 OMP_NUM_THREADS: 1
command: | command: |
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
cp test/ci.oid.toml build/testing.oid.toml
ctest --test-dir build/test/ --test-action Test -j$(nproc) \ ctest --test-dir build/test/ --test-action Test -j$(nproc) \
--no-compress-output --output-on-failure \ --no-compress-output --output-on-failure \
--exclude-regex 'TestTypes\/ComparativeTest\..*' \ --exclude-regex 'TestTypes\/ComparativeTest\..*' \