mirror of
https://gitlab.com/niansa/libcrosscoro.git
synced 2025-03-06 20:53:32 +01:00
Add CI & code coverage (#2)
* Add CI & code coverage * Remove un-used -lzmq dependency * Update readme with coverage/background/goals
This commit is contained in:
parent
c820498f50
commit
31dded8611
12 changed files with 129 additions and 26 deletions
96
.github/workflows/ci.yml
vendored
Normal file
96
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
name: build
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build-ubuntu-20-04:
|
||||
name: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:20.04
|
||||
env:
|
||||
TZ: America/New_York
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: apt
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -y upgrade
|
||||
apt install -y build-essential software-properties-common
|
||||
add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||
apt-get install -y \
|
||||
cmake \
|
||||
git \
|
||||
ninja-build \
|
||||
g++-10
|
||||
- name: build-release-g++
|
||||
run: |
|
||||
mkdir build-release-g++
|
||||
cd build-release-g++
|
||||
cmake \
|
||||
-GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER=gcc-10 \
|
||||
-DCMAKE_CXX_COMPILER=g++-10 \
|
||||
..
|
||||
ninja
|
||||
- name: test-release-g++
|
||||
run: |
|
||||
cd build-release-g++
|
||||
ctest -VV
|
||||
build-fedora-31:
|
||||
name: fedora-32
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:32
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: dnf
|
||||
run: |
|
||||
sudo dnf install -y \
|
||||
cmake \
|
||||
git \
|
||||
ninja-build \
|
||||
gcc-c++-10.2.1 \
|
||||
lcov
|
||||
- name: build-debug-g++
|
||||
run: |
|
||||
mkdir build-debug-g++
|
||||
cd build-debug-g++
|
||||
cmake \
|
||||
-GNinja \
|
||||
-DCORO_CODE_COVERAGE=ON \
|
||||
-DCMAKE_BUILD_TYPE=Debug \
|
||||
-DCMAKE_C_COMPILER=gcc \
|
||||
-DCMAKE_CXX_COMPILER=g++ \
|
||||
..
|
||||
ninja
|
||||
- name: build-release-g++
|
||||
run: |
|
||||
mkdir build-release-g++
|
||||
cd build-release-g++
|
||||
cmake \
|
||||
-GNinja \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER=gcc \
|
||||
-DCMAKE_CXX_COMPILER=g++ \
|
||||
..
|
||||
ninja
|
||||
- name: test-release-g++
|
||||
run: |
|
||||
cd build-release-g++
|
||||
ctest -VV
|
||||
- name: Build coverage info
|
||||
run: |
|
||||
cd build-debug-g++
|
||||
ctest -VV
|
||||
gcov -o ./test/CMakeFiles/libcoro_tests.dir/main.cpp.o ./test/libcoro_tests
|
||||
lcov --include "*/inc/coro/*" --include "*/src/*" --exclude "test/*" -o libcoro_tests.info -c -d .
|
||||
- name: Coveralls GitHub Action
|
||||
uses: coverallsapp/github-action@v1.0.1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
path-to-lcov: build-debug-g++/libcoro_tests.info
|
|
@ -8,20 +8,20 @@ message("${PROJECT_NAME} CORO_BUILD_TESTS = ${CORO_BUILD_TESTS}")
|
|||
message("${PROJECT_NAME} CORO_CODE_COVERAGE = ${CORO_CODE_COVERAGE}")
|
||||
|
||||
set(LIBCORO_SOURCE_FILES
|
||||
src/coro/coro.hpp
|
||||
src/coro/event.hpp
|
||||
src/coro/generator.hpp
|
||||
src/coro/latch.hpp
|
||||
src/coro/scheduler.hpp
|
||||
src/coro/sync_wait.hpp
|
||||
src/coro/task.hpp
|
||||
inc/coro/coro.hpp
|
||||
inc/coro/event.hpp
|
||||
inc/coro/generator.hpp
|
||||
inc/coro/latch.hpp
|
||||
inc/coro/scheduler.hpp
|
||||
inc/coro/sync_wait.hpp
|
||||
inc/coro/task.hpp
|
||||
)
|
||||
|
||||
add_library(${PROJECT_NAME} STATIC ${LIBCORO_SOURCE_FILES})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC src)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC zmq pthread)
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC inc)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC pthread)
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.2.0")
|
||||
|
|
22
README.md
22
README.md
|
@ -1,3 +1,21 @@
|
|||
# libcoro
|
||||
libcoro C++20 Coroutines
|
||||
========================
|
||||
|
||||
This library is meant for learning the new C++20 coroutines.
|
||||
[](https://github.com/jbaldwin/libcoro/workflows/build/badge.svg)
|
||||
[](https://coveralls.io/github/jbaldwin/libcoro?branch=master)
|
||||
[![language][badge.language]][language]
|
||||
[![license][badge.license]][license]
|
||||
|
||||
[badge.language]: https://img.shields.io/badge/language-C%2B%2B17-yellow.svg
|
||||
[badge.license]: https://img.shields.io/badge/license-Apache--2.0-blue
|
||||
|
||||
[language]: https://en.wikipedia.org/wiki/C%2B%2B17
|
||||
[license]: https://en.wikipedia.org/wiki/Apache_License
|
||||
|
||||
**libcoro** is licensed under the Apache 2.0 license.
|
||||
|
||||
# Background
|
||||
Libcoro is a C++20 coroutine library. So far most inspiration has been gleaned from [libcppcoro](https://github.com/lewissbaker/cppcoro) an amazing C++ coroutine library as well as Lewis Baker's great coroutine blog entries [https://lewissbaker.github.io/](Blog). I would highly recommend anyone who is trying to learn the internals of C++20's coroutine implementation to read all of his blog entries, they are extremely insightful and well written.
|
||||
|
||||
# Goal
|
||||
Libcoro is currently more of a learning experience for myself but ultimately I'd like to turn this into a great linux coroutine base library with an easy to use HTTP scheduler/server.
|
||||
|
|
|
@ -22,20 +22,9 @@ if(CORO_CODE_COVERAGE)
|
|||
endif()
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
||||
target_compile_options(
|
||||
${PROJECT_NAME} PRIVATE
|
||||
-Wno-unknown-pragmas
|
||||
)
|
||||
endif()
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||
-Wall
|
||||
-Wextra
|
||||
-Weffc++
|
||||
-Werror
|
||||
-Wpedantic
|
||||
-pedantic-errors
|
||||
)
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC -fcoroutines -Wall -Wextra -pipe)
|
||||
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
|
||||
message(FATAL_ERROR "Clang is currently not supported.")
|
||||
endif()
|
||||
|
||||
add_test(NAME corohttp_test COMMAND ${PROJECT_NAME})
|
|
@ -41,4 +41,4 @@ TEST_CASE("generator infinite incrementing integer yield")
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue