Add coverage build and CI (#311)

* add coverage build and CI

* fix project files

* upload to codecov

Co-authored-by: scatterflower <marisa@scatterflower.online>
This commit is contained in:
scatterflower 2022-07-07 09:48:42 -05:00 committed by GitHub
parent 03ee9337d2
commit f4fd19f02d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 61 additions and 1 deletions

View File

@ -52,7 +52,7 @@ jobs:
run: |
cd ${{github.workspace}}/bin_tests/
for test in ./unittest_*; do
LD_LIBRARY_PATH=./bin:$LD_LIBRARY_PATH ./$test
LD_LIBRARY_PATH=../bin:$LD_LIBRARY_PATH ./$test
done;
- name: Upload binary
@ -61,6 +61,52 @@ jobs:
name: akashi-linux
path: bin/
coverage:
needs: build-linux
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install qt5-default libqt5websockets5-dev g++ make
# Runs a set of commands using the runners shell
- name: qmake and build
run: |
cd $GITHUB_WORKSPACE
qmake CONFIG+=coverage
make
- name: Run tests
run: |
cd ${{github.workspace}}/bin_tests/
for test in ./unittest_*; do
LD_LIBRARY_PATH=../bin:$LD_LIBRARY_PATH ./$test
done;
- name: Copy coverage files
run: |
cd ${{github.workspace}}/core
gcov *.o
cd ..
mkdir coverage
cp core/*.gcov coverage/
- name: Codecov
uses: codecov/codecov-action@v3.1.0
with:
files: coverage/*
- name: Upload coverage files
uses: actions/upload-artifact@v2
with:
name: coverage statistics
path: coverage/
build-windows:
needs: formatting-check
runs-on: windows-latest

View File

@ -4,6 +4,10 @@ TEMPLATE = app
CONFIG += c++11 console
coverage {
LIBS += -lgcov
}
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the

View File

@ -8,6 +8,12 @@ TEMPLATE = lib
# Linux works just fine with `shared` only.
CONFIG += shared static c++11
coverage {
QMAKE_CXXFLAGS += --coverage -g -Og # -fprofile-arcs -ftest-coverage
LIBS += -lgcov
CONFIG -= static
}
# Needed so that Windows doesn't do `release/` and `debug/` subfolders
# in the output directory.
CONFIG -= \

View File

@ -3,6 +3,10 @@ QT += network websockets core sql testlib
CONFIG += qt console warn_on depend_includepath testcase no_testcase_installs
CONFIG -= app_bundle
coverage {
LIBS += -lgcov
}
DESTDIR = $$PWD/../bin_tests
win32: LIBS += -L$$PWD/../bin/ -lcore