Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bfe750c
[WIP] Define ideal matrix
coord-e Feb 8, 2019
6774d73
[WIP] Add: Add install scripts
coord-e Feb 8, 2019
d634389
[WIP] Add build scripts
coord-e Feb 8, 2019
826b4fe
[WIP] Add: Add after-success scripts
coord-e Feb 8, 2019
9fda87c
Change: Reqeire ci config to use wirtten scripts
coord-e Feb 8, 2019
81c9236
Chyange: Use common script
coord-e Feb 8, 2019
81a2841
Add: Add dockerfile to use
coord-e Feb 8, 2019
d3f0550
CHange: Move scripts to common location
coord-e Feb 8, 2019
51484e1
Add: Add image-scripts
coord-e Feb 8, 2019
fd45399
Add: Add packaging scripts that puts distributions in /dist
coord-e Feb 9, 2019
66dda16
CHange: Manually specify to build python module
coord-e Feb 9, 2019
7252f8e
Fix: Fix source path
coord-e Feb 9, 2019
829aad5
Delete: Delete normal cmake build in python build
coord-e Feb 9, 2019
3bc789d
Add: Print the surrent base image
coord-e Feb 9, 2019
6ba5437
Fix: Fix copy path of image scripts
coord-e Feb 9, 2019
81b6ddb
Fix: Make scripts executable
coord-e Feb 9, 2019
ef686aa
Add: Add a option to disable python module build
coord-e Feb 9, 2019
79e918d
Change: use sed substitution instead of build arg and enable to change
coord-e Feb 9, 2019
a0911d1
Fix: Fix build matrix
coord-e Feb 9, 2019
2d7f7f0
Fix: Install and upgrade necessary packages before packaging
coord-e Feb 9, 2019
96bdb2d
Change: Pass all envs with prefix of BUILDER_
coord-e Feb 9, 2019
b227288
Add: Enable to switch python package type
coord-e Feb 9, 2019
bcf3d9f
Change Rewrite travis matrix
coord-e Feb 9, 2019
0bead99
Fix: Fix travis config file to enable docker service properly
coord-e Feb 9, 2019
cd90022
Add: Add bintray deploy configuration
coord-e Feb 9, 2019
8c8fd8c
Fix: Fix template file name
coord-e Feb 9, 2019
1f2ab68
Change: Delete github release deployment and add bintray deployment
coord-e Feb 9, 2019
70d63fb
Add: Add version.sh
coord-e Feb 9, 2019
0e24779
Fix: Make before_deploy script executable
coord-e Feb 9, 2019
e6873cc
Change: Use own script for pypi deployment
coord-e Feb 9, 2019
d02ac6c
Fix: Don't upload .dev to pypi
coord-e Feb 9, 2019
d4ba740
Fix: Use apt-get
coord-e Feb 9, 2019
19386b5
Dlelete: Temporarily use shared version of boost.filesystem
coord-e Feb 9, 2019
73da316
Fix: Generate deb packages
coord-e Feb 9, 2019
eefe5cc
Fix: Skip cleanup before pypi deployment
coord-e Feb 9, 2019
fcbe786
Change: Test deployment
coord-e Feb 9, 2019
14d6158
Fix:Use sudo with apt-get
coord-e Feb 9, 2019
edba5a4
Change: Set deploy condition
coord-e Feb 9, 2019
b94d519
Fix: Update before install
coord-e Feb 9, 2019
c080a46
Fix: Install setuptools together with twine
coord-e Feb 9, 2019
1b64634
Fix: Fix some in pypi deploy
coord-e Feb 9, 2019
078be5d
Revert "Change: Test deployment"
coord-e Feb 9, 2019
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
62 changes: 35 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,45 @@
language: python
python:
- '3.5'
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
- build-essential
- cmake
- libboost-dev
- libboost-filesystem-dev
env:
- CXX=g++-5
language: cpp
sudo: true
dist: xenial

services:
- docker

