Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

Commit 6c4d40d

Browse files
authored
[MRG] Enable Azure pipelines for builds with uploads to anaconda.org (#23)
1 parent 5762c1b commit 6c4d40d

8 files changed

+440
-28
lines changed
File renamed without changes.

.travis.yml renamed to .travis.yml.back

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,6 @@ after_success:
135135
- pip install wheelhouse-uploader twine
136136
- python -m twine check ${TRAVIS_BUILD_DIR}/wheelhouse/*
137137
- python -m wheelhouse_uploader upload --local-folder
138-
${TRAVIS_BUILD_DIR}/wheelhouse/
139-
$UPLOAD_ARGS
140-
$CONTAINER
138+
${TRAVIS_BUILD_DIR}/wheelhouse/
139+
$UPLOAD_ARGS
140+
$CONTAINER

README.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
1-
.. image:: https://travis-ci.org/MacPython/scikit-learn-wheels.svg?branch=master
2-
:target: https://travis-ci.org/MacPython/scikit-learn-wheels
3-
.. image:: https://ci.appveyor.com/api/projects/status/0vgnsltgf2ghhbr2/branch/master?svg=true
4-
:target: https://ci.appveyor.com/project/sklearn-wheels/scikit-learn-wheels
1+
TODO: add Azure Pipelines badge here
52

63
##########################
74
Scikit-learn wheel builder
85
##########################
96

107
Repository to build scikit-learn wheels.
118

12-
Edit `appveyor.yml` and `.travis.yml` to change the `BUILD_COMMIT` environment
13-
variable to set the name of the git tag to build, commit and push (to master).
9+
Edit `azure/windows.yml` and `azure/posix.yml` to change the `BUILD_COMMIT`
10+
environment variable to set the name of the git tag to build, commit and push
11+
(to master).
1412

15-
Travis and appveyor should automatically build and test that version on
16-
Windows, Linux and OSX for various versions of Python (both 32 bit and 64 bit).
13+
Azure Pipelines should automatically build and test that version on Windows,
14+
Linux and OSX for various versions of Python (both 32 bit and 64 bit).
1715

1816
If the tests pass, the resulting wheels should show up on:
1917

20-
http://wheels.scipy.org
18+
- https://anaconda.org/scikit-learn-wheels-staging for release wheels staging;
19+
- https://anaconda.org/scipy-wheels-nightly for nightly builds.
2120

2221
The following tool can be useful to download all the wheels for a specific
2322
release:
2423

2524
https://github.com/ogrisel/wheelhouse-uploader
2625

2726
and then use `twine` to publish all the wheels along with the locally built
28-
source tarball of the release all at once to PyPI.
27+
source tarball of the release all at once to PyPI.

azure-pipelines.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
schedules:
2+
- cron: "27 3 */1 * *"
3+
# 3:27am UTC everyday
4+
displayName: Nighthly build
5+
branches:
6+
include:
7+
- master
8+
always: true
9+
10+
jobs:
11+
- template: azure/windows.yml
12+
parameters:
13+
name: windows
14+
vmImage: vs2017-win2016
15+
matrix:
16+
py_3.6_32:
17+
PYTHON_VERSION: "3.6.x"
18+
PYTHON_ARCH: "x86"
19+
NP_BUILD_DEP: "1.12.1"
20+
py_3.6_64:
21+
PYTHON_VERSION: "3.6.x"
22+
NP_BUILD_DEP: "1.12.1"
23+
py_3.7_32:
24+
PYTHON_VERSION: "3.7.x"
25+
PYTHON_ARCH: "x86"
26+
NP_BUILD_DEP: "1.14.5"
27+
NIGHTLY_BUILD: "true"
28+
py_3.7_64:
29+
PYTHON_VERSION: "3.7.x"
30+
NP_BUILD_DEP: "1.14.5"
31+
NIGHTLY_BUILD: "true"
32+
py_3.8_32:
33+
PYTHON_VERSION: "3.8.x"
34+
PYTHON_ARCH: "x86"
35+
NP_BUILD_DEP: "1.17.3"
36+
SCIPY_BUILD_DEP: "1.4.1"
37+
NIGHTLY_BUILD: "true"
38+
py_3.8_64:
39+
PYTHON_VERSION: "3.8.x"
40+
NP_BUILD_DEP: "1.17.3"
41+
SCIPY_BUILD_DEP: "1.4.1"
42+
NIGHTLY_BUILD: "true"
43+
44+
- template: azure/posix.yml
45+
parameters:
46+
name: linux
47+
vmImage: ubuntu-16.04
48+
matrix:
49+
py_3.6_32:
50+
MB_PYTHON_VERSION: "3.6"
51+
PLAT: "i686"
52+
py_3.6_64:
53+
MB_PYTHON_VERSION: "3.6"
54+
py_3.7_32:
55+
MB_PYTHON_VERSION: "3.7"
56+
PLAT: "i686"
57+
NP_BUILD_DEP: "numpy==1.14.5"
58+
NIGHTLY_BUILD: "true"
59+
py_3.7_64:
60+
MB_PYTHON_VERSION: "3.7"
61+
NP_BUILD_DEP: "numpy==1.14.5"
62+
NIGHTLY_BUILD: "true"
63+
py_3.8_32:
64+
MB_PYTHON_VERSION: "3.8"
65+
PLAT: "i686"
66+
NP_BUILD_DEP: "numpy==1.17.3"
67+
NIGHTLY_BUILD: "true"
68+
py_3.8_64:
69+
MB_PYTHON_VERSION: "3.8"
70+
NP_BUILD_DEP: "numpy==1.17.3"
71+
NIGHTLY_BUILD: "true"
72+
73+
- template: azure/posix.yml
74+
parameters:
75+
name: macOS
76+
vmImage: xcode9-macos10.13
77+
matrix:
78+
py_3.6_64:
79+
MB_PYTHON_VERSION: "3.6"
80+
NP_BUILD_DEP: "numpy==1.13.3"
81+
py_3.7_64:
82+
MB_PYTHON_VERSION: "3.7"
83+
NP_BUILD_DEP: "numpy==1.14.5"
84+
NIGHTLY_BUILD: "true"
85+
py_3.8_64:
86+
MB_PYTHON_VERSION: "3.8"
87+
NP_BUILD_DEP: "numpy==1.17.3"
88+
NIGHTLY_BUILD: "true"

azure/posix.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
parameters:
2+
name: ""
3+
vmImage: ""
4+
matrix: []
5+
6+
jobs:
7+
- job: ${{ parameters.name }}
8+
pool:
9+
vmImage: ${{ parameters.vmImage }}
10+
variables:
11+
REPO_DIR: "scikit-learn"
12+
BUILD_COMMIT: "0.22.1"
13+
PLAT: "x86_64"
14+
NP_BUILD_DEP: "numpy==1.11.0"
15+
CYTHON_BUILD_DEP: "cython==0.29.14"
16+
SCIPY_BUILD_DEP: "scipy"
17+
JOBLIB_BUILD_DEP: "joblib==0.11"
18+
NIGHTLY_BUILD_COMMIT: "master"
19+
NIGHTLY_BUILD: "false"
20+
TEST_DEPENDS: "pytest"
21+
JUNITXML: "test-data.xml"
22+
TEST_DIR: "tmp_for_test"
23+
strategy:
24+
matrix:
25+
${{ insert }}: ${{ parameters.matrix }}
26+
27+
steps:
28+
- checkout: self
29+
submodules: true
30+
31+
- task: UsePythonVersion@0
32+
inputs:
33+
versionSpec: $(MB_PYTHON_VERSION)
34+
displayName: Set python version
35+
36+
- bash: |
37+
set -e
38+
39+
SKIP_BUILD="false"
40+
if [ "$BUILD_REASON" == "Schedule" ]; then
41+
BUILD_COMMIT=$NIGHTLY_BUILD_COMMIT
42+
if [ "$NIGHTLY_BUILD" != "true" ]; then
43+
SKIP_BUILD="true"
44+
fi
45+
fi
46+
echo "Building scikit-learn@$BUILD_COMMIT"
47+
echo "##vso[task.setvariable variable=BUILD_COMMIT]$BUILD_COMMIT"
48+
echo "##vso[task.setvariable variable=SKIP_BUILD]$SKIP_BUILD"
49+
50+
# Platform variables used in multibuild scripts
51+
if [ `uname` == 'Darwin' ]; then
52+
echo "##vso[task.setvariable variable=TRAVIS_OS_NAME]osx"
53+
echo "##vso[task.setvariable variable=MACOSX_DEPLOYMENT_TARGET]10.9"
54+
else
55+
echo "##vso[task.setvariable variable=TRAVIS_OS_NAME]linux"
56+
fi
57+
58+
# Store original Python path to be able to create test_venv pointing
59+
# to same Python version.
60+
PYTHON_EXE=`which python`
61+
echo "##vso[task.setvariable variable=PYTHON_EXE]$PYTHON_EXE"
62+
displayName: Define build env variables
63+
64+
- bash: |
65+
set -e
66+
pip install virtualenv
67+
BUILD_DEPENDS="$NP_BUILD_DEP $CYTHON_BUILD_DEP $SCIPY_BUILD_DEP"
68+
69+
source multibuild/common_utils.sh
70+
source multibuild/travis_steps.sh
71+
source extra_functions.sh
72+
73+
# Setup build dependencies
74+
before_install
75+
76+
# OpenMP is not present on macOS by default
77+
setup_compiler
78+
clean_code $REPO_DIR $BUILD_COMMIT
79+
build_wheel $REPO_DIR $PLAT
80+
teardown_compiler
81+
displayName: Build wheel
82+
condition: eq(variables['SKIP_BUILD'], 'false')
83+
84+
- bash: |
85+
set -xe
86+
source multibuild/common_utils.sh
87+
source multibuild/travis_steps.sh
88+
source extra_functions.sh
89+
setup_test_venv
90+
install_run $PLAT
91+
teardown_test_venv
92+
displayName: Install wheel and test
93+
condition: eq(variables['SKIP_BUILD'], 'false')
94+
95+
- task: PublishTestResults@2
96+
inputs:
97+
testResultsFiles: '$(TEST_DIR)/$(JUNITXML)'
98+
testRunTitle: ${{ format('{0}-$(Agent.JobName)', parameters.name) }}
99+
displayName: 'Publish Test Results'
100+
condition: eq(variables['SKIP_BUILD'], 'false')
101+
102+
- bash: |
103+
echo "##vso[task.prependpath]$CONDA/bin"
104+
sudo chown -R $USER $CONDA
105+
displayName: Add conda to PATH
106+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
107+
108+
- bash: conda install -q -y anaconda-client
109+
displayName: Install anaconda-client
110+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
111+
112+
- bash: |
113+
set -e
114+
if [ "$BUILD_REASON" == "Schedule" ]; then
115+
ANACONDA_ORG="scipy-wheels-nightly"
116+
TOKEN="$SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN"
117+
else
118+
ANACONDA_ORG="scikit-learn-wheels-staging"
119+
TOKEN="$SCIKIT_LEARN_STAGING_UPLOAD_TOKEN"
120+
fi
121+
if [ "$TOKEN" == "" ]; then
122+
echo "##[warning] Could not find anaconda.org upload token in secret variables"
123+
fi
124+
echo "##vso[task.setvariable variable=TOKEN]$TOKEN"
125+
echo "##vso[task.setvariable variable=ANACONDA_ORG]$ANACONDA_ORG"
126+
displayName: Retrieve secret upload token
127+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
128+
env:
129+
# Secret variables need to mapped to env variables explicitly:
130+
SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN: $(SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN)
131+
SCIKIT_LEARN_STAGING_UPLOAD_TOKEN: $(SCIKIT_LEARN_STAGING_UPLOAD_TOKEN)
132+
133+
- bash: |
134+
set -e
135+
# The --force option forces a replacement if the remote file already
136+
# exists.
137+
ls wheelhouse/*.whl
138+
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG wheelhouse/*.whl
139+
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
140+
displayName: Upload to anaconda.org (only if secret token is retrieved)
141+
condition: ne(variables['TOKEN'], '')

0 commit comments

Comments
 (0)