Skip to content

Commit

Permalink
Add Github Actions CI
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed Nov 23, 2024
1 parent 2fa3e06 commit 0bac1b6
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 9 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
name: Build CI
on: [push] # yamllint disable-line rule:truthy
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows MSVC",
enabled: 1,
os: windows-latest,
deps: "",
config: "cmake
-B build
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
-DWERROR=1
-DCMAKE_BUILD_TYPE=Debug
",
build: "cmake --build build --config Debug",
# all tests work except "performance" (liblo bug?)
# this weird regex lets all those tests run, except performance
test: "ctest --output-on-failure --test-dir build -R '(i|s|t|g)'"
}
- {
name: "Ubuntu gcc",
enabled: 1,
os: ubuntu-latest,
deps: "sudo apt-get install liblo-dev",
config: "cd build && cmake -DWERROR=1 ..",
build: "cd build && make",
test: "cd build && ctest --output-on-failure"
}
- {
name: "Ubuntu clang+lld",
enabled: 1,
os: ubuntu-latest,
deps: "sudo apt-get install liblo-dev",
config: "cd build &&
cmake
-DWERROR=1
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_SHARED_LINKER_FLAGS='-fuse-ld=lld'
-DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld'
..",
build: "cd build && make",
test: "cd build && ctest --output-on-failure"
}
- {
name: "Ubuntu mingw32",
enabled: 1,
os: ubuntu-latest,
deps: "sudo apt-get install liblo-dev mingw-w64",
config: "cd build &&
cmake
-DWERROR=1
CC=i686-w64-mingw32-gcc-win32
CXX=i686-w64-mingw32-g++-win32
..",
build: "cd build && make",
test: "cd build && ctest --output-on-failure"
}
- {
name: "Ubuntu mingw64",
enabled: 1,
os: ubuntu-latest,
deps: "sudo apt-get install liblo-dev mingw-w64",
config: "cd build &&
cmake
-DWERROR=1
CC=x86_64-w64-mingw32-gcc-win32
CXX=x86_64-w64-mingw32-g++-win32
..",
build: "cd build && make",
test: "cd build && ctest --output-on-failure"
}
- {
name: "macOS clang",
enabled: 1,
os: macos-latest,
deps: "brew install liblo",
config: "cd build && cmake -DWERROR=1 ..",
build: "cd build && make",
test: "cd build && ctest --output-on-failure"
}
steps:
- name: check out
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install deps
if: ${{ matrix.config.enabled == 1 }}
run: ${{ matrix.config.deps }}
- name: create build directory
if: ${{ matrix.config.enabled == 1 }}
run: mkdir build
- name: configure
if: ${{ matrix.config.enabled == 1 }}
run: ${{ matrix.config.config }}
- name: make
if: ${{ matrix.config.enabled == 1 }}
run: ${{ matrix.config.build }}
- name: make test
if: ${{ matrix.config.enabled == 1 }}
run: ${{ matrix.config.test }}
13 changes: 13 additions & 0 deletions .github/workflows/yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: Build CI
on: [push] # yamllint disable-line rule:truthy
jobs:
yamllint:
name: yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yamllint-this
run: yamllint -s .github/workflows/yaml.yml
- name: yamllint-ccpp
run: yamllint -s .github/workflows/ccpp.yml
43 changes: 34 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ set(VERSION_MAJOR 0)
set(VERSION_MINOR 3)
set(VERSION_PATCH 1)

SET(CMAKE_CXX_STANDARD 17)

#Find Packages

find_package(Doxygen)
Expand All @@ -25,11 +27,18 @@ else()
set(GUI_FOUND FALSE)
endif(FLTK_FOUND)

if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
if(MSVC)
find_package(liblo)
if(liblo_FOUND)
set(LIBLO_FOUND TRUE)
endif()
else()
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(JACK jack)
pkg_check_modules(LIBLO liblo>=0.28)
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "Windows"))
pkg_check_modules(JACK jack)
endif()
endif()
endif()

