Skip to content

Commit f3af310

Browse files
committed
ci: Add continuous integration for macOS, manylinux and Windows wheels
1 parent e80ab15 commit f3af310

File tree

5 files changed

+349
-0
lines changed

5 files changed

+349
-0
lines changed

.circleci/config.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
version: 2
2+
3+
references:
4+
5+
ci_steps: &ci_steps
6+
working_directory: /work
7+
steps:
8+
- checkout
9+
- run:
10+
name: Run CI
11+
command: |
12+
#
13+
# Set UPLOAD_SDIST environment variable
14+
#
15+
export UPLOAD_SDIST=$(echo ${CIRCLE_JOB} | cut -d"_" -f3)
16+
echo "UPLOAD_SDIST [${UPLOAD_SDIST}]"
17+
#
18+
# Run CI
19+
#
20+
export MANYLINUX_PYTHON=$(echo ${CIRCLE_JOB} | cut -d"_" -f2)
21+
echo "MANYLINUX_PYTHON [${MANYLINUX_PYTHON}]"
22+
/opt/python/${MANYLINUX_PYTHON}/bin/pip install scikit-ci
23+
/opt/python/${MANYLINUX_PYTHON}/bin/ci
24+
- persist_to_workspace:
25+
root: ./
26+
paths:
27+
- dist
28+
29+
x64_build_job: &x64_build_job
30+
docker:
31+
- image: dockcross/manylinux-x64
32+
<<: *ci_steps
33+
34+
x86_build_job: &x86_build_job
35+
docker:
36+
- image: dockcross/manylinux-x86
37+
<<: *ci_steps
38+
39+
no_filters: &no_filters
40+
filters:
41+
tags:
42+
only: /.*/
43+
44+
jobs:
45+
46+
# x64
47+
manylinux-x64_cp27-cp27mu:
48+
<<: *x64_build_job
49+
manylinux-x64_cp37-cp37m_upload-sdist:
50+
<<: *x64_build_job
51+
52+
# x86
53+
manylinux-x86_cp27-cp27mu:
54+
<<: *x86_build_job
55+
manylinux-x86_cp37-cp37m:
56+
<<: *x86_build_job
57+
58+
deploy-master:
59+
docker:
60+
- image: circleci/python:3.7.0-stretch
61+
steps:
62+
- attach_workspace:
63+
at: ./
64+
- run:
65+
name: Deploy master
66+
command: |
67+
echo "Deploy master (not implemented)"
68+
69+
deploy-release:
70+
docker:
71+
- image: circleci/python:3.7.0-stretch
72+
steps:
73+
- attach_workspace:
74+
at: ./
75+
- run:
76+
name: Deploy release
77+
command: |
78+
echo "Deploy release"
79+
python -m venv ../venv
80+
. ../venv/bin/activate
81+
pip install twine
82+
ls dist
83+
twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
84+
85+
workflows:
86+
version: 2
87+
build-test-deploy:
88+
jobs:
89+
# x64
90+
- manylinux-x64_cp27-cp27mu:
91+
<<: *no_filters
92+
- manylinux-x64_cp37-cp37m_upload-sdist:
93+
<<: *no_filters
94+
# x86
95+
- manylinux-x86_cp27-cp27mu:
96+
<<: *no_filters
97+
- manylinux-x86_cp37-cp37m:
98+
<<: *no_filters
99+
100+
- deploy-master:
101+
requires:
102+
# x64
103+
- manylinux-x64_cp27-cp27mu
104+
- manylinux-x64_cp37-cp37m_upload-sdist
105+
# x86
106+
- manylinux-x86_cp27-cp27mu
107+
- manylinux-x86_cp37-cp37m
108+
filters:
109+
branches:
110+
only: master
111+
- deploy-release:
112+
requires:
113+
# x64
114+
- manylinux-x64_cp27-cp27mu
115+
- manylinux-x64_cp37-cp37m_upload-sdist
116+
# x86
117+
- manylinux-x86_cp27-cp27mu
118+
- manylinux-x86_cp37-cp37m
119+
filters:
120+
tags:
121+
only: /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
122+
branches:
123+
ignore: /.*/
124+

