Merge pull request #1616 from VoR0220/DockerReleaseAutomation

Docker release automation
This commit is contained in:
chriseth 2017-02-10 15:03:49 +01:00 committed by GitHub
commit 885b6ed96b
5 changed files with 99 additions and 66 deletions

View File

@ -33,6 +33,18 @@ branches:
- develop - develop
- release - release
- /^v[0-9]/ - /^v[0-9]/
env:
global:
- ENCRYPTION_LABEL="6d4541b72666"
- SOLC_BUILD_TYPE=RelWithDebInfo
- SOLC_DOCS=Off
- SOLC_EMSCRIPTEN=Off
- SOLC_INSTALL_DEPS_TRAVIS=On
- SOLC_RELEASE=On
- SOLC_TESTS=On
- SOLC_DOCKER=Off
matrix: matrix:
include: include:
# Ubuntu 14.04 LTS "Trusty Tahr" # Ubuntu 14.04 LTS "Trusty Tahr"
@ -61,10 +73,23 @@ matrix:
dist: trusty dist: trusty
sudo: required sudo: required
compiler: gcc compiler: gcc
before_install:
- sudo apt-get -y install python-sphinx
env: env:
- TRAVIS_DOCS=On - SOLC_DOCS=On
- TRAVIS_RELEASE=Off - SOLC_RELEASE=Off
- TRAVIS_TESTS=Off - SOLC_TESTS=Off
# Docker target, which generates a statically linked alpine image
- os: linux
dist: trusty
sudo: required
services:
- docker
env:
- SOLC_DOCKER=On
- SOLC_INSTALL_DEPS_TRAVIS=Off
- SOLC_RELEASE=Off
- SOLC_TESTS=Off
# Emscripten target, which compiles 'solc' to javascript and uploads the resulting .js # Emscripten target, which compiles 'solc' to javascript and uploads the resulting .js
# files to https://github.com/ethereum/solc-bin. These binaries are used in Browser-Solidity # files to https://github.com/ethereum/solc-bin. These binaries are used in Browser-Solidity
@ -79,10 +104,10 @@ matrix:
before_install: before_install:
- docker pull trzeci/emscripten:sdk-tag-1.35.4-64bit - docker pull trzeci/emscripten:sdk-tag-1.35.4-64bit
env: env:
- TRAVIS_EMSCRIPTEN=On - SOLC_EMSCRIPTEN=On
- TRAVIS_INSTALL_DEPS=Off - SOLC_INSTALL_DEPS_TRAVIS=Off
- TRAVIS_RELEASE=Off - SOLC_RELEASE=Off
- TRAVIS_TESTS=Off - SOLC_TESTS=Off
# OS X Mavericks (10.9) # OS X Mavericks (10.9)
# https://en.wikipedia.org/wiki/OS_X_Mavericks # https://en.wikipedia.org/wiki/OS_X_Mavericks
@ -143,37 +168,18 @@ cache:
- $HOME/.local - $HOME/.local
install: install:
- test $TRAVIS_INSTALL_DEPS != On || ./scripts/install_deps.sh - test $SOLC_INSTALL_DEPS_TRAVIS != On || ./scripts/install_deps.sh
- test "$TRAVIS_OS_NAME" != "linux" || ./scripts/install_cmake.sh - test "$TRAVIS_OS_NAME" != "linux" || ./scripts/install_cmake.sh
- echo -n "$TRAVIS_COMMIT" > commit_hash.txt - echo -n "$TRAVIS_COMMIT" > commit_hash.txt
- test $SOLC_DOCKER != On || docker build -t ethereum/solc:build -f ./scripts/Dockerfile .
before_script: before_script:
- test $TRAVIS_EMSCRIPTEN != On || ./scripts/build_emscripten.sh - test $SOLC_EMSCRIPTEN != On || ./scripts/build_emscripten.sh
- test $TRAVIS_RELEASE != On || (./scripts/build.sh $TRAVIS_BUILD_TYPE - test $SOLC_RELEASE != On || (./scripts/build.sh $SOLC_BUILD_TYPE
&& ./scripts/release.sh $ZIP_SUFFIX && ./scripts/release.sh $ZIP_SUFFIX
&& ./scripts/create_source_tarball.sh ) && ./scripts/create_source_tarball.sh )
script: script:
- test $TRAVIS_DOCS != On || ./scripts/docs.sh - test $SOLC_DOCS != On || ./scripts/docs.sh
- test $SOLC_TESTS != On || (cd $TRAVIS_BUILD_DIR && ./scripts/tests.sh )
# There are a variety of reliability issues with the Solidity unit-tests at the time of
# writing (especially on macOS), so within TravisCI we will try to run the unit-tests
# up to 3 times before giving up and declaring the tests as broken.
#
# We should aim to remove this "retry logic" as soon as we can, because it is a
# band-aid for issues which need solving at their root. Some of those issues will be
# in Solidity's RPC setup and some will be in 'eth'. It seems unlikely that Solidity
# itself is broken from the failure messages which we are seeing.
#
# More details on known issues at https://github.com/ethereum/solidity/issues/769
- test $TRAVIS_TESTS != On || (cd $TRAVIS_BUILD_DIR && (./scripts/tests.sh || ./scripts/tests.sh || ./scripts/tests.sh) )
env:
global:
- ENCRYPTION_LABEL="6d4541b72666"
- TRAVIS_BUILD_TYPE=RelWithDebInfo
- TRAVIS_DOCS=Off
- TRAVIS_EMSCRIPTEN=Off
- TRAVIS_INSTALL_DEPS=On
- TRAVIS_RELEASE=On
- TRAVIS_TESTS=On
deploy: deploy:
# This is the deploy target for the Emscripten build. # This is the deploy target for the Emscripten build.
@ -182,14 +188,24 @@ deploy:
# Both the build and deploy steps for Emscripten are only run within the Ubuntu # Both the build and deploy steps for Emscripten are only run within the Ubuntu
# configurations (not for macOS). That is controlled by conditionals within the bash # configurations (not for macOS). That is controlled by conditionals within the bash
# scripts because TravisCI doesn't provide much in the way of conditional logic. # scripts because TravisCI doesn't provide much in the way of conditional logic.
- provider: script - provider: script
script: test $TRAVIS_EMSCRIPTEN != On || scripts/release_emscripten.sh script: test $SOLC_EMSCRIPTEN == On || scripts/release_emscripten.sh
skip_cleanup: true
on:
branch:
- develop
- release
# This is the deploy target for the dockerfile. If we are pushing into a develop branch, it will be tagged
# as a nightly and appended the commit of the branch it was pushed in. If we are pushing to master it will
# be tagged as "stable" and given the version tag as well.
- provider: script
script: test $SOLC_DOCKER != On || ./scripts/docker_deploy.sh
skip_cleanup: true skip_cleanup: true
on: on:
branch: branch:
- develop - develop
- release - release
# This is the deploy target for the native build (Linux and macOS) # This is the deploy target for the native build (Linux and macOS)
# which generates ZIPs per commit and the source tarball. # which generates ZIPs per commit and the source tarball.
# #
@ -207,4 +223,4 @@ deploy:
on: on:
all_branches: true all_branches: true
tags: true tags: true
condition: $TRAVIS_RELEASE == On condition: $SOLC_RELEASE == On