matrix:
include:
- env: BUILD_TYPE=deb DEBIAN_VERSION=stretch
- env: BUILD_TYPE=deb DEBIAN_VERSION=buster
- env: BUILD_TYPE=deb DEBIAN_VERSION=stretch CROSS=raspberry-pi
- env: BUILD_TYPE=python PYTHON_VERSION=3.5 DEBIAN_VERSION=stretch BUILDER_SDIST=true
- env: BUILD_TYPE=python PYTHON_VERSION=3.5 DEBIAN_VERSION=stretch CROSS=raspberry-pi BUILDER_WHEEL=true
- env: BUILD_TYPE=python PYTHON_VERSION=3.6 DEBIAN_VERSION=stretch CROSS=raspberry-pi BUILDER_WHEEL=true
- env: BUILD_TYPE=python PYTHON_VERSION=3.7 DEBIAN_VERSION=stretch CROSS=raspberry-pi BUILDER_WHEEL=true

install:
- ci/scripts/install.sh

script:
- pip install -e .
- mkdir -p src/build && cd $_
- cmake .. -DPYBIND11_PYTHON_VERSION=${TRAVIS_PYTHON_VERSION}
- make -j"$(nproc)"
- ci/scripts/script.sh

after_success:
- cpack -D CPACK_OUTPUT_FILE_PREFIX=dist
- ci/scripts/after_success.sh

before_deploy:
- ci/scripts/before_deploy.sh
- cd ${TRAVIS_BUILD_DIR}

deploy:
- provider: pypi
user: "${PYPI_USERNAME}"
password: "${PYPI_PASSWORD}"
- provider: script
script: bash ci/scripts/pypi_deploy.sh
skip_cleanup: true
on:
condition: "$BUILD_TYPE = python"
tags: true
- provider: releases
api_key: $GITHUB_OAUTH_TOKEN
- provider: bintray
file: "bintray.json"
user: "coord-e"
key: $BINTRAY_API_KEY
skip_cleanup: true
file_glob: true
file: 'src/build/dist/*'
on:
condition: "$BUILD_TYPE = deb"
tags: true
22 changes: 22 additions & 0 deletions ci/bintray.json.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"package": {
"name": "servoarray",
"repo": "apt",
"subject": "monomotion"
},
"version": {
"name": "@VERSION@"
},
"files": [
{
"includePattern": "dist/(.*\.deb)",
"uploadPattern": "pool/main/m/servoarray/$1",
"matrixParams": {
"deb_distribution": "@DEBIAN_VERSION@",
"deb_component": "main",
"deb_architecture": "@ARCH@"
}
}
],
"publish": true
}
1 change: 1 addition & 0 deletions ci/image/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
10 changes: 10 additions & 0 deletions ci/image/Dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM @BASE_IMAGE@

SHELL @SHELL@

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends libboost-dev libboost-filesystem-dev cmake build-essential

COPY scripts /scripts

ENTRYPOINT @SHELL@
21 changes: 21 additions & 0 deletions ci/image/scripts/deb_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

cd /build
cmake /source/src -DBUILD_PYTHON=OFF
make -j"$(nproc)"
20 changes: 20 additions & 0 deletions ci/image/scripts/deb_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

cd /build
cpack -D CPACK_OUTPUT_FILE_PREFIX=/dist -D CPACK_GENERATOR=DEB
22 changes: 22 additions & 0 deletions ci/image/scripts/python_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

cd /source
pip install -e .

# TODO: perform tests around here
23 changes: 23 additions & 0 deletions ci/image/scripts/python_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

pip install --upgrade setuptools pip wheel

cd /source
${BUILDER_SDIST:-false} && python setup.py sdist -d /dist
${BUILDER_WHEEL:-false} && python setup.py bdist_wheel -d /dist
19 changes: 19 additions & 0 deletions ci/scripts/after_success.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

docker run -v $(pwd):/source -v $(pwd)/build:/build -v $(pwd)/dist:/dist --env-file <(env | grep BUILDER_) builder /scripts/${BUILD_TYPE}_package.sh
25 changes: 25 additions & 0 deletions ci/scripts/before_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

DEB_ARCH=$(docker run builder "dpkg --print-architecture")

