diff options
-rw-r--r-- | .travis.yml | 88 | ||||
-rwxr-xr-x | .travis/install.sh | 24 | ||||
-rwxr-xr-x | .travis/run.sh | 13 | ||||
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | appveyor.yml | 80 | ||||
-rw-r--r-- | build.py | 17 | ||||
-rw-r--r-- | conanfile.py | 61 | ||||
-rw-r--r-- | samples/echobot-conan/CMakeLists.txt | 9 | ||||
-rw-r--r-- | samples/echobot-conan/conanfile.py | 24 | ||||
-rw-r--r-- | samples/echobot-conan/example.cpp | 20 |
11 files changed, 8 insertions, 353 deletions
diff --git a/.travis.yml b/.travis.yml index f4e6c94..37629fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,84 +1,10 @@ -linux: &linux - os: linux - dist: xenial - language: python - python: "3.7" - services: - - docker -osx: &osx - os: osx - language: generic +sudo: required -stages: - - unittest - - conan-linux - - conan-osx - -jobs: - include: - - <<: *linux - stage: unittest - name: unittest - sudo: required - script: - - docker build -t reo7sp/tgbot-cpp -f Dockerfile . - - docker build -t reo7sp/tgbot-cpp-test -f Dockerfile_test . - - docker run --rm reo7sp/tgbot-cpp-test - - - <<: *linux - stage: conan-linux - env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49 - - <<: *linux - stage: conan-linux - env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5 - - <<: *linux - stage: conan-linux - env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6 - - <<: *linux - stage: conan-linux - env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7 - - <<: *linux - stage: conan-linux - env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8 - - - <<: *linux - stage: conan-linux - env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40 - - <<: *linux - stage: conan-linux - env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50 - - <<: *linux - stage: conan-linux - env: CONAN_CLANG_VERSIONS=6.0 CONAN_DOCKER_IMAGE=conanio/clang60 - - <<: *linux - stage: conan-linux - env: CONAN_CLANG_VERSIONS=7.0 CONAN_DOCKER_IMAGE=conanio/clang7 CONAN_BUILD_POLICY=missing - - - <<: *osx - stage: conan-osx - osx_image: xcode7.3 - env: CONAN_APPLE_CLANG_VERSIONS=7.3 CONAN_BUILD_POLICY=missing - - <<: *osx - stage: conan-osx - osx_image: xcode8.3 - env: CONAN_APPLE_CLANG_VERSIONS=8.1 CONAN_BUILD_POLICY=missing - - <<: *osx - stage: conan-osx - osx_image: xcode9 - env: CONAN_APPLE_CLANG_VERSIONS=9.0 - - <<: *osx - stage: conan-osx - osx_image: xcode9.4 - env: CONAN_APPLE_CLANG_VERSIONS=9.1 - - <<: *osx - stage: conan-osx - osx_image: xcode10 - env: CONAN_APPLE_CLANG_VERSIONS=10.0 - -install: - - chmod +x .travis/install.sh - - ./.travis/install.sh +services: + - docker script: - - chmod +x .travis/run.sh - - ./.travis/run.sh + - docker build -t reo7sp/tgbot-cpp -f Dockerfile . + - docker build -t reo7sp/tgbot-cpp-test -f Dockerfile_test . + - docker run --rm reo7sp/tgbot-cpp-test + diff --git a/.travis/install.sh b/.travis/install.sh deleted file mode 100755 index 657ecc1..0000000 --- a/.travis/install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ "$(uname -s)" == 'Darwin' ]]; then - brew update || brew update - brew outdated pyenv || brew upgrade pyenv - brew install pyenv-virtualenv - brew install cmake || true - - if which pyenv > /dev/null; then - eval "$(pyenv init -)" - fi - - pyenv install 3.7.1 - pyenv virtualenv 3.7.1 conan - pyenv rehash - pyenv activate conan -fi - -pip install conan_package_tools -pip install conan -conan user diff --git a/.travis/run.sh b/.travis/run.sh deleted file mode 100755 index 0a3488e..0000000 --- a/.travis/run.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e -set -x - -if [[ "$(uname -s)" == 'Darwin' ]]; then - if which pyenv > /dev/null; then - eval "$(pyenv init -)" - fi - pyenv activate conan -fi - -python build.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 275c505..bf987f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,6 @@ cmake_minimum_required(VERSION 2.8.4) project(TgBot) -if (${CONAN_EXPORTED}) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - conan_basic_setup() -endif() - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # options @@ -1,16 +1,8 @@ # tgbot-cpp [![Travis build Status](https://travis-ci.org/reo7sp/tgbot-cpp.svg?branch=master)](https://travis-ci.org/reo7sp/tgbot-cpp) -[![Appveyor build status](https://ci.appveyor.com/api/projects/status/tncys4p1flm8817m?svg=true)](https://ci.appveyor.com/project/reo7sp/tgbot-cpp) -[![Docker Hub pulls](https://img.shields.io/docker/pulls/reo7sp/tgbot-cpp.svg)](https://hub.docker.com/r/reo7sp/tgbot-cpp/) +[![GitHub contributors](https://img.shields.io/github/contributors/reo7sp/tgbot-cpp.svg)](https://github.com/reo7sp/tgbot-cpp/graphs/contributors) [![Open documentation](https://img.shields.io/badge/open-documentation-orange.svg)](http://reo7sp.github.io/tgbot-cpp) -[![Donate using PayPal](https://img.shields.io/badge/donate-PayPal-orange.svg)](https://paypal.me/reo7sp) - ---- - -[![GitHub contributors](https://img.shields.io/github/contributors/reo7sp/tgbot-cpp.svg)](https://github.com/reo7sp/tgbot-cpp/graphs/contributors) 🚀🚀🚀 thanks for the contributing! - ---- C++ library for Telegram bot API. @@ -85,12 +77,6 @@ Or you can treat this repository as a submodule of your project, for example, se ### Docker You can use Docker to build and run your bot. Set the base image of your's Dockerfile to [reo7sp/tgbot-cpp](https://hub.docker.com/r/reo7sp/tgbot-cpp/). -### Conan -You can use Conan C/C++ Package Manager. Follow [Conan instructions](https://docs.conan.io/en/latest/getting_started.html) and use [the template](https://github.com/reo7sp/tgbot-cpp/tree/master/samples/echobot-conan). - -### Arch Linux -A PKGBUILD compiles shared library with header files is hosted on [Arch Linux User Repository](https://aur.archlinux.org/packages/libtgbot-cpp-git/). - ## Bot compilation @@ -119,9 +105,5 @@ add_definitions(-DTGBOT_CHANGE_READ_BUFFER_SIZE) # Read Buffer Size Expansion ``` -## Feedback -Feel free to [create new issues on GitHub](https://github.com/reo7sp/tgbot-cpp/issues) or [contact me on Telegram](https://t.me/reo7sp). - - ## Licence [The MIT License](http://opensource.org/licenses/MIT). diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 4d16413..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,80 +0,0 @@ -build: false - - -environment: - PYTHON: "C:\\Python37" - VS150COMNTOOLS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\Tools\\" - - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 12 - CONAN_ARCHS: x86 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MT - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 12 - CONAN_ARCHS: x86_64 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MT - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 12 - CONAN_ARCHS: x86 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MD - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 12 - CONAN_ARCHS: x86_64 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MD - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 - CONAN_ARCHS: x86 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MT - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 - CONAN_ARCHS: x86_64 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MT - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 - CONAN_ARCHS: x86 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MD - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 - CONAN_ARCHS: x86_64 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MD - - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CONAN_VISUAL_VERSIONS: 15 - CONAN_ARCHS: x86 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MT - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CONAN_VISUAL_VERSIONS: 15 - CONAN_ARCHS: x86_64 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MT - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CONAN_VISUAL_VERSIONS: 15 - CONAN_ARCHS: x86 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MD - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CONAN_VISUAL_VERSIONS: 15 - CONAN_ARCHS: x86_64 - CONAN_BUILD_TYPES: Release - CONAN_VISUAL_RUNTIMES: MD - -install: - - set PATH=%PATH%;%PYTHON%/Scripts/ - - pip.exe install conan --upgrade - - pip.exe install conan_package_tools - - conan user # It creates the conan data directory - -test_script: - - python build.py - diff --git a/build.py b/build.py deleted file mode 100644 index 18a873a..0000000 --- a/build.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from cpt.packager import ConanMultiPackager - - -if __name__ == "__main__": - builder = ConanMultiPackager( - username="reo7sp", - login_username="reo7sp", - upload="https://api.bintray.com/conan/reo7sp/tgbot-cpp", - channel="ci", - stable_branch_pattern="release/*", - upload_only_when_stable=True, # Will only upload when the branch matches "release/*" - docker_32_images=True - ) - builder.add_common_builds() - builder.run() diff --git a/conanfile.py b/conanfile.py deleted file mode 100644 index 96c3d22..0000000 --- a/conanfile.py +++ /dev/null @@ -1,61 +0,0 @@ - -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import os - -from conans import ConanFile, CMake, tools - - -class TgbotConan(ConanFile): - name = "tgbot_cpp" - version = "b35438d" - description = "C++ library for Telegram bot API" - url = "https://github.com/reo7sp/tgbot-cpp" - homepage = "http://reo7sp.github.io/tgbot-cpp" - license = "MIT" - - exports_sources = ["LICENSE", ] - scm = {"type": "git", - "url": "auto", - "revision": "auto"} - - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False], - "shared": [True, False]} - default_options = {"fPIC": True, "shared": True} - - requires = ( - "boost/1.68.0@conan/stable", - "OpenSSL/1.0.2q@conan/stable", - "libcurl/7.61.1@bincrafters/stable" - ) - - def source(self): - boost_version = self.deps_cpp_info['boost'].version - tools.replace_in_file(os.path.join(self.source_folder, "CMakeLists.txt"), - "find_package(Boost 1.59.0 COMPONENTS system REQUIRED)", - "find_package(Boost {} COMPONENTS system REQUIRED)".format(boost_version)) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ENABLE_TESTS"] = False - cmake.configure() - return cmake - - def build(self): - cmake = self._configure_cmake() - cmake.build() - - def package(self): - self.copy(pattern="LICENSE", dst="licenses") - cmake = self._configure_cmake() - cmake.install() - - def package_info(self): - self.cpp_info.libs = ['TgBot'] diff --git a/samples/echobot-conan/CMakeLists.txt b/samples/echobot-conan/CMakeLists.txt deleted file mode 100644 index 24d5422..0000000 --- a/samples/echobot-conan/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -project(PackageTest CXX) -cmake_minimum_required(VERSION 2.8.4) -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) diff --git a/samples/echobot-conan/conanfile.py b/samples/echobot-conan/conanfile.py deleted file mode 100644 index 732b9b8..0000000 --- a/samples/echobot-conan/conanfile.py +++ /dev/null @@ -1,24 +0,0 @@ - -import os -from conans import ConanFile, CMake, tools - - -class TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - - def build(self): - cmake = CMake(self) - # Current dir is "echobot-conan/build/<build_id>" and CMakeLists.txt is in "echobot-conan" - cmake.configure() - cmake.build() - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='bin', src='lib') - - def test(self): - if not tools.cross_building(self.settings): - os.chdir("bin") - self.run(".%sexample" % os.sep) diff --git a/samples/echobot-conan/example.cpp b/samples/echobot-conan/example.cpp deleted file mode 100644 index f1c2863..0000000 --- a/samples/echobot-conan/example.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include <tgbot/tgbot.h> - -using namespace std; -using namespace TgBot; - -bool sigintGot = false; - -int main() { - Bot bot("PLACE YOUR TOKEN HERE"); - bot.getEvents().onCommand("start", [&bot](Message::Ptr message) { - bot.getApi().sendMessage(message->chat->id, "Hi!"); - }); - bot.getEvents().onAnyMessage([&bot](Message::Ptr message) { - printf("User wrote %s\n", message->text.c_str()); - if (StringTools::startsWith(message->text, "/start")) { - return; - } - bot.getApi().sendMessage(message->chat->id, "Your message is: " + message->text); - }); -} |