Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stdevHan_t152_deploy_arm' into s…
Browse files Browse the repository at this point in the history
…tdevRulo_t131_automate_pypi_release_of_skyapi
  • Loading branch information
e1Ru1o committed Jul 13, 2019
2 parents de547ad + 20ba710 commit ca44024
Show file tree
Hide file tree
Showing 28 changed files with 593 additions and 611 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
23 changes: 11 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@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hiJoOM30UbH00mdT5Fz+6HqYqFieijX/Li2fExqXXp6Za4VHMrwImrXoYQw4350F8b6QzF7E4WouBBysBZIkBEswp69783uU1lGcbU0wnyj8SN6rYIPO03MG1e5HO+Dd9avMtCMdGj3qsNlmfK0v3fAGjrYsStMQtrfOUZGTahrHPh7P3VPB4qmsJ7eNo+lFtLN0I2+ehoqMd3UH+qggdFdLQFGVMe0SWCUV9Aoyxo9vVqbnPzclsmWL44M6YRDIgOtochNiDINbdx/EA/L517GrpSDjZwvhrJkoCE7Wr9m5YcC+x8qQXCpQ4dcYAJ4C+okASAIwtjOai5dQB7TfHJfN5XzSLUI=

matrix:
include:
Expand Down Expand Up @@ -70,6 +63,10 @@ matrix:
- PYTHON=3.7.1
- TOXENV=py37

env:
global:
-CGO_ENABLED: 1

before_install:
- if [[ "$TRAVIS_OS_NAME" == 'linux' ]]; then bash ./.travis/install-linux.sh ; fi
- if [[ "$TRAVIS_OS_NAME" == 'osx' ]]; then bash ./.travis/install-osx.sh; fi
Expand All @@ -90,11 +87,13 @@ before_install:
install:
- eval "$(gimme 1.11)"
script:
# Test PySkycoin
- make sdist
- make bdist_wheel
- if [ $TRAVIS_OS_NAME == "linux" ]; then make bdist_manylinux_amd64 ; fi
- bash ./.travis/skyapi_deploy.sh
# Compile lib
- make build && make develop
# Format code to PEP8
- make format
# Linter code to pylint
- make lint
# Test PySkycoin
- make test-ci
after_failure:
- cat ./.tox/${TOXENV}/log/${TOXENV}-*.log
Expand Down
3 changes: 1 addition & 2 deletions .travis/install-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ curl -sL -o "$HOME/bin/gimme" https://raw.githubusercontent.com/travis-ci/gimme/
chmod +x "$HOME/bin/gimme"

# Install Python libraries
$PIP install --upgrade pip setuptools tox-travis
$PIP install --upgrade pip setuptools tox-travis
$PIP install -r "$REPO_ROOT/requirements.dev.txt"
$PIP install -r "$REPO_ROOT/lib/skyapi/requirements.txt"
$PIP install -r "$REPO_ROOT/lib/skyapi/test-requirements.txt"
Expand All @@ -32,4 +32,3 @@ mkdir swig_build && \
sudo make install && \
cd ../../ && \
sudo rm -rf swig_build

5 changes: 3 additions & 2 deletions .travis/install-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ git show 42d31bba7772fb01f9ba442d9ee98b33a6e7a055:Formula/swig.rb | grep -v 'fai
echo 'Installing [email protected] (3.0.12)';
brew install swig || brew link --overwrite swig;
brew install gimme;
brew install yamllint;

# Install Python
pyenv install ${PYTHON}
Expand All @@ -28,5 +29,5 @@ export PYCMD_PATH="$(pyenv which python${PYCMD_VERSION})"
export PYCMD_DIRPATH="$( dirname ${PYCMD_PATH} )"
export PATH="${PYCMD_DIRPATH}:/Users/travis/.pyenv/shims:${PATH}"

eval "python${PYCMD_VERSION} -m pip install --upgrade pip setuptools wheel tox tox-pyenv pytest pytest-runner"
eval "python${PYCMD_VERSION} -m pip install --upgrade pip setuptools wheel tox tox-pyenv pytest pytest-runner pylint autopep8"

16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ dist: sdist bdist_wheel bdist_manylinux_amd64 ## Create distribution archives
check-dist: dist ## Perform self-tests upon distributions archives
docker run --rm -t -v $(REPO_ROOT):/io quay.io/pypa/manylinux1_i686 linux32 /io/.travis/check_wheels.sh

format: ## Format code that autopep8
autopep8 --in-place --aggressive --aggressive --aggressive --aggressive ./tests/*.py

lint: ## Linter to pylint
pylint -E tests/*.py
# yamllint -d relaxed .travis.yml

clean: #Clean all
make -C $(SKYLIBC_DIR) clean-libc
python -m pip uninstall pyskycoin
Expand All @@ -139,6 +146,15 @@ clean: #Clean all
rm -rfv tests/utils/__pycache__
rm -rfv *.so
rm -rfv qemu_python_*
rm -rfv lib/skyapi/skyapi/__pycache__
rm -rfv lib/skyapi/skyapi/*.pyc
rm -rfv lib/skyapi/skyapi/models/*.pyc
rm -rfv lib/skyapi/skyapi/models/__pycache__
rm -rfv lib/skyapi/skyapi/api/*.pyc
rm -rfv lib/skyapi/skyapi/api/__pycache__
rm -rfv lib/skyapi/test/__pycache__
rm -rfv lib/skyapi/test/*.pyc


help: ## List available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
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 ca44024

Please sign in to comment.