.travis.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
branches:
2+
only:
3+
- master
4+
- /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
5+
6+
language: python
7+
8+
matrix:
9+
include:
10+
11+
- os: osx
12+
language: generic
13+
env:
14+
- PYTHON_VERSION=3.7.2
15+
16+
- os: osx
17+
language: generic
18+
env:
19+
- PYTHON_VERSION=2.7.15
20+
21+
cache:
22+
directories:
23+
- $HOME/.pyenv/versions/3.7.2
24+
- $HOME/.pyenv/versions/2.7.15
25+
- $HOME/downloads
26+
27+
before_install:
28+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir $HOME/bin; ln -s $(which pip2) $HOME/bin/pip; ln -s $(which python2) $HOME/bin/python; fi
29+
- python -m pip install --disable-pip-version-check --upgrade pip
30+
- pip install -U scikit-ci scikit-ci-addons
31+
- ci_addons --install ../addons
32+
33+
install:
34+
- ci install
35+
36+
script:
37+
- ci test
38+
39+
after_success:
40+
- ci after_test
41+
42+
deploy:
43+
# deploy-release
44+
- provider: script
45+
script: pwd && ls dist;echo "deploy-release" && ~/.pyenv/versions/${PYTHON_VERSION}/bin/twine upload -u $PYPI_USER -p $PYPI_PASSWORD --skip-existing dist/*
46+
skip_cleanup: true
47+
on:
48+
repo: ${TRAVIS_REPO_SLUG}
49+
tags: true
50+
# deploy-master
51+
- provider: script
52+
script: pwd && ls dist;echo "deploy-master" && echo "not implemented"
53+
skip_cleanup: true
54+
on:
55+
repo: ${TRAVIS_REPO_SLUG}
56+
branch: master
57+
58+
env:
59+
global:
60+
# PYPI_USER
61+
- secure: "sA3o5PT2DKbLWuJPTIr678arQbaeeIJ2ALKyyYlbzIQllhXtO3kkLlXmwcoReOKwwfW7VZdCU+G95bBpIsuhs8BjFmtOiZ3wwM93zah1r1MsJt/SybZdAdcZjdK0UCn9uYoU2mKshzpSEEtwfwMbVPeo4koJGQ7quFm1Gg06nmkpUvGmWQt6Fjr8f7xgZ3Rr07LcMjbI/cyuYL2kKPRFVXB8IFgY/ZDl7LjyaiaBc7HNd1W4E47GhF9dLJ3ueKW7kGamqj2/tv7mbrAnKG4F89uj4zIb5BWlo9QDuvs6M6uTf/QlXjb2oZ0KrX8Zt4T6eUz+zSZzpQ8L7P1rn7CwXbx9QksQbe8SKY6jz9yy7gyr9zTglJZySHo/6sMOv1zv9Akya9eVtfw8yENmCX8Q/5cMmmc1AfMwzrXWQrmEETAOPGwCu6LrLlILY2YNAY7B6aNOhxmGm9QZT3BBmkXf5JATPqHL0NC7x8B7yNFeod17To/wMaxpPsitxpsfssg4ff/D9uRw9GVVCp6jjUHHzcyiFHxxdwzfY1YslBqVQYTU8vbGeOm5WpBtdeaHr956NHmRBlvOZ4SpJncXAoAFFbQdajfvXrjjMxKyBdj7aTHOsRSAWmOw+o5Gba71uus2M5f5iDyGHM6hX7t7RSoW/WYubsROU66eUZBWpWkAvh8="
62+
# PYPI_PASSWORD
63+
- secure: "shzENcgaOOVspVbdH0JsXVP9761809YNulGwB6qpBWzy+WURP7lYOSlUiAgSvPV576E80O7VvdUX5s/QQbcZNfLE25+mdSn5LsDocn+/KunKX1uHJkAXz0XpiOeuLMRjIQ+zSbTxVBkk7pe4dw6Y4ug+bSCuoe9IWo/JuOP5TNV2lZuiO2ggyGvXeXNCTJTzPsnCXq4rqbe5UM69JSyM8eGc79IVUUF02UfKhBBL2Six41yVDfN60YW+KLREI/g0/rg3PeagBVzAYvl3wftFxF3TCB6XujoIMPbgP/XFLcJA5+EU+5Uq8tXuPp2oU2UDySMjj67KjnWOsoUtqym7uqGTnN7HtftPGr9K77/KFmYc8OvEhhzzgaNkN2zFpARsYO+X5+KYhEAxD0q7u+7bjs9F8xe3bYFFtZB8DpGkTxlX0qAJ6Q1sNqb3sYDRzXQtCmGY4FO/f1qx0wY824JwaVDRn9GPRifkCoIqN8yuBTEldC8Ht50xiKzOBf+jAuZ7zVJAh9rCwzwQpq0xXY34cTUcOC7tnKVrgXZUxPz79cYeDbJ8VXe0oFPCH8EsgJBQ+7rkvZsljjXH2asH7K3cydECp/00J1HxSTHwq/ek+Sk4WZsLiGBTJUCv7aouBu51orviKeANVFvtsUgkRNwygX+jQAe7bCmQxlInQN7zwtQ="

appveyor.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
branches:
2+
only:
3+
- master
4+
- /^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$/
5+
6+
version: "0.0.1.{build}"
7+
8+
environment:
9+
matrix:
10+
11+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
12+
PYTHON_DIR: "C:\\Python27"
13+
PYTHON_VERSION: "2.7.x"
14+
PYTHON_ARCH: "32"
15+
BLOCK: "0"
16+
17+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
18+
PYTHON_DIR: "C:\\Python27-x64"
19+
PYTHON_VERSION: "2.7.x"
20+
PYTHON_ARCH: "64"
21+
BLOCK: "0"
22+
23+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
24+
PYTHON_DIR: "C:\\Python37"
25+
PYTHON_VERSION: "3.7.x"
26+
PYTHON_ARCH: "32"
27+
BLOCK: "0"
28+
29+
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
30+
PYTHON_DIR: "C:\\Python37-x64"
31+
PYTHON_VERSION: "3.7.x"
32+
PYTHON_ARCH: "64"
33+
BLOCK: "0"
34+
35+
PYPI_USER:
36+
secure: j/nubIi1eucjCtYuwpykWg==
37+
PYPI_PASSWORD:
38+
secure: qDoPKmtLMdcKUKRHuTlfaajjzO4Q4yu25FM5JuB7z84=
39+
40+
cache:
41+
- C:\\cmake-3.6.2
42+
43+
init:
44+
- python -m pip install -U scikit-ci scikit-ci-addons
45+
- python -m ci_addons --install ../addons
46+
47+
- ps: ../addons/appveyor/rolling-build.ps1
48+
49+
install:
50+
- python -m ci install
51+
52+
build_script:
53+
- python -m ci build
54+
55+
test_script:
56+
- python -m ci test
57+
58+
after_test:
59+
- python -m ci after_test
60+
61+
on_finish:
62+
- ps: ../addons/appveyor/enable-worker-remote-access.ps1 -check_for_block
63+
64+
deploy_script:
65+
- ps: |
66+
if ($env:appveyor_repo_tag -eq $true -and $env:appveyor_repo_tag_name –match "^[0-9]+(\.[0-9]+)*(\.post[0-9]+)?$") {
67+
Write-Host "deploy release"
68+
$env:PATH="$env:PYTHON_DIR/Scripts/;$env:PATH"
69+
twine upload -u $env:PYPI_USER -p $env:PYPI_PASSWORD --skip-existing dist/*
70+
} elseif ($env:appveyor_repo_branch -eq "master") {
71+
Write-Host "deploy master (not implemented)"
72+
} else {
73+
Write-Host "nothing to deploy"
74+
}
75+
76+
matrix:
77+
fast_finish: false

scikit-ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
schema_version: "0.5.0"
2+
3+
before_install:
4+
5+
appveyor:
6+
environment:
7+
PATH: $<PYTHON_DIR>;$<PYTHON_DIR>\\Scripts;$<PATH>
8+
commands:
9+
- python ../addons/appveyor/patch_vs2008.py
10+
11+
circle:
12+
environment:
13+
PATH: /opt/python/$<MANYLINUX_PYTHON>/bin:$<PATH>
14+
# Required to build cryptography wheel from source for cp37-cp37 when using manylinux-x86
15+
CFLAGS: -I/usr/local/ssl/include -L/usr/local/ssl/lib
16+
17+
travis:
18+
osx:
19+
environment:
20+
PATH: $<HOME>/.pyenv/versions/$<PYTHON_VERSION>/bin:$<PATH>
21+
SETUP_BDIST_WHEEL_ARGS: --plat-name macosx-10.6-x86_64
22+
commands:
23+
- python ../addons/travis/install_pyenv.py
24+
25+
install:
26+
commands:
27+
- python -c "import sys; print(sys.version)"
28+
- python -m pip install --disable-pip-version-check --upgrade pip
29+
- pip install git+https://github.com/jcfr/wheeltools.git@wheeltools-2018-10-28-a2f174d0e
30+
- pip install -U -r requirements-dev.txt
31+
32+
before_build:
33+
commands:
34+
- flake8
35+
36+
build:
37+
commands:
38+
# Source distribution
39+
- python setup.py --hide-listing sdist
40+
# Built distribution (wheel)
41+
- python setup.py --hide-listing bdist_wheel $<SETUP_BDIST_WHEEL_ARGS> -- $<SETUP_CMAKE_ARGS>
42+
# Cleanup
43+
- python: |
44+
import glob, os
45+
if os.environ.get("UPLOAD_SDIST", "") == "":
46+
sdist=(glob.glob("dist/*.tar.gz") + glob.glob("dist/*.zip"))[0]
47+
print("Deleting [%s]" % sdist)
48+
os.remove(sdist)
49+
50+
circle:
51+
commands:
52+
- |
53+
# Since there are no external shared libraries to bundle into the wheels
54+
# this step will fixup the wheel switching from 'linux' to 'manylinux1' tag
55+
for whl in dist/*$(python -c "import wheel.pep425tags as w; print(w.get_platform())").whl; do
56+
auditwheel repair $whl -w ./dist/
57+
rm $whl
58+
done
59+
60+
test:
61+
commands:
62+
# Convert to generic platform wheel
63+
- python: |
64+
import glob, sys
65+
sys.path.insert(0, "./scripts")
66+
from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel
67+
wheels = glob.glob("dist/*.whl")
68+
for wheel in wheels:
69+
convert_to_generic_platform_wheel(wheel, remove_original=True)
70+
- python setup.py test
71+
72+
after_test:
73+
commands:
74+
- codecov -X gcov --required --file ./tests/coverage.xml

setup.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
[aliases]
22
test = pytest
33

4+
[flake8]
5+
max-line-length: 120
6+
# Whether to display the pep8 instructions on failure (can be quite verbose)
7+
show-pep8: False
8+
# Whether to show source code for each failure
9+
show-source: True
10+
# Maximum cyclomatic complexity allowed
11+
max-complexity: 14
12+
format: pylint
13+
exclude: .git,.idea,.eggs,__pycache__,.tox,docs/conf.py,_skbuild,src,versioneer.py
14+
415
[tool:pytest]
516
testpaths = tests
617
addopts = -v --cov --cov-report xml

0 commit comments

Comments
 (0)