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

Commit 805586a

Browse files
committed
ENH checks tokens first
1 parent e81c90e commit 805586a

File tree

2 files changed

+180
-188
lines changed

2 files changed

+180
-188
lines changed

azure/posix.yml

+85-90
Original file line numberDiff line numberDiff line change
@@ -25,89 +25,79 @@ jobs:
2525
${{ insert }}: ${{ parameters.matrix }}
2626

2727
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'))
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')
111101

112102
- bash: |
113103
set -e
@@ -118,24 +108,29 @@ jobs:
118108
ANACONDA_ORG="scikit-learn-wheels-staging"
119109
TOKEN="$SCIKIT_LEARN_STAGING_UPLOAD_TOKEN"
120110
fi
121-
if [ "$TOKEN" == "" ]; then
122-
echo "##[warning] Could not find anaconda.org upload token in secret variables"
123-
fi
124111
echo "##vso[task.setvariable variable=TOKEN]$TOKEN"
125112
echo "##vso[task.setvariable variable=ANACONDA_ORG]$ANACONDA_ORG"
126113
displayName: Retrieve secret upload token
127-
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'))
114+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN'], variables['SCIKIT_LEARN_STAGING_UPLOAD_TOKEN'])
128115
env:
129116
# Secret variables need to mapped to env variables explicitly:
130117
SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN: $(SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN)
131118
SCIKIT_LEARN_STAGING_UPLOAD_TOKEN: $(SCIKIT_LEARN_STAGING_UPLOAD_TOKEN)
132119
120+
- bash: echo "##vso[task.prependpath]$CONDA/Scripts"
121+
displayName: Add conda to PATH
122+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['TOKEN'])
123+
124+
- bash: conda install -q -y anaconda-client
125+
displayName: Install anaconda-client
126+
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest'), variables['TOKEN'])
127+
133128
- bash: |
134129
set -e
135130
# The --force option forces a replacement if the remote file already
136131
# exists.
137-
ls wheelhouse/*.whl
138-
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG wheelhouse/*.whl
132+
ls scikit-learn/dist/scikit_learn-*.whl
133+
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG scikit-learn/dist/scikit_learn-*.whl
139134
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
140135
displayName: Upload to anaconda.org (only if secret token is retrieved)
141-
condition: ne(variables['TOKEN'], '')
136+
condition: variables['TOKEN']

0 commit comments

Comments
 (0)