mirror of
https://github.com/Ferdi265/cxx-ring-buffer.git
synced 2025-07-29 23:27:15 +02:00
Implement ci
This commit is contained in:
76
.github/workflows/ci.yml
vendored
Normal file
76
.github/workflows/ci.yml
vendored
Normal 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' _ {} \;
|
Reference in New Issue
Block a user