View File

@ -1,12 +1,16 @@
FROM alpine FROM alpine
MAINTAINER chriseth <chris@ethereum.org> MAINTAINER chriseth <chris@ethereum.org>
#Official solidity docker image
RUN \ #Establish working directory as solidity
apk --no-cache --update add build-base cmake boost-dev git && \ WORKDIR /solidity
sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp && \ #Copy working directory on travis to the image
git clone --depth 1 --recursive -b develop https://github.com/ethereum/solidity && \ COPY / $WORKDIR
cd /solidity && cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSTATIC_LINKING=1 && \
cd /solidity && make solc && install -s solc/solc /usr/bin && \ #Install dependencies, eliminate annoying warnings, and build release, delete all remaining points and statically link.
cd / && rm -rf solidity && \ RUN ./scripts/install_deps.sh && sed -i -E -e 's/include <sys\/poll.h>/include <poll.h>/' /usr/include/boost/asio/detail/socket_types.hpp &&\
apk del sed build-base git make cmake gcc g++ musl-dev curl-dev boost-dev && \ cmake -DCMAKE_BUILD_TYPE=Release -DTESTS=0 -DSTATIC_LINKING=1 &&\
rm -rf /var/cache/apk/* make solc && install -s solc/solc /usr/bin &&\
cd / && rm -rf solidity &&\
apk del sed build-base git make cmake gcc g++ musl-dev curl-dev boost-dev &&\
rm -rf /var/cache/apk/*

16
scripts/docker_deploy.sh Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env sh
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD";
version=$(grep -oP "PROJECT_VERSION \"?\K[0-9.]+(?=\")"? $(dirname "$0")/../CMakeLists.txt)
if [ "$TRAVIS_BRANCH" == "develop" ]; then
docker tag ethereum/solc:build ethereum/solc:nightly;
docker tag ethereum/solc:build ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT"
docker push ethereum/solc:nightly-"$version"-"$TRAVIS_COMMIT";
docker push ethereum/solc:nightly;
elif [ "$TRAVIS_BRANCH" == "release"]; then
docker tag ethereum/solc:build ethereum/solc:stable;
docker push ethereum/solc:stable;
elif [ "$TRAVIS_TAG" == v"$version"]; then
docker tag ethereum/solc:build ethereum/solc:"$version";
docker push ethereum/solc:"$version";
fi

View File

@ -57,7 +57,7 @@ detect_linux_distro() {
# extract 'foo' from NAME=foo, only on the line with NAME=foo # extract 'foo' from NAME=foo, only on the line with NAME=foo
DISTRO=$(sed -n -e 's/^NAME="\(.*\)\"/\1/p' /etc/os-release) DISTRO=$(sed -n -e 's/^NAME="\(.*\)\"/\1/p' /etc/os-release)
elif [ -f /etc/centos-release ]; then elif [ -f /etc/centos-release ]; then
DISTRO=CentOS DISTRO=CentOS
else else
DISTRO='' DISTRO=''
fi fi
@ -93,19 +93,17 @@ case $(uname -s) in
# Check for Homebrew install and abort if it is not installed. # Check for Homebrew install and abort if it is not installed.
brew -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires a Homebrew install. See http://brew.sh."; exit 1; } brew -v > /dev/null 2>&1 || { echo >&2 "ERROR - solidity requires a Homebrew install. See http://brew.sh."; exit 1; }
brew update brew update
brew upgrade
brew install boost brew install boost
brew install cmake brew install cmake
if ["$CI" = true]; then
# We should really 'brew install' our eth client here, but at the time of writing brew upgrade cmake
# the bottle is known broken, so we will just cheat and use a hardcoded ZIP for brew tap ethereum/ethereum
# the time being, which is good enough. The cause of the breaks will go away brew install cpp-ethereum
# when we commit the repository reorg changes anyway. brew linkapps cpp-ethereum
curl -L -O https://github.com/bobsummerwill/cpp-ethereum/releases/download/v1.3.0/cpp-ethereum-osx-mavericks-v1.3.0.zip else
unzip cpp-ethereum-osx-mavericks-v1.3.0.zip brew upgrade
fi
;; ;;
@ -207,7 +205,6 @@ case $(uname -s) in
# Install "normal packages" # Install "normal packages"
sudo apt-get -y update sudo apt-get -y update
sudo apt-get -y install \ sudo apt-get -y install \
python-sphinx \
build-essential \ build-essential \
cmake \ cmake \
g++ \ g++ \
@ -311,17 +308,17 @@ case $(uname -s) in
sudo apt-get -y update sudo apt-get -y update
sudo apt-get -y install \ sudo apt-get -y install \
python-sphinx \
build-essential \ build-essential \
cmake \ cmake \
git \ git \
libboost-all-dev libboost-all-dev
if [ "$CI" = true ]; then
# Install 'eth', for use in the Solidity Tests-over-IPC. # Install 'eth', for use in the Solidity Tests-over-IPC.
sudo add-apt-repository -y ppa:ethereum/ethereum sudo add-apt-repository -y ppa:ethereum/ethereum
sudo add-apt-repository -y ppa:ethereum/ethereum-dev sudo add-apt-repository -y ppa:ethereum/ethereum-dev
sudo apt-get -y update sudo apt-get -y update
sudo apt-get -y install eth sudo apt-get -y install eth
fi
;; ;;
@ -397,4 +394,4 @@ case $(uname -s) in
echo "If you would like to get your operating system working, that would be fantastic." echo "If you would like to get your operating system working, that would be fantastic."
echo "Drop us a message at https://gitter.im/ethereum/solidity." echo "Drop us a message at https://gitter.im/ethereum/solidity."
;; ;;
esac esac

View File

@ -58,7 +58,7 @@ $ETH_PATH --test -d /tmp/test &
# is available and is ready for the unit-tests to start talking to it. # is available and is ready for the unit-tests to start talking to it.
while [ ! -S /tmp/test/geth.ipc ]; do sleep 2; done while [ ! -S /tmp/test/geth.ipc ]; do sleep 2; done
echo "--> IPC available." echo "--> IPC available."
sleep 2
# And then run the Solidity unit-tests (once without optimization, once with), # And then run the Solidity unit-tests (once without optimization, once with),
# pointing to that IPC endpoint. # pointing to that IPC endpoint.
echo "--> Running tests without optimizer..." echo "--> Running tests without optimizer..."
@ -69,4 +69,4 @@ ERROR_CODE=$?
pkill eth || true pkill eth || true
sleep 4 sleep 4
pgrep eth && pkill -9 eth || true pgrep eth && pkill -9 eth || true
exit $ERROR_CODE exit $ERROR_CODE