From b8f86137da48757ee043c3d6d45de9a0a655c8b1 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Mon, 6 Nov 2017 19:38:03 +0100 Subject: [PATCH 1/8] Setup Docker-based build for RPi3 --- .travis.yml | 4 ++++ Dockerfile-raspberrypi3 | 14 ++++++++++++++ docker-compose-raspberrypi3.yaml | 8 ++++++++ 3 files changed, 26 insertions(+) create mode 100644 Dockerfile-raspberrypi3 create mode 100644 docker-compose-raspberrypi3.yaml diff --git a/.travis.yml b/.travis.yml index 951156c..5a340c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,13 @@ sudo: true dist: trusty env: - MSGFLO_BROKER=mqtt://localhost +matrix: + - env: TARGET=x86 + - env: TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 before_install: - sudo apt-get update -qq - sudo apt-get install pkg-config libev-dev cmake openssl libc-ares-dev +- if [ "$TARGET" == "raspberrypi3" ]; then docker run --rm --privileged multiarch/qemu-user-static:register --reset; fi install: - export CC=gcc-4.8 - export CXX=g++-4.8 diff --git a/Dockerfile-raspberrypi3 b/Dockerfile-raspberrypi3 new file mode 100644 index 0000000..855de5b --- /dev/null +++ b/Dockerfile-raspberrypi3 @@ -0,0 +1,14 @@ +FROM resin/rpi-raspbian:jessie-20171101 + +RUN mkdir -p /var/app +WORKDIR /var/app + +# Install Dlock13 sources +COPY ./dlock13-msgflo /var/app/ + +# Install dependencies +RUN apt-get update +RUN apt-get install libmosquitto-dev libev-dev git cmake g++ build-essential + +# Run build +RUN ./build.sh diff --git a/docker-compose-raspberrypi3.yaml b/docker-compose-raspberrypi3.yaml new file mode 100644 index 0000000..5348223 --- /dev/null +++ b/docker-compose-raspberrypi3.yaml @@ -0,0 +1,8 @@ +version: '3' +services: + dlock: + image: bitraf/dlock13-rpi + build: + context: . + dockerfile: Dockerfile-raspberrypi3 + container_name: dlock From 29cdb79db90023522fc9598f75349ccc3e4c6e5d Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Mon, 6 Nov 2017 20:46:56 +0100 Subject: [PATCH 2/8] build.sh: Don't update submodules This is responsibility of code outside --- dlock13-msgflo/build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/dlock13-msgflo/build.sh b/dlock13-msgflo/build.sh index c684542..064a267 100755 --- a/dlock13-msgflo/build.sh +++ b/dlock13-msgflo/build.sh @@ -1,7 +1,6 @@ #!/bin/bash -xe mkdir -p build -git submodule update --init --recursive if [[ $MsgFlo_DIR == "" ]] then From d1419ac2a0687f66b890056ec519b54be00eab76 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Mon, 6 Nov 2017 23:11:22 +0100 Subject: [PATCH 3/8] Travis: Run Docker for RPi and collect result --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5a340c8..7191bcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,10 @@ install: - pip install --user nose twine - pip install --user -r requirements.txt - pip install --user -r test/requirements.txt +- mkdir -p dlock13-$TARGET/bin +- if [ "$TARGET" == "raspberrypi3" ]; docker-compose -f docker-compose-raspberrypi3.yaml build; fi +- if [ "$TARGET" == "raspberrypi3" ]; docker run -it bitraf/dlock13-rpi /bin/true; fi +- if [ "$TARGET" == "raspberrypi3" ]; docker cp `docker ps -alq`:/var/app/build/dlock13 ./dlock13-$TARGET/bin/ before_script: - mosquitto -d script: From 098720bb423f7825be9cc96b5f9d2c2498d856b0 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Mon, 6 Nov 2017 23:29:54 +0100 Subject: [PATCH 4/8] Travis: Upload build to Github Releases --- .travis.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7191bcd..1c7e12c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,13 @@ dist: trusty env: - MSGFLO_BROKER=mqtt://localhost matrix: - - env: TARGET=x86 - - env: TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 +- env: TARGET=x86 +- env: TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 before_install: - sudo apt-get update -qq - sudo apt-get install pkg-config libev-dev cmake openssl libc-ares-dev -- if [ "$TARGET" == "raspberrypi3" ]; then docker run --rm --privileged multiarch/qemu-user-static:register --reset; fi +- if [ "$TARGET" == "raspberrypi3" ]; then docker run --rm --privileged multiarch/qemu-user-static:register + --reset; fi install: - export CC=gcc-4.8 - export CXX=g++-4.8 @@ -33,15 +34,21 @@ install: - pip install --user -r requirements.txt - pip install --user -r test/requirements.txt - mkdir -p dlock13-$TARGET/bin -- if [ "$TARGET" == "raspberrypi3" ]; docker-compose -f docker-compose-raspberrypi3.yaml build; fi -- if [ "$TARGET" == "raspberrypi3" ]; docker run -it bitraf/dlock13-rpi /bin/true; fi -- if [ "$TARGET" == "raspberrypi3" ]; docker cp `docker ps -alq`:/var/app/build/dlock13 ./dlock13-$TARGET/bin/ +- if [ "$TARGET" == "raspberrypi3" ]; then docker-compose -f docker-compose-raspberrypi3.yaml + build; fi +- if [ "$TARGET" == "raspberrypi3" ]; then docker run -it bitraf/dlock13-rpi /bin/true; + fi +- if [ "$TARGET" == "raspberrypi3" ]; then docker cp `docker ps -alq`:/var/app/build/dlock13 + ./dlock13-$TARGET/bin/; fi +- zip -r dlock13-$TARGET.zip dlock13-$TARGET/ before_script: - mosquitto -d script: - npm test - nosetests -v deploy: +- + skip_cleanup: true provider: pypi user: jonnor skip_upload_docs: true @@ -50,3 +57,12 @@ deploy: on: tags: true repo: bitraf/dlock13 +- + provider: releases + api_key: + secure: dGFUrHBNucrnE6XLFtovIcJ5YI89RkmWmaKzA6kSut8NggPJyRc+6LO/yfQDIbhuJf702k9jP1Bilsm3F27Eff+trT4CTnXLHAPFSAAzd+2vDMumwwqTPDqzXI4UYYr+VuaO2on4oDFGZODdGrtN92OfwH3T4wuEMzqwJeFzG1g= + file: ./dlock13-$TARGET.zip + skip_cleanup: true + on: + tags: true + repo: bitraf/dlock13 From 74d6f7e08a744fd37d6ed5bef108254abb980c9a Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Mon, 6 Nov 2017 23:40:55 +0100 Subject: [PATCH 5/8] Travis: Fix build matrix declaration --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c7e12c..4765723 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,8 +6,9 @@ dist: trusty env: - MSGFLO_BROKER=mqtt://localhost matrix: -- env: TARGET=x86 -- env: TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 + include: + - env: TARGET=x86 + - env: TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 before_install: - sudo apt-get update -qq - sudo apt-get install pkg-config libev-dev cmake openssl libc-ares-dev From 874d9172a36bdb770d4d268f2e4353821f66862e Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Mon, 6 Nov 2017 23:41:49 +0100 Subject: [PATCH 6/8] Travis: Require Docker service --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4765723..43e1704 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,8 @@ node_js: - '8' sudo: true dist: trusty +services: +- docker env: - MSGFLO_BROKER=mqtt://localhost matrix: From 7e664db5c97b878d7b2dd9bea3b9b51a36a93a10 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Tue, 7 Nov 2017 00:18:56 +0100 Subject: [PATCH 7/8] Travis: Build for Docker first --- .travis.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43e1704..a2abf56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,8 +17,14 @@ before_install: - if [ "$TARGET" == "raspberrypi3" ]; then docker run --rm --privileged multiarch/qemu-user-static:register --reset; fi install: -- export CC=gcc-4.8 -- export CXX=g++-4.8 +- mkdir -p dlock13-$TARGET/bin +- if [ "$TARGET" == "raspberrypi3" ]; then docker-compose -f docker-compose-raspberrypi3.yaml + build; fi +- if [ "$TARGET" == "raspberrypi3" ]; then docker run -it bitraf/dlock13-rpi /bin/true; + fi +- if [ "$TARGET" == "raspberrypi3" ]; then docker cp `docker ps -alq`:/var/app/build/dlock13 + ./dlock13-$TARGET/bin/; fi +- zip -r dlock13-$TARGET.zip dlock13-$TARGET/ - wget http://mosquitto.org/files/source/mosquitto-1.3.1.tar.gz - tar xzf mosquitto-1.3.1.tar.gz - cd mosquitto-1.3.1 @@ -36,14 +42,6 @@ install: - pip install --user nose twine - pip install --user -r requirements.txt - pip install --user -r test/requirements.txt -- mkdir -p dlock13-$TARGET/bin -- if [ "$TARGET" == "raspberrypi3" ]; then docker-compose -f docker-compose-raspberrypi3.yaml - build; fi -- if [ "$TARGET" == "raspberrypi3" ]; then docker run -it bitraf/dlock13-rpi /bin/true; - fi -- if [ "$TARGET" == "raspberrypi3" ]; then docker cp `docker ps -alq`:/var/app/build/dlock13 - ./dlock13-$TARGET/bin/; fi -- zip -r dlock13-$TARGET.zip dlock13-$TARGET/ before_script: - mosquitto -d script: From af9a42cece3410266bceb8d023b9523f9bef43af Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Tue, 7 Nov 2017 00:30:44 +0100 Subject: [PATCH 8/8] Travis: Setup envvars together with build matrix --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a2abf56..b536a27 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,11 @@ dist: trusty services: - docker env: -- MSGFLO_BROKER=mqtt://localhost -matrix: - include: - - env: TARGET=x86 - - env: TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 + global: + - MSGFLO_BROKER=mqtt://localhost + matrix: + - TARGET=x86 + - TARGET=raspberrypi3 DOCKER_FILE=Dockerfile-raspberrypi3 before_install: - sudo apt-get update -qq - sudo apt-get install pkg-config libev-dev cmake openssl libc-ares-dev