mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Run tests in CI (#2310)
This commit is contained in:
parent
0e66b17ff0
commit
75b1ef06e2
2 changed files with 91 additions and 3 deletions
85
.github/workflows/test.yml
vendored
Normal file
85
.github/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
---
|
||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- '*.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-20.04]
|
||||||
|
fail-fast: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Cache Qt
|
||||||
|
id: cache-qt
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ../Qt
|
||||||
|
key: ${{ runner.os }}-QtCache-20201005
|
||||||
|
|
||||||
|
# LINUX
|
||||||
|
- name: Install p7zip (Ubuntu)
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: sudo apt-get update && sudo apt-get -y install p7zip-full
|
||||||
|
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2
|
||||||
|
with:
|
||||||
|
# mirror: 'http://mirrors.ocf.berkeley.edu/qt/'
|
||||||
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||||
|
extra: --external 7z
|
||||||
|
|
||||||
|
# LINUX
|
||||||
|
- name: Install dependencies (Ubuntu)
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install \
|
||||||
|
cmake \
|
||||||
|
rapidjson-dev \
|
||||||
|
libssl-dev \
|
||||||
|
libboost-dev \
|
||||||
|
libboost-system-dev \
|
||||||
|
libboost-filesystem-dev \
|
||||||
|
libpulse-dev \
|
||||||
|
libxkbcommon-x11-0 \
|
||||||
|
libgstreamer-plugins-base1.0-0 \
|
||||||
|
build-essential \
|
||||||
|
libgl1-mesa-dev \
|
||||||
|
libxcb-icccm4 \
|
||||||
|
libxcb-image0 \
|
||||||
|
libxcb-keysyms1 \
|
||||||
|
libxcb-render-util0 \
|
||||||
|
libxcb-xinerama0 \
|
||||||
|
libgtest-dev
|
||||||
|
|
||||||
|
- name: Create build directory (Ubuntu)
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
mkdir build-test
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build (Ubuntu)
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
cmake -DBUILD_TESTS=On ..
|
||||||
|
cmake --build .
|
||||||
|
working-directory: build-test
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Test (Ubuntu)
|
||||||
|
if: startsWith(matrix.os, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
ctest
|
||||||
|
working-directory: build-test
|
||||||
|
shell: bash
|
|
@ -4,8 +4,6 @@ project(chatterino)
|
||||||
|
|
||||||
include_directories(src)
|
include_directories(src)
|
||||||
|
|
||||||
add_subdirectory(lib/settings)
|
|
||||||
|
|
||||||
set(chatterino_SOURCES
|
set(chatterino_SOURCES
|
||||||
src/common/NetworkRequest.cpp
|
src/common/NetworkRequest.cpp
|
||||||
src/common/NetworkResult.cpp
|
src/common/NetworkResult.cpp
|
||||||
|
@ -34,6 +32,7 @@ set(CMAKE_AUTOMOC ON)
|
||||||
# set(CMAKE_AUTOMOC ON)
|
# set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
if (BUILD_TESTS)
|
if (BUILD_TESTS)
|
||||||
|
set(BUILD_TESTS OFF)
|
||||||
message("++ Tests enabled")
|
message("++ Tests enabled")
|
||||||
find_package(GTest)
|
find_package(GTest)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
@ -53,10 +52,14 @@ if (BUILD_TESTS)
|
||||||
|
|
||||||
target_link_libraries(chatterino-test gtest gtest_main)
|
target_link_libraries(chatterino-test gtest gtest_main)
|
||||||
|
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/settings)
|
||||||
target_link_libraries(chatterino-test PajladaSettings)
|
target_link_libraries(chatterino-test PajladaSettings)
|
||||||
target_include_directories(chatterino-test PUBLIC PajladaSettings)
|
target_include_directories(chatterino-test PUBLIC PajladaSettings)
|
||||||
|
|
||||||
set(BUILD_TESTS OFF)
|
find_package(Threads)
|
||||||
|
|
||||||
|
target_link_libraries(chatterino-test Threads::Threads)
|
||||||
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/serialize PajladaSerialize)
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/lib/serialize PajladaSerialize)
|
||||||
|
|
||||||
target_link_libraries(chatterino-test PajladaSerialize)
|
target_link_libraries(chatterino-test PajladaSerialize)
|
||||||
|
|
Loading…
Reference in a new issue