Skip to content

Commit 8be1a0f

Browse files
committed
Add GitHub Action for C++ tests
1 parent 7e19ee9 commit 8be1a0f

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: C++ tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest , macos-latest]
13+
defaults:
14+
run:
15+
shell: bash -l {0}
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install dependencies
21+
run: |
22+
git clone https://github.com/catchorg/Catch2.git
23+
cd Catch2
24+
git checkout "v3.4.0"
25+
mkdir build && cd build
26+
cmake .. -DBUILD_TESTING=Off
27+
make -j $(nproc)
28+
sudo make install
29+
30+
- name: Configure
31+
run: |
32+
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_MEX=False
33+
34+
- name: Build
35+
run: |
36+
cmake --build build
37+
38+
- name: Run tests
39+
run: |
40+
cd build/tests
41+
ctest -C Release --output-on-failure --verbose

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,16 @@ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -Og -Wall -Wextra")
1919
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -Wextra")
2020
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-O3 -Wall -Wextra")
2121

22-
add_subdirectory("mex")
23-
add_subdirectory("tests")
22+
if(NOT DEFINED BUILD_MEX)
23+
set(BUILD_MEX true)
24+
endif()
25+
if (BUILD_MEX)
26+
add_subdirectory("mex")
27+
endif()
28+
29+
if(NOT DEFINED BUILD_TESTS)
30+
set(BUILD_TESTS true)
31+
endif()
32+
if (BUILD_TESTS)
33+
add_subdirectory("tests")
34+
endif()

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Matrix–matrix multiply using integer Ozaki scheme
22

3+
[![Testing](https://github.com/north-numerical-computing/gemmi/actions/workflows/run_cpp_tests.yml/badge.svg?branch=main)](https://github.com/north-numerical-computing/gemmi/actions/workflows/run_cpp_tests.yml)
4+
35
## Dependencies
46

57
The recommended system to build this project is `CMake`. Compilation of the C++ example requires a g++ compiler that supports the C++20 standard. In order to build the MEX interface, MATLAB should be installed and available on the search path.

0 commit comments

Comments
 (0)