cat ci/bintray.json.in \
| sed "s/@VERSION@/$(./version.sh)/g" \
| sed "s/@DEBIAN_VERSION@/${DEBIAN_VERSION}/g" \
| sed "s/@ARCH@/${DEB_ARCH}/g" \
> bintray.json
60 changes: 60 additions & 0 deletions ci/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

function base_image_python() {
if [ -n "${CROSS:-}" ]; then
echo "balenalib/${CROSS}-python:${PYTHON_VERSION}-${DEBIAN_VERSION}-build"
else
echo "python:${PYTHON_VERSION}-slim-${DEBIAN_VERSION}"
fi
}

function base_image_deb() {
if [ -n "${CROSS:-}" ]; then
echo "balenalib/${CROSS}:${DEBIAN_VERSION}-build"
else
echo "debian:${DEBIAN_VERSION}-slim"
fi
}

function base_image() {
case ${BUILD_TYPE} in
"python" ) base_image_python ;;
"deb" ) base_image_deb ;;
* ) echo "unknown build type ${BUILD_TYPE}"; exit -1 ;;
esac
}

function cross_sh() {
if [ -n "${CROSS:-}" ]; then
echo "[\"/usr/bin/qemu-arm-static\", \"-execve\", \"/bin/sh\", \"-c\"]"
else
echo "[\"/bin/sh\", \"-c\"]"
fi
}

readonly BASE_IMAGE=$(base_image)
readonly CROSS_SH=$(cross_sh)

echo "BASE_IMAGE=${BASE_IMAGE}"
cat ci/image/Dockerfile.in \
| sed "s/@BASE_IMAGE@/${BASE_IMAGE//\//\\/}/g" \
| sed "s/@SHELL@/${CROSS_SH//\//\\/}/g" \
> ci/image/Dockerfile

docker build ci/image -t builder
28 changes: 28 additions & 0 deletions ci/scripts/pypi_deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

sudo apt-get update -y
sudo apt-get install -y python3-setuptools python3-pip
sudo pip3 install twine

function upload_pypi() {
twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} $@
}

${BUILDER_SDIST:-false} && upload_pypi dist/*.tar.gz
${BUILDER_WHEEL:-false} && upload_pypi dist/*.whl
19 changes: 19 additions & 0 deletions ci/scripts/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# This file is part of servoarray.
#
# servoarray is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# servoarray is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with servoarray. If not, see <http://www.gnu.org/licenses/>.

set -euo pipefail

docker run -v $(pwd):/source -v $(pwd)/build:/build --env-file <(env | grep BUILDER_) builder /scripts/${BUILD_TYPE}_build.sh
13 changes: 8 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ include(config/servoarrayTools.cmake) # sets SERVOARRAY_DRIVER_SUFFIX
set(SERVOARRAY_DEFAULT_DRIVER_PATHS ~/.servoarray/ ${CMAKE_INSTALL_PREFIX}/lib/servoarray)
set(SERVOARRAY_DEFAULT_CONFIG_FILES ~/.servoarrayrc ./.servoarrayrc)

set(Boost_USE_STATIC_LIBS ON)
option(BUILD_PYTHON "Build servoarray python module" ON)

find_package(Boost 1.36.0 REQUIRED COMPONENTS filesystem system)
include_directories(${Boost_INCLUDE_DIRS})

Expand All @@ -51,8 +52,10 @@ add_subdirectory(include)
add_subdirectory(config)
add_subdirectory(examples)

add_subdirectory(third_party/pybind11)
# pybind11 headers produce so many errors with strict compiler options
include_directories(SYSTEM ${PYBIND11_INCLUDE_DIR})
if (${BUILD_PYTHON})
add_subdirectory(third_party/pybind11)
# pybind11 headers produce so many errors with strict compiler options
include_directories(SYSTEM ${PYBIND11_INCLUDE_DIR})

add_subdirectory(python)
add_subdirectory(python)
endif()
2 changes: 2 additions & 0 deletions src/cmake/cpack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@

set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_GENERATOR "TGZ;ZIP")
set(CPACK_PACKAGE_CONTACT "coord.e <me@coord-e.com>")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-filesystem1.62.0")

include(CPack)
Loading