Skip to content

Commit

Permalink
Enable CTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Sep 23, 2024
1 parent e3f6a59 commit c3a2636
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and test on multiple platforms

on: [push,pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release, Debug]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
- os: ubuntu-latest
c_compiler: clang
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl

steps:
- uses: actions/checkout@v4

- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest -C ${{ matrix.build_type }}
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ ENDIF()
ADD_SUBDIRECTORY (atomic_sync)
ADD_SUBDIRECTORY (examples)
ADD_SUBDIRECTORY (test)

ENABLE_TESTING()
ADD_TEST (atomic_sync ${CMAKE_BINARY_DIR}/test/test_atomic_sync)
ADD_TEST (atomic_condition ${CMAKE_BINARY_DIR}/test/test_atomic_condition)
ADD_TEST (mutex ${CMAKE_BINARY_DIR}/test/test_mutex 4 10000)
ADD_TEST (native_mutex ${CMAKE_BINARY_DIR}/test/test_native_mutex 4 10000)

0 comments on commit c3a2636

Please sign in to comment.