Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: CI

on:
push:
branches:
- master
- ci
pull_request:

env:
PRE_COMMAND: |
git clone https://github.com/livepeer/mbedtls --branch dtls_srtp_support --depth 1
cd mbedtls
mkdir build
cd build
cmake .. -DENABLE_TESTING=Off
make install
jobs:
# Regular C build with two compilers, using the environment:
build_using_compiler_in_environment:
strategy:
matrix:
compiler:
- [clang, clang++]
- [gcc, g++]
runs-on: ubuntu-latest
# We can use cmakeflags for this, or we can just use
# regular environment variables, as they are already
# supported by github actions:
env:
CC: ${{ matrix.compiler[0] }}
CXX: ${{ matrix.compiler[1] }}
steps:
- uses: actions/checkout@v2
- uses: docker://lpenz/ghaction-cmake:0.18
with:
dependencies_debian: libsrtp2-dev
pre_command: ${{ env.PRE_COMMAND }}

# Static analyzers:
linters:
strategy:
matrix:
preset:
- cppcheck
- clang-tidy
- iwyu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://lpenz/ghaction-cmake:0.18
with:
preset: ${{ matrix.preset }}
# Dont fail on iwyu warnings
test_command: 'true'
dependencies_debian: libsrtp2-dev
pre_command: ${{ env.PRE_COMMAND }}
# Tests with various sanitizers and valgrind:
test:
strategy:
matrix:
preset:
# Commented out presets are failing
- clang-sanitize-address
- clang-sanitize-thread
# clang-sanitize-memory fails in ./sourcery
- clang-sanitize-undefined
# clang-sanitize-dataflow rejected as detected as cross-compiling
- clang-sanitize-safe-stack
- valgrind
- install
# cpack CPack generator not specified
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker://lpenz/ghaction-cmake:0.18
with:
preset: ${{ matrix.preset }}
dependencies_debian: libsrtp2-dev
pre_command: ${{ env.PRE_COMMAND }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ rules.ninja
.cache
aes_ctr128
/embed/testing
*test
CMakeDoxyfile.in
RelAccXSampler

71 changes: 22 additions & 49 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,29 +338,7 @@ endif()
########################################
# MistLib - Local Header Install #
########################################
if (${CMAKE_VERSION} VERSION_LESS 3.3.0)
add_custom_command(OUTPUT ${BINARY_DIR}/mist/.headers
COMMAND ${CMAKE_COMMAND}
ARGS -E make_directory ${BINARY_DIR}/mist
COMMAND cp
ARGS ${libHeaders} ${BINARY_DIR}/mist
COMMAND touch
ARGS ${BINARY_DIR}/mist/.headers
WORKING_DIRECTORY ${SOURCE_DIR}
DEPENDS ${libHeaders}
)
else()
add_custom_command(OUTPUT ${BINARY_DIR}/mist/.headers
COMMAND ${CMAKE_COMMAND}
ARGS -E make_directory ${BINARY_DIR}/mist
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${libHeaders} ${BINARY_DIR}/mist
COMMAND ${CMAKE_COMMAND}
ARGS -E touch ${BINARY_DIR}/mist/.headers
WORKING_DIRECTORY ${SOURCE_DIR}
DEPENDS ${libHeaders}
)
endif()
file(COPY ${libHeaders} DESTINATION ${BINARY_DIR}/mist)

########################################
# MistServer - Analysers #
Expand All @@ -370,7 +348,6 @@ macro(makeAnalyser analyserName format)
src/analysers/mist_analyse.cpp
src/analysers/analyser.cpp
src/analysers/analyser_${format}.cpp
${BINARY_DIR}/mist/.headers
)
set_target_properties(MistAnalyser${analyserName}
PROPERTIES COMPILE_DEFINITIONS "ANALYSERHEADER=\"analyser_${format}.h\"; ANALYSERTYPE=Analyser${analyserName}"
Expand Down Expand Up @@ -404,7 +381,6 @@ makeAnalyser(RTSP rtsp) #LTS
macro(makeUtil utilName utilFile)
add_executable(MistUtil${utilName}
src/utils/util_${utilFile}.cpp
${BINARY_DIR}/mist/.headers
)
target_link_libraries(MistUtil${utilName}
mist
Expand All @@ -429,7 +405,6 @@ endif()

add_executable(MistTranslateH264
src/analysers/h264_translate.cpp
${BINARY_DIR}/mist/.headers
)
target_link_libraries(MistTranslateH264
mist
Expand All @@ -444,7 +419,6 @@ macro(makeInput inputName format)
src/input/input.cpp
src/input/input_${format}.cpp
src/io.cpp
${BINARY_DIR}/mist/.headers
)
if (";${ARGN};" MATCHES ";with_srt;")
target_link_libraries(MistIn${inputName} mist_srt )
Expand Down Expand Up @@ -521,7 +495,6 @@ macro(makeOutput outputName format)
${httpOutput}
${tsOutput}
${mp4Output}
${BINARY_DIR}/mist/.headers
)
set_target_properties(MistOut${outputName}
PROPERTIES COMPILE_DEFINITIONS "OUTPUTTYPE=\"output_${format}.h\";TS_BASECLASS=${tsBaseClass}"
Expand Down Expand Up @@ -564,7 +537,6 @@ makeOutput(RTSP rtsp)#LTS
makeOutput(WAV wav)#LTS

add_executable(MistProcFFMPEG
${BINARY_DIR}/mist/.headers
src/process/process_ffmpeg.cpp
src/output/output_ebml.cpp
src/input/input_ebml.cpp
Expand All @@ -576,7 +548,6 @@ add_executable(MistProcFFMPEG
target_link_libraries(MistProcFFMPEG mist)

add_executable(MistProcMKVExec
${BINARY_DIR}/mist/.headers
src/process/process_exec.cpp
src/output/output_ebml.cpp
src/input/input_ebml.cpp
Expand All @@ -588,7 +559,6 @@ add_executable(MistProcMKVExec
target_link_libraries(MistProcMKVExec mist)

add_executable(MistProcLivepeer
${BINARY_DIR}/mist/.headers
src/process/process_livepeer.cpp
src/input/input.cpp
src/output/output_http.cpp
Expand All @@ -609,7 +579,6 @@ if (WITH_SANITY)
endif()

add_executable(MistOutHTTP
${BINARY_DIR}/mist/.headers
src/output/mist_out.cpp
src/output/output.cpp
src/output/output_http.cpp
Expand Down Expand Up @@ -694,7 +663,6 @@ endif()
########################################
add_executable(RelAccXSampler
src/relaccxsampler.cpp
${BINARY_DIR}/mist/.headers
)
target_link_libraries(RelAccXSampler
mist
Expand Down Expand Up @@ -844,7 +812,6 @@ add_executable(MistController
src/controller/controller_api.cpp
src/controller/controller_push.cpp
generated/server.html.h
${BINARY_DIR}/mist/.headers
)
set_target_properties(MistController
PROPERTIES COMPILE_DEFINITIONS RELEASE=${RELEASE}
Expand All @@ -856,6 +823,8 @@ install(
TARGETS MistController
DESTINATION bin
)
# Needed to make parallel builds work well
add_dependencies(MistOutHTTP MistController)

########################################
# Make Clean #
Expand All @@ -875,28 +844,32 @@ add_custom_target(clean-all
########################################
# Tests #
########################################
add_executable(urltest test/url.cpp ${BINARY_DIR}/mist/.headers)
add_executable(urltest test/url.cpp)
target_link_libraries(urltest mist)
add_test(URLTest COMMAND urltest)
add_executable(logtest test/log.cpp ${BINARY_DIR}/mist/.headers)
add_executable(logtest test/log.cpp)
target_link_libraries(logtest mist)
add_test(LOGTest COMMAND logtest)
add_executable(downloadertest test/downloader.cpp ${BINARY_DIR}/mist/.headers)
add_executable(downloadertest test/downloader.cpp)
target_link_libraries(downloadertest mist)
add_test(DownloaderTest COMMAND downloadertest)
add_executable(urireadertest test/urireader.cpp ${BINARY_DIR}/mist/.headers)
add_executable(urireadertest test/urireader.cpp)
target_link_libraries(urireadertest mist)
add_test(URIReaderTest COMMAND urireadertest)
add_executable(jsontest test/json.cpp ${BINARY_DIR}/mist/.headers)
add_test(URIReaderTest urireadertest)
add_executable(jsontest test/json.cpp)
target_link_libraries(jsontest mist)
add_test(JSONTest COMMAND jsontest)
add_executable(resolvetest test/resolve.cpp ${BINARY_DIR}/mist/.headers)
add_executable(resolvetest test/resolve.cpp)
target_link_libraries(resolvetest mist)
add_executable(bitwritertest test/bitwriter.cpp ${BINARY_DIR}/mist/.headers)
add_executable(bitwritertest test/bitwriter.cpp)
target_link_libraries(bitwritertest mist)
add_test(BitWriterTest COMMAND bitwritertest)
add_executable(streamstatustest test/status.cpp ${BINARY_DIR}/mist/.headers)
add_test(BitWriterTest bitwritertest)
add_executable(streamstatustest test/status.cpp)
target_link_libraries(streamstatustest mist)
add_executable(websockettest test/websocket.cpp ${BINARY_DIR}/mist/.headers)
add_executable(websockettest test/websocket.cpp)
target_link_libraries(websockettest mist)

# logtest & jsontest hangs
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was curious. The CI isnt very effective if most of the tests are not working.

Are these tests working for other people?

Should we create issues about these tests?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most test binaries were made to allow scripted batch testing (and thus operate on stdin/stdout). @stronk-dev did some work last year on these scripts - it may be worthwhile to dig that work up again and see how much test coverage it all provides. 🤔

#add_test(LOGTest logtest)
#add_test(JSONTest jsontest)

# these tests fail
#add_test(URLTest urltest)
#add_test(DownloaderTest downloadertest)
#add_test(WebSocketTest websockettest)