mirror of
https://github.com/Almamu/linux-wallpaperengine.git
synced 2025-07-14 05:12:25 +08:00
chore: added catch2 + github actions for testing
This commit is contained in:
parent
be0fc25e72
commit
9f0bdd50e2
10
.github/workflows/cmake.yml
vendored
10
.github/workflows/cmake.yml
vendored
@ -1,18 +1,16 @@
|
||||
name: CMake
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: [tests]
|
||||
branches: [main]
|
||||
types: [completed]
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'CMakeModules/**'
|
||||
- CMakeLists.txt
|
||||
- 'protocols/**'
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'CMakeModules/**'
|
||||
- CMakeLists.txt
|
||||
- 'protocols/**'
|
||||
branches: [ "main" ]
|
||||
|
||||
|
51
.github/workflows/tests.yml
vendored
Normal file
51
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
name: Unit tests
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'CMakeModules/**'
|
||||
- CMakeLists.txt
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
paths:
|
||||
- 'src/**'
|
||||
- 'CMakeModules/**'
|
||||
- CMakeLists.txt
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
testing:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-24.04]
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Install dependencies
|
||||
if: matrix.os == 'ubuntu-24.04'
|
||||
run: sudo apt-get update && sudo apt-get -y install libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libfftw3-dev
|
||||
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=On
|
||||
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- name: Run tests
|
||||
# Run the unit tests available
|
||||
run: ${{github.workspace}}/build/output/tests
|
4
.gitmodules
vendored
4
.gitmodules
vendored
@ -26,3 +26,7 @@
|
||||
path = src/External/argparse
|
||||
url = https://github.com/p-ranav/argparse.git
|
||||
branch = master
|
||||
[submodule "src/External/Catch2"]
|
||||
path = src/External/Catch2
|
||||
url = https://github.com/catchorg/Catch2.git
|
||||
branch = devel
|
@ -116,6 +116,7 @@ add_subdirectory(src/External/glslang-WallpaperEngine glslang)
|
||||
add_subdirectory(src/External/SPIRV-Cross-WallpaperEngine spirv-cross)
|
||||
add_subdirectory(src/External/kissfft kissfft)
|
||||
add_subdirectory(src/External/argparse argparse)
|
||||
add_subdirectory(src/External/Catch2)
|
||||
|
||||
# try to enable wayland builds when possible
|
||||
pkg_check_modules(WAYLAND_SUPPORT wayland-cursor wayland-protocols egl wayland-egl)
|
||||
@ -247,6 +248,13 @@ include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${X11_INCLUDES})
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_executable(
|
||||
tests
|
||||
src/WallpaperEngine/Testing/Cases/Example.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_executable(
|
||||
linux-wallpaperengine
|
||||
src/main.cpp
|
||||
@ -535,6 +543,30 @@ target_link_libraries (linux-wallpaperengine PUBLIC
|
||||
libcef_dll_wrapper
|
||||
argparse)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
target_link_libraries (tests PRIVATE
|
||||
Catch2::Catch2WithMain PUBLIC
|
||||
${OPENGL_LIBRARIES}
|
||||
${GLEW_LIBRARIES}
|
||||
${GLUT_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${LZ4_LIBRARY}
|
||||
${SDL2_LIBRARIES}
|
||||
${FFMPEG_LIBRARIES}
|
||||
${MPV_LIBRARY}
|
||||
${PULSEAUDIO_LIBRARY}
|
||||
${WAYLAND_LIBRARIES}
|
||||
${X11_LIBRARIES}
|
||||
kissfft
|
||||
glslang
|
||||
spirv-cross-core
|
||||
spirv-cross-glsl
|
||||
glfw
|
||||
libcef_lib
|
||||
libcef_dll_wrapper
|
||||
argparse)
|
||||
endif()
|
||||
|
||||
COPY_FILES(linux-wallpaperengine "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
|
||||
COPY_FILES(linux-wallpaperengine "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${TARGET_OUTPUT_DIRECTORY}")
|
||||
# remove the vulkan lib as chromium includes a broken libvulkan.so.1 with it
|
||||
|
1
src/External/Catch2
vendored
Submodule
1
src/External/Catch2
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 74fcff6e5b190fb833a231b7f7c1829e3c3ac54d
|
5
src/WallpaperEngine/Testing/Cases/Example.cpp
Normal file
5
src/WallpaperEngine/Testing/Cases/Example.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
TEST_CASE ("Example test") {
|
||||
REQUIRE (true);
|
||||
}
|
Loading…
Reference in New Issue
Block a user