From 47acac3b8cc3ae47cfd1b4c5c74a1fa7759019a5 Mon Sep 17 00:00:00 2001 From: wener Date: Sat, 18 Feb 2017 02:23:32 +0800 Subject: [PATCH] Add cmake to ci --- .travis.yml | 21 +++++++++++++++++++++ docker/build/builder.Dockerfile | 8 ++++++++ docker/build/dockerbuild.sh | 5 +++++ 3 files changed, 34 insertions(+) create mode 100644 docker/build/builder.Dockerfile create mode 100755 docker/build/dockerbuild.sh diff --git a/.travis.yml b/.travis.yml index ed2e3a80..eb01c0b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,8 @@ before_install: - make - sudo make install - popd + # Load cached docker images + - if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi addons: apt: packages: @@ -32,6 +34,9 @@ addons: script: - ./autogen.sh - ./configure && make + # Test cmake using our builder + - cd docker/build && docker build -f builder.Dockerfile -t builder . && cd - + - docker run --rm -it -v $PWD:/src -w /src builder sh -c /src/docker/build/dockerbuild.sh && echo yes branches: only: - master @@ -41,3 +46,19 @@ notifications: email: on_success: change on_failure: always + +# Use cache to speedup next build +services: + - docker + +before_cache: + # Save tagged docker images + - > + mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}' + | xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz' + +cache: + bundler: true + directories: + - $HOME/docker + diff --git a/docker/build/builder.Dockerfile b/docker/build/builder.Dockerfile new file mode 100644 index 00000000..a1402c57 --- /dev/null +++ b/docker/build/builder.Dockerfile @@ -0,0 +1,8 @@ +# Alpine with China mirror +FROM alpine +MAINTAINER wener + +# Better for cache and dev +RUN apk add --no-cache --virtual .build-deps \ + alpine-sdk cmake \ + linux-headers libev-dev libsodium-dev mbedtls-static mbedtls-dev pcre-dev udns-dev diff --git a/docker/build/dockerbuild.sh b/docker/build/dockerbuild.sh new file mode 100755 index 00000000..2b61cc60 --- /dev/null +++ b/docker/build/dockerbuild.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +set -o xtrace + +cmake -DBUILD_STATIC=OFF . && make && make install \ No newline at end of file