Skip to content

Commit

Permalink
added travis build for standalone pex binary
Browse files Browse the repository at this point in the history
  • Loading branch information
rhs committed Aug 21, 2017
1 parent bc8985a commit 6fd6d6d
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.pyc
*.egg-info
build
dist
work
50 changes: 50 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
language: python
sudo: required
os: linux
dist: trusty

cache: pip

services:
- docker

env:
global:
- KUBECONFIG=${HOME}/.kube/kubernaut
- SCOUT_DISABLE=1

install:
- scripts/setup.sh
- pip3 install kubernaut
- kubernaut set-token $KUBERNAUT_TOKEN
- pip install -r dev-requirements.txt
- pip install -r requirements.txt
- scripts/build.sh

before_script:
- kubernaut claim
- scripts/istio.sh

script:
- scripts/test.sh

after_script:
- kubernaut discard

before_deploy:
- echo $(dist/forge --version | cut -d" " -f2) > dist/latest.txt
- mkdir dist/$(cat dist/latest.txt)
- mv dist/forge dist/$(cat dist/latest.txt)
- cat dist/latest.txt | python -c 'import sys, urllib; print urllib.quote(sys.stdin.read().strip())' > dist/latest.url

deploy:
provider: s3
bucket: datawire-static-files
skip_cleanup: true
acl: public_read
local_dir: dist
upload-dir: forge
secret_access_key:
secure: hMVS9Axjso4qfZmbnKIyZyju4nFAVHGr27VsiujGS1DxOZLBiCblrpthpy7ZEyYNjX1fgeWLrrsRiHxuQcTbeWSQVo9mKKW2xjVixs165DYCvgCNGzOaOOp+pNchVBbPcJ7emujdw62fhR7PxzU6JIBVyGeuB8o3CAu2No7LmbPpKNx+Bsi1AoEddtZG7gvjQHBsC0VXHJHC7Q6hSPGL5zKWkQUNA0dKC9DY/IzgaAcdRigyrEQ7qd7eFL7PWztPYTNRO9Z6OtxJQOsrNnhrEwTeLiTdxo5jf/RbsbInxyTHR5Zsunwr/7jZAmqCihbrbFAbdek0cbrluT4LTEmIof67JJYAmH4B3pwn9WaWkDNzVedv4wfNxx5hy5nSwSfkm2aAt0Fnn2ohtseGQ7XOVRLwcVLA9m9yjNIHLaY74Y4M8ElToIre9o34edH27dBOGRIEV4R7Ni49J/PDbqsN1VA0qM8Ap4kvE9F2fkt5Bnz3O0YO8/vAF1eltXk9gcHUw7gXF29h8MxG6AT+BEZleYX2o+n4W9y/XQK8kx957KxJaEQPf6T/jMDzhROPKsVtuPFFwAESuZZZC2RfVdMYFzxr+Z3pvbDCQA+tAWWUkGS9jq6lCX+6aLgCMBgj5I2CpfOyUznbg2DrTMVFE9AmKtUE6UUgsPLUfwXUtPKqmAY=
access_key_id:
secure: 4KuOCvNiFx1PdCWwlXL26MZtikW3PxcncsWO8wnFSVcYF+PXimcmDpFZGUGH/IniPoTcyEVxmX5Kc2Sag6v0A/AfHqVPh40UAJ5vpeEP1vtJy5UWLqyv+mvLFmNT7I33pVXZbPfZOOY+a9Rq1dIPz1M1cpIXMNj7qGMfjzmKhtSbSQhI3uvWt4ZTe43RKWeirnTNb07Cofy7qwB7VwFA0id0Dix6ZndL//BWXCmwPu91LS+x9bQA+lEPSuERAT4m+OO1dUxGIJO3wbscsAPWJxj2fKxjhtk06h9zfRoGOGi9VVd3/I8RtjpNS2N5LM67R4IiPKCWbp5oQKR8lFEL9WMVnPyRPzPaMgvHdePFmXTtMPJKym1GG3CkZCGE3vxvzZC0vl+eaEZElGWgjlAjxnx8hFIn6z3NHwSll/KzHdnhdMHfJzPyo3yQKkof82j+T9sEALqlLs9Yct0xmaRZD/rqysYiZPCamW4bVbER1USdDb4LTQStXZv8xAkWwjR7UyraQPNgOLNXYbTtf8vkAIKRJHjwJaH/6MpXfa23+ha8w77Ic8nI4g8H7nBETkI0sephffAQTYER7ghrN/9luoHsGJca0ktiGSTSL/me85Tt+uh+IhHokvqECWF701lhfDjA8pdtOzGgFURyW7Gd72Nv/qQ6zuw1fPZuub8E6H4=
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
awscli
pex
28 changes: 28 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -e

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

SRC_DIR=${DIR}/..
WHL_DIR=build/wheelhouse
OUTPUT=dist/forge

aws --no-sign-request s3 sync s3://datawire-static-files/wheelhouse $WHL_DIR

cd $WHL_DIR

for whl in $(ls *-manylinux1_*.whl); do
cp $whl $(echo $whl | sed s/manylinux1/linux/)
done

cd $SRC_DIR

pip wheel --no-index --no-deps . -w $WHL_DIR
pex --no-pypi -f $WHL_DIR -r requirements.txt Forge -e forge.cli:call_main -o dist/forge --disable-cache --platform linux_x86_64 --platform linux_i686 --platform macosx_10_11_x86_64
echo "Created ${OUTPUT}"
29 changes: 29 additions & 0 deletions scripts/istio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -e

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

SRC_DIR=${DIR}/..

cat <<EOF | kubectl apply -f -
---
# Pilot service for discovery
apiVersion: v1
kind: ConfigMap
metadata:
name: istio
data:
mesh: |-
# Uncomment the following line to enable mutual TLS between proxies
# authPolicy: MUTUAL_TLS
mixerAddress: istio-mixer:9091
discoveryAddress: istio-pilot:8080
ingressService: istio-ingress
zipkinAddress: zipkin:9411
EOF
24 changes: 24 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -e

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

SRC_DIR=${DIR}/..
BIN_DIR=${HOME}/bin

curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o ${BIN_DIR}/kubectl
chmod +x ${BIN_DIR}/kubectl

ISTIO_VERSION=0.1.6
ISTIO=istio-${ISTIO_VERSION}

curl -L https://github.com/istio/istio/releases/download/${ISTIO_VERSION}/${ISTIO}-linux.tar.gz -o /tmp/istio.tar.gz
tar --no-overwrite-dir -C /tmp -xzf /tmp/istio.tar.gz
mv /tmp/${ISTIO}/bin/istioctl ${HOME}/bin
chmod +x ${BIN_DIR}/istioctl
16 changes: 16 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -e

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

SRC_DIR=${DIR}/..

export PATH=${SRC_DIR}/dist:${PATH}
forge --version
py.test -svv

0 comments on commit 6fd6d6d

Please sign in to comment.