Expand Down Expand Up @@ -167,6 +176,11 @@ macro(maketestcpp fname)
target_link_libraries(${fname} PRIVATE rtosc-cpp rtosc)
#add_test(memcheck_${fname} valgrind --leak-check=full --show-reachable=yes --error-exitcode=1 ./${fname})
endmacro(maketestcpp)
if(PKG_CONFIG_FOUND)
set(RTOSC_LIBLO_LIBRARIES "${LIBLO_LIBRARIES}")
else()
set(RTOSC_LIBLO_LIBRARIES "liblo::liblo")
endif()

maketest(rtosc-time)
maketest(osc-spec)
Expand All @@ -182,7 +196,8 @@ maketest(test-arg-iter)
if(LIBLO_FOUND)
maketest(liblo)
target_include_directories(liblo PRIVATE ${LIBLO_INCLUDE_DIRS})
target_link_libraries(liblo PRIVATE ${LIBLO_LDFLAGS})
target_link_libraries(liblo PRIVATE ${RTOSC_LIBLO_LIBRARIES})
target_link_directories(liblo PRIVATE ${LIBLO_LIBRARY_DIRS})
endif()

maketestcpp(version)
Expand All @@ -202,8 +217,10 @@ maketestcpp(path-search)

maketestcpp(performance)
if(LIBLO_FOUND)
target_link_libraries(performance PRIVATE ${LIBLO_LDFLAGS})
target_include_directories(performance PRIVATE ${LIBLO_INCLUDE_DIRS})
target_compile_definitions(performance PRIVATE HAVE_LIBLO)
target_link_libraries(performance PRIVATE ${RTOSC_LIBLO_LIBRARIES})
target_link_directories(performance PRIVATE ${LIBLO_LIBRARY_DIRS})
endif()

maketestcpp(undo-test)
Expand All @@ -219,18 +236,26 @@ maketestcpp(test-automation)

if(LIBLO_FOUND)
add_library(lo-server test/liblo-server.cpp)
target_include_directories(lo-server PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(lo-server PRIVATE ${LIBLO_LDFLAGS} rtosc-cpp rtosc)
target_include_directories(lo-server PRIVATE ${LIBLO_INCLUDE_DIRS})
target_include_directories(lo-server PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(lo-server PRIVATE ${RTOSC_LIBLO_LIBRARIES})
target_link_directories(performance PRIVATE ${LIBLO_LIBRARY_DIRS})
set(RTOSC_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test CACHE INTERNAL "")
set(RTOSC_TEST_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
endif()
if(LIBLO_FOUND AND RUBY_FOUND)
add_executable(port-checker test/port-checker-main.cpp)
target_link_libraries(port-checker PRIVATE lo-server rtosc-cpp rtosc ${LIBLO_LDFLAGS})
target_include_directories(port-checker PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(port-checker PRIVATE lo-server rtosc-cpp rtosc ${RTOSC_LIBLO_LIBRARIES})
target_link_directories(port-checker PRIVATE ${LIBLO_LIBRARY_DIRS})
add_executable(port-checker-tester test/port-checker-tester.cpp)
target_link_libraries(port-checker-tester PRIVATE lo-server rtosc-cpp rtosc ${LIBLO_LDFLAGS})
target_include_directories(port-checker-tester PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(port-checker-tester PRIVATE lo-server rtosc-cpp rtosc ${RTOSC_LIBLO_LIBRARIES})
target_link_directories(port-checker-tester PRIVATE ${LIBLO_LIBRARY_DIRS})
add_executable(port-checker-testapp test/port-checker-testapp.cpp)
target_link_libraries(port-checker-testapp PRIVATE rtosc-cpp rtosc ${LIBLO_LDFLAGS})
target_include_directories(port-checker-testapp PRIVATE ${LIBLO_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/include)
target_link_libraries(port-checker-testapp PRIVATE rtosc-cpp rtosc ${RTOSC_LIBLO_LIBRARIES})
target_link_directories(port-checker-testapp PRIVATE ${LIBLO_LIBRARY_DIRS})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test/test-port-checker.rb
${CMAKE_CURRENT_BINARY_DIR}/test-port-checker.rb COPYONLY)
add_test(test-port-checker test-port-checker.rb)
Expand Down
6 changes: 6 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": [
"liblo"
]
}

0 comments on commit 0bac1b6

Please sign in to comment.