Skip to content

Commit

Permalink
Add c++ tests to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
markkohdev committed Aug 19, 2024
1 parent 598e9e6 commit fd2780c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
46 changes: 41 additions & 5 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,54 @@ jobs:
# TODO: Switch back to macos-latest once https://github.com/actions/python-versions/pull/114 is fixed
os:
- 'ubuntu-latest'
# TODO: Fix failing CMake build on windows:
# `cl : command line error D8016: '/O2' and '/RTC1' command-line options are incompatible [D:\a\voyager\voyager\cpp\test\test.vcxproj]`
- windows-latest
- macos-12
name: Test C++ on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y pkg-config
- name: Build voyager locally
run: make test
- name: Set up CMake on Windows
if: matrix.os == 'windows-latest'
run: |
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'
choco install ninja
- name: Set up CMake on macOS
if: matrix.os == 'macos-12'
run: brew install cmake

- name: Set up CMake on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install -y cmake

- name: Configure CMake
run: cmake -S . -B build

- name: Build with CMake
run: cmake --build build

- name: Run Tests (if any)
run: ctest --test-dir build
# - name: Run CMake (Linux & MacOS)
# if: runner.os != 'Windows'
# uses: threeal/[email protected]
# with:
# source-dir: cpp
# build-dir: cpp
# - name: Run CMake (Windows)
# if: runner.os == 'Windows'
# uses: threeal/[email protected]
# with:
# source-dir: cpp
# build-dir: cpp
# cxx-flags: /Od # Disable optimization (since it breaks CMake on Windows)
# - name: Build C++
# run: make test
# - name: Run tests
# run: ./test/test

build-python-wheels:
needs: [run-python-tests, run-python-tests-with-address-sanitizer]
Expand Down
4 changes: 4 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ set(CMAKE_CXX_STANDARD 17)
set(LLVM_CXX_STD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /0d")
endif()

add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(test)
Expand Down
2 changes: 1 addition & 1 deletion cpp/test/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_CASE("Test combinations of different instantiations and sizes") {
testCombination(index, spaceType, numDimensions, storageType);
} else if (storageType == StorageDataType::E4M3) {
auto index = TypedIndex<float, E4M3>(spaceType, numDimensions);
testCombination(index, spaceType, 20, storageType);
testCombination(index, spaceType, numDimensions, storageType);
}
}
}
Expand Down

0 comments on commit fd2780c

Please sign in to comment.