Skip to content

Commit

Permalink
Merge pull request #153 from simelo/stdevHan_t152_deploy_arm
Browse files Browse the repository at this point in the history
Fixes #152 Deploy to Circle CI
  • Loading branch information
stdevMac authored Jul 14, 2019
2 parents f22cb2d + 20ba710 commit 834e965
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 276 deletions.
12 changes: 9 additions & 3 deletions .circleci/circle_wheels.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Compile wheels
for PYBIN in /opt/python/*/bin; do
"${PYBIN}/pip" install -r /io/requirements.dev.txt
"${PYBIN}/pip" wheel /io/ -w wheelhouse/
"${PYBIN}/pip" install -r /io/requirements.txt
"${PYBIN}/pip" install -r /io/lib/skyapi/requirements.txt
"${PYBIN}/pip" wheel /io/ -w /io/wheelhouse/
"${PYBIN}/pip" wheel /io/lib/skyapi/ -w /io/wheelhouse/
done

# Bundle external shared libraries into the wheels
for whl in wheelhouse/*.whl; do
for whl in /io/wheelhouse/*.whl; do
auditwheel repair "$whl" -w /io/wheelhouse/
done
done

rm -rfv /io/wheelhouse/*linux_i686.whl
rm -rfv /io/wheelhouse/*linux_x86_64.whl
13 changes: 3 additions & 10 deletions .circleci/circle_wheels_arm.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# Compile wheels
pip wheel /io/ -w /io/wheelhouse/
pip wheel /io/lib/skyapi/ -w /io/wheelhouse/
# python3.4 -m pip wheel /io/ -w wheelhouse/
pip3 wheel /io/lib/skyapi/ -w /io/wheelhouse/
pip3 wheel /io/ -w /io/wheelhouse/
# python3.6 -m pip wheel /io/ -w wheelhouse/
# python3.7 -m pip wheel /io/ -w wheelhouse/

# # Bundle external shared libraries into the wheels
# for whl in wheelhouse/*.whl; do
# python -m auditwheel repair "$whl" -w /io/wheelhouse/
# # python3.4 -m auditwheel repair "$whl" -w /io/wheelhouse/
# python3 -m auditwheel repair "$whl" -w /io/wheelhouse/
# # python3.6 -m auditwheel repair "$whl" -w /io/wheelhouse/
# # python3.7 -m auditwheel repair "$whl" -w /io/wheelhouse/
# done
# python3.7 -m pip wheel /io/ -w wheelhouse/
40 changes: 27 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,70 @@ version: 2
jobs:
manylinux64:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/pyskycoin
steps:
- run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: docker build --build-arg GO_ARCH=amd64 --build-arg ARCH=x86_64 --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
# - run: docker build --build-arg IMAGE=debian --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/test/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
docker_layer_caching: true
- run: docker build --build-arg URL_DEPLOY=https://test.pypi.org/legacy/ --build-arg PYPI_USER=pyskycoin --build-arg PYPI_PASSWD="prerelease_0.X" --build-arg GO_ARCH=amd64 --build-arg ARCH=x86_64 --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test

manylinux32:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/pyskycoin
steps:
- run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: docker build --build-arg GO_ARCH=386 --build-arg ARCH=i686 --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
# - run: docker build --build-arg IMAGE=i386/debian --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/test/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
docker_layer_caching: true
- run: docker build --build-arg URL_DEPLOY=https://test.pypi.org/legacy/ --build-arg PYPI_USER=pyskycoin --build-arg PYPI_PASSWD="prerelease_0.X" --build-arg GO_ARCH=386 --build-arg ARCH=i686 --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test

manylinuxarmv7:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/pyskycoin
steps:
- run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: docker build --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile-arm $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
docker_layer_caching: true
- run: docker build --build-arg URL_DEPLOY=https://test.pypi.org/legacy/ --build-arg PYPI_USER=pyskycoin --build-arg PYPI_PASSWD="prerelease_0.X" --build-arg ARCH=armv7hf --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile-arm $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test

publish-github-release_32:
manylinuxaarch64:
docker:
- image: docker:18.06.0-ce-git
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/pyskycoin
steps:
- run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin
- checkout
- setup_remote_docker:
version: 18.06.0-ce
- run: if [[ $CIRCLE_TAG ]]; then docker build --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg QEMU_PLATFORM=raspberrypi3 --build-arg VERSION --file $GOPATH/src/github.com/skycoin/libskycoin/docker/images/circle/Dockerfile $GOPATH/src/github.com/skycoin/libskycoin -t skydev-deploy ; fi
docker_layer_caching: true
- run: docker build --build-arg URL_DEPLOY=https://test.pypi.org/legacy/ --build-arg PYPI_USER=pyskycoin --build-arg PYPI_PASSWD="prerelease_0.X" --build-arg ARCH=aarch64 --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile-arm $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test

deploy_all:
docker:
- image: circleci/golang:1.12
working_directory: $GOPATH/src/github.com/skycoin/pyskycoin
steps:
- run: mkdir -p $GOPATH/src/github.com/ $GOPATH/src/github.com/skycoin
- checkout
- setup_remote_docker:
version: 18.06.0-ce
docker_layer_caching: true
- run: cd $GOPATH/src/github.com/skycoin/pyskycoin/.circleci && bash deploy.sh

workflows:
version: 2
arm_test:
jobs:
- manylinux64
- manylinux32
- manylinuxarmv7
- publish-github-release_32
# - manylinuxaarch64 TODO: Not working deploy to test.pypi.org
- deploy_all
14 changes: 14 additions & 0 deletions .circleci/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

set -x

git --version

export VERSION="$(git describe --tags --exact-match HEAD)"

if [[ "$VERSION" ]]; then
docker build --build-arg VERSION --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg GO_ARCH=386 --build-arg ARCH=i686 --build-arg $PYPI_USER --build-arg $PYPI_PASSWD --build-arg URL_DEPLOY=https://pypi.org/legacy/ --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-deploy
docker build --build-arg VERSION --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg GO_ARCH=amd64 --build-arg ARCH=x86_64 --build-arg $PYPI_USER --build-arg $PYPI_PASSWD --build-arg URL_DEPLOY=https://pypi.org/legacy/ --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-deploy
docker build --build-arg VERSION --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg $PYPI_USER --build-arg $PYPI_PASSWD --build-arg ARCH=armv7hf --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile-arm $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
docker build --build-arg VERSION --build-arg SHA1=$CIRCLE_SHA1 --build-arg GITHUB_OAUTH_TOKEN --build-arg PROJECT_USERNAME=$CIRCLE_PROJECT_USERNAME --build-arg PROJECT_REPONAME=$CIRCLE_PROJECT_REPONAME --build-arg $PYPI_USER --build-arg $PYPI_PASSWD --build-arg ARCH=aarch64 --file $GOPATH/src/github.com/skycoin/pyskycoin/docker/images/deploy/Dockerfile-arm $GOPATH/src/github.com/skycoin/pyskycoin -t skydev-test
fi
15 changes: 15 additions & 0 deletions .circleci/upload_pypi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -x

if [[ "$URL_DEPLOY" ]]; then

$TWINE_PATH upload -u ${PYPI_USER} -p ${PYPI_PASSWD} --skip-existing --repository-url ${URL_DEPLOY} /io/dist/*

else

$TWINE_PATH upload -u ${PYPI_USER} -p ${PYPI_PASSWD} --skip-existing /io/dist/*
go get github.com/tcnksm/ghr
ghr -t ${GITHUB_OAUTH_TOKEN} -u ${PROJECT_USERNAME} -r ${PROJECT_REPONAME} -c ${SHA1} ${VERSION} /io/dist/

fi
24 changes: 16 additions & 8 deletions docker/images/deploy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,29 @@ ARG ARCH
FROM quay.io/pypa/manylinux1_${ARCH}

ARG GO_ARCH
ARG URL_DEPLOY
ARG PYPI_USER
ARG PYPI_PASSWD

ARG GITHUB_OAUTH_TOKEN
ARG PROJECT_USERNAME
ARG PROJECT_REPONAME
ARG SHA1
ARG VERSION

ADD . /io

RUN ls /io
RUN yum install -y sudo pcre pcre-devel curl git --skip-broken
RUN mkdir -p "$HOME/bin"
ENV PIP "/opt/python/cp27-cp27m/bin/pip"
ENV PIP "/opt/python/cp37-cp37m/bin/pip"
ENV REPO_ROOT "/io/"
RUN curl -sL -o "$HOME/bin/gimme" https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
RUN chmod +x "$HOME/bin/gimme"
ENV PATH="${PATH}:$HOME/bin/gimme"
RUN eval "$(gimme 1.11)"

RUN $PIP install --upgrade pip setuptools tox-travis
RUN $PIP install -r "$REPO_ROOT/requirements.dev.txt"
RUN $PIP install -r "$REPO_ROOT/lib/skyapi/requirements.txt"
RUN $PIP install -r "$REPO_ROOT/lib/skyapi/test-requirements.txt"

RUN mkdir swig_build && \
cd swig_build && \
Expand All @@ -32,8 +38,8 @@ RUN mkdir swig_build && \
cd ../../ && \
rm -rf swig_build

RUN curl -sL -o "go1.11.3.linux-${GO_ARCH}.tar.gz" https://storage.googleapis.com/golang/go1.11.3.linux-${GO_ARCH}.tar.gz
RUN tar -zxf go1.11.3.linux-${GO_ARCH}.tar.gz -C /usr/local
RUN curl -sL -o "go1.11.12.linux-${GO_ARCH}.tar.gz" https://storage.googleapis.com/golang/go1.11.12.linux-${GO_ARCH}.tar.gz
RUN tar -zxf go1.11.12.linux-${GO_ARCH}.tar.gz -C /usr/local
ENV GOROOT=/usr/local/go
ENV PATH="${PATH}:/usr/local/go/bin"
ENV CGO_ENABLE=1
Expand All @@ -44,13 +50,15 @@ RUN go get github.com/gz-c/gox
RUN cd /io && git submodule update --init --recursive
RUN make -C /io/gopath/src/github.com/skycoin/libskycoin dep
RUN make -C /io build-libc
RUN make -C /io build-swig
RUN make -C /io build-swig
RUN mkdir -p /io/wheelhouse
RUN sh /io/.circleci/circle_wheels.sh

RUN ls /io/wheelhouse
RUN mkdir -p /io/dist
RUN cp -v /io/wheelhouse/* /io/dist
RUN $PIP install twine
RUN /opt/python/cp27-cp27m/bin/twine upload -u pyskycoin -p "prerelease_0.X" --skip-existing --repository-url https://test.pypi.org/legacy/ /io/dist/*
ENV TWINE_PATH=/opt/python/cp37-cp37m/bin/twine
RUN bash /io/.circleci/upload_pypi.sh

WORKDIR /io
Loading

0 comments on commit 834e965

Please sign in to comment.