Skip to content

Commit

Permalink
Switch to Github Actions for CI builds (#599)
Browse files Browse the repository at this point in the history
* Use Github Actions for CI
* Incorporate coverage into os_test target
* CMake: Make 'test' an alias for 'os_test'
* Coverage in all clang builds
  • Loading branch information
ferdnyc committed Dec 12, 2020
1 parent 141e1da commit ed5b2e2
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 145 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,60 @@
name: CI Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
compiler: [gcc, clang]
env:
CC: ${{ matrix.compiler }}
steps:
- uses: actions/checkout@v2

- uses: haya14busa/action-cond@v1
id: coverage
with:
cond: ${{ matrix.compiler == 'clang' }}
if_true: "-DENABLE_COVERAGE:BOOL=1"
if_false: "-DENABLE_COVERAGE:BOOL=0"

- name: Install dependencies
shell: bash
run: |
sudo add-apt-repository ppa:openshot.developers/libopenshot-daily
sudo apt update
sudo apt install cmake swig doxygen graphviz curl lcov
sudo apt install libopenshot-audio-dev
sudo apt install qtbase5-dev qtbase5-dev-tools
sudo apt install libfdk-aac-dev libavcodec-dev libavformat-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libpostproc-dev libswresample-dev
sudo apt install libzmq3-dev libmagick++-dev libunittest++-dev
- name: Build libopenshot
shell: bash
run: |
mkdir build
pushd build
cmake -B . -S .. -DCMAKE_INSTALL_PREFIX:PATH="dist" -DCMAKE_BUILD_TYPE="Debug" "${{ steps.coverage.outputs.value }}"
cmake --build . -- VERBOSE=1
popd
- name: Test libopenshot
shell: bash
run: |
pushd build
cmake --build . --target os_test -- VERBOSE=1
popd
- name: Install libopenshot
shell: bash
run: |
pushd build
cmake --build . --target install -- VERBOSE=1
popd
- uses: codecov/codecov-action@v1
if: ${{ matrix.compiler == 'clang' }}
with:
file: build/coverage.info

122 changes: 0 additions & 122 deletions .travis.yml

This file was deleted.

38 changes: 32 additions & 6 deletions CMakeLists.txt
Expand Up @@ -180,14 +180,40 @@ if (ENABLE_COVERAGE)
NAME coverage
LCOV_ARGS "--no-external"
EXECUTABLE openshot-test
DEPENDENCIES openshot-test
EXCLUDE "bindings" "examples" "${CMAKE_CURRENT_BINARY_DIR}/bindings"
DEPENDENCIES openshot openshot-test
EXCLUDE
"bindings/*"
"examples/*"
"${CMAKE_CURRENT_BINARY_DIR}/bindings/*"
"${CMAKE_CURRENT_BINARY_DIR}/src/*_autogen/*"
)
message("Generate coverage report with 'make coverage'")
if(NOT TARGET os_test)
add_custom_target(os_test)
add_dependencies(os_test coverage)
endif()
endif()

# Also hook up 'test' as an alias for the 'os_test' target, if possible
# This requires CMake 3.11+, where the CMP0037 policy
# configured to 'NEW' mode will not reserve target names
# unless the corresponding feature is actually used
if (POLICY CMP0037)
cmake_policy(SET CMP0037 NEW)
endif()
if(TARGET os_test)
if (CMAKE_VERSION VERSION_GREATER 3.11)
message(STATUS "Cmake 3.11+ detected, enabling 'test' target")
add_custom_target(test)
add_dependencies(test os_test)
set(TEST_TARGET_NAME "test")
else()
set(TEST_TARGET_NAME "os_test")
endif()
add_feature_info("Testrunner" ENABLE_TESTS "Run unit tests with 'make ${TEST_TARGET_NAME}'")
endif()

########### PRINT FEATURE SUMMARY ##############
feature_summary(WHAT ALL
INCLUDE_QUIET_PACKAGES
FATAL_ON_MISSING_REQUIRED_PACKAGES
DESCRIPTION "Displaying feature summary\n\nBuild configuration:")
INCLUDE_QUIET_PACKAGES
FATAL_ON_MISSING_REQUIRED_PACKAGES
DESCRIPTION "Displaying feature summary\n\nBuild configuration:")
22 changes: 5 additions & 17 deletions tests/CMakeLists.txt
Expand Up @@ -87,21 +87,9 @@ add_executable(openshot-test
target_link_libraries(openshot-test openshot ${UnitTest++_LIBRARIES})

##### RUNNING TESTS (make os_test / make test) #####
# Hook up the 'make os_test' target to the 'openshot-test' executable
add_custom_target(os_test COMMAND openshot-test)

# Also hook up 'make test', if possible
# This requires CMake 3.11+, where the CMP0037 policy
# configured to 'NEW' mode will not reserve target names
# unless the corresponding feature is actually used
if (POLICY CMP0037)
cmake_policy(SET CMP0037 NEW)
endif()
if (CMAKE_VERSION VERSION_GREATER 3.11)
message(STATUS "Cmake 3.11+ detected, enabling 'test' target")
add_custom_target(test COMMAND openshot-test)
set(TEST_TARGET_NAME "test")
else()
set(TEST_TARGET_NAME "os_test")
# Hook up the 'make os_test' target to the 'openshot-test' executable,
# if we aren't defining it as the coverage target
if(NOT ENABLE_COVERAGE)
add_custom_target(os_test COMMAND openshot-test)
endif()
add_feature_info("Testrunner" ENABLE_TESTS "Run unit tests with 'make ${TEST_TARGET_NAME}'")

0 comments on commit ed5b2e2

Please sign in to comment.