Skip to content

Commit

Permalink
Auto publish to PyPI on tagged releases
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed Apr 7, 2019
1 parent 271f1e5 commit 1e11512
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include Cargo.toml
recursive-include src *
37 changes: 36 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,22 @@ jobs:
python setup.py test
displayName: "Python Test"
- script: |
cargo clean
pip install twine
python setup.py build_ext
python -m pip -v wheel . -w .\\dist
dir dist
displayName: "Build wheels"
- task: DownloadSecureFile@1
inputs:
secureFile: .pypirc

- script: 'twine upload --config-file $(Agent.TempDirectory)\.pypirc --skip-existing .\\dist\*'
displayName: "Publish to PyPi"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'))

- job: Linux
pool:
vmImage: 'Ubuntu 16.04'
Expand Down Expand Up @@ -78,10 +94,29 @@ jobs:
- script: |
export PATH=$PATH:$HOME/.cargo/bin
cargo clean
pip install setuptools-rust setuptools pytest wheel
pip install setuptools-rust setuptools pytest wheel==0.31.1
python setup.py test
displayName: "Python Test"
- script: |
export PATH=$PATH:$HOME/.cargo/bin
pip install twine
cargo clean
docker run --rm -v `pwd`:/io quay.io/pypa/manylinux1_x86_64 bash /io/build-wheels.sh
displayName: "Build wheels"
- task: DownloadSecureFile@1
inputs:
secureFile: .pypirc

- task: TwineAuthenticate@0
inputs:
artifactFeeds: 'https://pypi.org/'

- script: 'twine upload --config-file $(Agent.TempDirectory)/.pypirc --skip-existing ./dist/*-manylinux*.whl'
displayName: "Publish to PyPi"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'))

# - job: OSX
# pool:
# vmImage: 'macOS-10.13'
Expand Down
18 changes: 18 additions & 0 deletions build-wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -ex

curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y
export PATH="$HOME/.cargo/bin:$PATH"

cd /io

for PYBIN in /opt/python/{cp27-cp27m,cp27-cp27mu,cp35-cp35m,cp36-cp36m,cp37-cp37m}/bin; do
export PYTHON_SYS_EXECUTABLE="$PYBIN/python"

"${PYBIN}/pip" install -U setuptools wheel==0.31.1 setuptools-rust
"${PYBIN}/python" setup.py bdist_wheel
done

for whl in dist/*.whl; do
auditwheel repair "$whl" -w dist/
done
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools", "wheel==0.31.1", "setuptools-rust"]

0 comments on commit 1e11512

Please sign in to comment.