Browse Source

travis: Simplified build script

The Dockerfile is now stored in contrib and built using the Docker
Hub. This allows us to simply pull in the finished image from the hub
instead of having to build it ourself. Should shave off about 2
minutes from the build time.

I also switched to running the individual build and check steps in
their own containers, but on the same volume, so travis can group the
commands and run them independently.
ppa-0.6.1
Christian Decker 8 years ago
committed by Rusty Russell
parent
commit
67315be673
  1. 4
      .travis.yml
  2. 2
      Makefile
  3. 27
      contrib/Dockerfile.builder
  4. 32
      tools/travis.sh

4
.travis.yml

@ -4,4 +4,6 @@ sudo: true
# Trusty (aka 14.04) is way way too old, so run in docker...
script:
- tools/travis.sh
- docker run --rm=true -v "${TRAVIS_BUILD_DIR}":/build -t cdecker/lightning-ci make -j3
- docker run --rm=true -v "${TRAVIS_BUILD_DIR}":/build -t cdecker/lightning-ci make check
- docker run --rm=true -v "${TRAVIS_BUILD_DIR}":/build -t cdecker/lightning-ci make check-source

2
Makefile

@ -285,7 +285,7 @@ check-source: check-makefile check-source-bolt check-whitespace \
$(CORE_TX_HEADERS:%=check-hdr-include-order/%) \
$(BITCOIN_HEADERS:%=check-hdr-include-order/%)
full-check: check pytest $(TEST_PROGRAMS) check-source
full-check: check $(TEST_PROGRAMS) check-source
coverage/coverage.info: check $(TEST_PROGRAMS) pytest
mkdir coverage || true

27
contrib/Dockerfile.builder

@ -0,0 +1,27 @@
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
WORKDIR /build
RUN echo "deb http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/bitcoin.list
RUN apt-get -qq update && \
apt-get -qq install --allow-unauthenticated -yy \
eatmydata \
software-properties-common \
build-essential \
autoconf \
libtool \
libprotobuf-c-dev \
libsqlite3-dev \
libgmp-dev \
libsqlite3-dev \
git \
python \
python3 \
valgrind \
net-tools \
bitcoind \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install python-bitcoinlib==0.7.0

32
tools/travis.sh

@ -1,32 +0,0 @@
#!/bin/bash
# This build script is for running the Travis builds using docker.
# Stolen from: https://github.com/shenki/openbmc-build-scripts/blob/master/linux-openbmc-build.sh
# Trace bash processing
set -ex
# Build the docker container
docker build -t ubuntu - <<EOF
FROM ubuntu:16.10
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get install -yy eatmydata software-properties-common && \
eatmydata add-apt-repository -y ppa:bitcoin/bitcoin && \
eatmydata apt-get update && \
eatmydata apt-get install -yy \
build-essential autoconf libtool libprotobuf-c-dev libsqlite3-dev libgmp-dev libsqlite3-dev git python3 python valgrind net-tools bitcoind python3-pip && \
pip3 install python-bitcoinlib
RUN grep -q ${GROUPS} /etc/group || groupadd -g ${GROUPS} ${USER}
RUN grep -q ${UID} /etc/passwd || useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} ${USER}
USER ${USER}
ENV HOME ${HOME}
RUN /bin/bash
EOF
# Run the docker container, execute the build script we just built
docker run --rm=true --user="${USER}" -w "$TRAVIS_BUILD_DIR" -v "${HOME}":"${HOME}" \
-t ubuntu make -j2 check-source check
Loading…
Cancel
Save