Implement ci

This commit is contained in:
CommanderRedYT
2025-05-12 18:20:31 +02:00
committed by Ferdinand Bachmann
parent 6389462ce3
commit 718ce9b26a

76
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,76 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build-and-test-cpp-unix:
strategy:
matrix:
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
cpp_standard: [c++11, c++14, c++17, c++20]
compiler: [gcc, clang]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v2
- name: Setup build
run:
cmake -DRING_BUFFER_BUILD_TESTS=ON -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_STANDARD=${{ matrix.cpp_standard }} \
-DCMAKE_CXX_COMPILER=$([[ ${{ matrix.compiler }} == "gcc" ]] && echo "g++" || echo "clang++") \
-DCMAKE_C_COMPILER=$([[ ${{ matrix.compiler }} == "gcc" ]] && echo "gcc" || echo "clang") \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic"
- name: Build
run: cmake --build build --config Debug
- name: Run tests
run: |
find build/test -type f -executable -name 'test-*' -exec sh -c 'echo "Running test: $1"; $1' _ {} \;
build-and-test-c99-unix:
strategy:
matrix:
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
compiler: [gcc, clang]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v2
- name: Setup build
run:
cmake -DRING_BUFFER_BUILD_TESTS=ON -S . -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_STANDARD=99 \
-DCMAKE_C_COMPILER=$([[ ${{ matrix.compiler }} == "gcc" ]] && echo "gcc" || echo "clang") \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" \
-DCMAKE_C_FLAGS="-Wall -Wextra -Wpedantic"
- name: Build
run: cmake --build build --config Debug
- name: Run tests
run: |
# search for all executables in build/test/test-*
find build/test -type f -executable -name 'test-*' -exec sh -c 'echo "Running test: $1"; $1' _ {} \;