Skip to content

CI: add pipeline

CI: add pipeline #2

Workflow file for this run

name: Build & Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [g++, clang++]
build_type: [Debug, Release]
env:
BUILD_DIR: build
CMAKE_FLAGS: -GNinja -DENABLE_TESTING=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
steps:
- name: Checkout code
uses: actions/checkout@v4.0.0
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build ${{ matrix.compiler }} libgtest-dev
- name: Cache build
uses: actions/cache@v3
with:
path: ${{ env.BUILD_DIR }}
key: ${{ runner.os }}-build-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.compiler }}-
- name: Configure CMake
run: cmake -S . -B ${{ env.BUILD_DIR }} ${{ env.CMAKE_FLAGS }}
- name: Build
run: cmake --build ${{ env.BUILD_DIR }}
- name: Run tests
run: ctest --test-dir ${{ env.BUILD_DIR }} --output-on-failure
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ matrix.compiler }}-${{ matrix.build_type }}
path: ${{ env.BUILD_DIR }}