Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create github action workflow for CI #1

Merged
merged 12 commits into from
Sep 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
# container:
# image: soramitsu/kagome-dev:8
# env:
# TOOLCHAIN: cmake/toolchain/${{ matrix.toolchain }}
# BUILD_DIR: /tmp/build
runs-on: ubuntu-18.04
strategy:
matrix:
# 2 jobs in total
compiler: [{
"cc": "gcc",
"cxx": "g++"
}, {
"cc": "clang",
"cxx": "clang++"
}]
steps:
- uses: actions/checkout@v1
name: checkout
with:
submodules: true
clean: true
fetch-depth: 1
- name: install dependencies
run: |
set -e
sudo apt-get update
sudo apt-get install -y ninja-build
sudo python3 -m pip install --upgrade pip
sudo pip3 install scikit-build cmake requests gitpython gcovr pyyaml
- name: cmake
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # has to be included to access other secrets
GITHUB_HUNTER_USERNAME: ${{ secrets.GITHUB_HUNTER_USERNAME }}
GITHUB_HUNTER_TOKEN: ${{ secrets.GITHUB_HUNTER_TOKEN }}
run: cmake . -GNinja -Bbuild
- name: build
run: cmake --build build -- -j4
18 changes: 4 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,15 @@ set(CMAKE_TOOLCHAIN_FILE
"Default toolchain"
)

message(STATUS "toolchain = ${CMAKE_SOURCE_DIR}/cmake/toolchain/cxx17.cmake")

set(CMAKE_CXX_STANDARD 17)

if (NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}")
message(STATUS "no cmake toolchain file")
else ()
message(STATUS "toolchain presents")
endif ()

message(STATUS "standard = ${CMAKE_CXX_STANDARD}")

include("cmake/3rdparty/Hunter/init.cmake")
include("cmake/Hunter/init.cmake")
HunterGate(
URL "https://github.com/ruslo/hunter/archive/v0.23.171.tar.gz"
SHA1 "5d68bcca78eee347239ca5f4d34f4b6c12683154"
LOCAL
)

PROJECT(libp2p CXX)
project(libp2p C CXX)

include(cmake/print.cmake)
print("C flags: ${CMAKE_C_FLAGS}")
Expand All @@ -42,7 +32,7 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
link_libraries(Threads::Threads)
if (THREADS_HAVE_PTHREAD_ARG)
add_link_options(-lpthread)
link_libraries(pthread)
endif ()

include(CheckCXXCompilerFlag)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ function(compile_proto_to_cpp PB_H PB_CC PROTO)
set(GEN_COMMAND ${Protobuf_PROTOC_EXECUTABLE})
set(GEN_ARGS ${Protobuf_INCLUDE_DIR})

message(STATUS "oh=${SCHEMA_OUT_DIR}/${SCHEMA_REL}/${GEN_PB_HEADER}")
message(STATUS "oc=${SCHEMA_OUT_DIR}/${SCHEMA_REL}/${GEN_PB}")

add_custom_command(
OUTPUT ${SCHEMA_OUT_DIR}/${SCHEMA_REL}/${GEN_PB_HEADER} ${SCHEMA_OUT_DIR}/${SCHEMA_REL}/${GEN_PB}
COMMAND ${GEN_COMMAND}
Expand All @@ -92,7 +89,6 @@ function(add_proto_library NAME)
foreach (PROTO IN ITEMS ${ARGN})
compile_proto_to_cpp(H C ${PROTO})
list(APPEND SOURCES ${H} ${C})
message(STATUS "h=${H} c=${C}")
endforeach ()

add_library(${NAME}
Expand Down
1 change: 1 addition & 0 deletions cmake/toolchain/clang-8_cxx17.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../print.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compiler/clang-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cxx17.cmake)
2 changes: 0 additions & 2 deletions cmake/toolchain/compiler/clang-8.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ else()
set(POLLY_COMPILER_CLANG_CMAKE 1)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/../../print.cmake)

if(XCODE_VERSION)
set(_err "This toolchain is not available for Xcode")
set(_err "${_err} because Xcode ignores CMAKE_C(XX)_COMPILER variable.")
Expand Down
1 change: 1 addition & 0 deletions cmake/toolchain/gcc-8_cxx17.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include(${CMAKE_CURRENT_LIST_DIR}/../print.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/compiler/gcc-8.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cxx17.cmake)
2 changes: 1 addition & 1 deletion deps/di
Submodule di updated from 476720 to 65a739
2 changes: 1 addition & 1 deletion deps/hat-trie
2 changes: 1 addition & 1 deletion deps/spdlog
Submodule spdlog updated 1 files
+1 −1 README.md
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version: '3'

services:
dev:
image: warchantua/dev-essential
image: soramitsu/kagome-dev:8
tty: true
stdin_open: true
volumes:
Expand Down
2 changes: 2 additions & 0 deletions include/libp2p/crypto/key.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef LIBP2P_LIBP2P_CRYPTO_KEY_HPP
#define LIBP2P_LIBP2P_CRYPTO_KEY_HPP

#include <functional>

#include <libp2p/common/types.hpp>

namespace libp2p::crypto {
Expand Down
2 changes: 2 additions & 0 deletions include/libp2p/crypto/key_marshaller/key_marshaller_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef LIBP2P_CRYPTO_MARSHALER_KEY_MARSHALER_IMPL_HPP
#define LIBP2P_CRYPTO_MARSHALER_KEY_MARSHALER_IMPL_HPP

#include <memory>

#include <libp2p/crypto/error.hpp>
#include <libp2p/crypto/key.hpp>
#include <libp2p/crypto/key_marshaller.hpp>
Expand Down
1 change: 1 addition & 0 deletions include/libp2p/peer/protocol_repository.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#ifndef LIBP2P_PROTOCOL_REPOSITORY_HPP
#define LIBP2P_PROTOCOL_REPOSITORY_HPP

#include <set>
#include <unordered_set>
#include <vector>

Expand Down
3 changes: 3 additions & 0 deletions include/libp2p/protocol/kademlia/node_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#include <bitset>
#include <vector>
#include <memory>
#include <cstring>


#include <gsl/span>
#include <libp2p/crypto/sha/sha256.hpp>
Expand Down
9 changes: 7 additions & 2 deletions src/protocol/kademlia/impl/kad_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@ namespace libp2p::protocol::kademlia {
for (const auto &p : list) {
if (p.id == id) {
// yey!
return handle(QueryResult{.peer = p, .success = true});
QueryResult q;
q.peer = p;
q.success = true;
return handle(std::move(q));
}
}

return handle(QueryResult{.closerPeers = list});
QueryResult q;
q.closerPeers = list;
return handle(std::move(q));
});
}};

Expand Down