This repository was archived by the owner on Feb 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
BLD Creates and test a source distribution #53
Merged
Merged
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
931a19d
TST Builds source dist and tests
thomasjpfan f81d356
TST Fixes job name
thomasjpfan 951e67d
BUG Fix
thomasjpfan a50c674
BUG Fix
thomasjpfan 02e4adf
BUG Fix
thomasjpfan 9159b08
TST Test using master
thomasjpfan 3a8ae2f
BLD Uses global build commit variable
thomasjpfan 3528457
BUG Fixes anconda upload path
thomasjpfan 680733f
BLD Revert changes
thomasjpfan 1ce00aa
REV Less diffs
thomasjpfan f67b11c
ENH Uses regex
thomasjpfan 7fd811b
BLD Do not upload with pull request
thomasjpfan 19152ca
BLD Fixes commit regex
thomasjpfan df5d798
TST Checks token
thomasjpfan d158698
TST Checks token
thomasjpfan 591b0c9
REV Less diffs
thomasjpfan 1b59296
ENH Run tests
thomasjpfan c6e7e71
DOC Adds comment about setup.py
thomasjpfan 5c6b077
Merge remote-tracking branch 'upstream/master' into sdist_build
thomasjpfan 8be66cd
CLN Address comments
thomasjpfan c5e5317
ENH More like posix.yml
thomasjpfan 5fcfc17
Merge remote-tracking branch 'upstream/master' into sdist_build
thomasjpfan 8a93a6d
BLD Fixes version
thomasjpfan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
jobs: | ||
- job: Linux_Source_Dist | ||
pool: | ||
vmImage: ubuntu-16.04 | ||
variables: | ||
NIGHTLY_BUILD_COMMIT: "master" | ||
NIGHTLY_BUILD: "true" | ||
JUNITXML: "test-data.xml" | ||
TEST_DIR: "tmp_for_test" | ||
TEST_VENV: "test_env" | ||
MB_PYTHON_VERSION: "3.8" | ||
steps: | ||
- checkout: self | ||
submodules: true | ||
- task: UsePythonVersion@0 | ||
inputs: | ||
versionSpec: $(MB_PYTHON_VERSION) | ||
displayName: Set python version | ||
- bash: | | ||
set -e | ||
SKIP_BUILD="false" | ||
if [ "$BUILD_REASON" == "Schedule" ]; then | ||
BUILD_COMMIT=$NIGHTLY_BUILD_COMMIT | ||
if [ "$NIGHTLY_BUILD" != "true" ]; then | ||
SKIP_BUILD="true" | ||
fi | ||
fi | ||
|
||
echo "Building scikit-learn@$BUILD_COMMIT" | ||
echo "##vso[task.setvariable variable=BUILD_COMMIT]$BUILD_COMMIT" | ||
echo "##vso[task.setvariable variable=SKIP_BUILD]$SKIP_BUILD" | ||
displayName: Define build env variables | ||
|
||
- bash: | | ||
set -e | ||
|
||
python -m venv build_env | ||
source build_env/bin/activate | ||
|
||
# Need because setup.py enforces these to be installed | ||
python -m pip install numpy scipy Cython | ||
|
||
cd scikit-learn | ||
git checkout $BUILD_COMMIT | ||
python setup.py sdist | ||
displayName: Create build venv with build dependices and build source dist | ||
|
||
- bash: | | ||
set -e | ||
|
||
source build_env/bin/activate | ||
python -m pip install twine | ||
|
||
twine check scikit-learn/dist/* | ||
displayName: Twine check | ||
- bash: | | ||
set -e | ||
|
||
python -m venv $TEST_VENV | ||
source $TEST_VENV/bin/activate | ||
python --version | ||
python -m pip install -U pip | ||
|
||
# pyproject.toml will be released with >=0.23 | ||
if [[ "$BUILD_COMMIT" =~ ^0.22* ]]; then | ||
python -m pip install Cython | ||
fi | ||
|
||
# Uses pep 517 | ||
pip install scikit-learn/dist/*.tar.gz | ||
displayName: Create test venv and install using source dist | ||
|
||
- bash: | | ||
set -e | ||
source $TEST_VENV/bin/activate | ||
|
||
mkdir $TEST_DIR | ||
cd $TEST_DIR | ||
|
||
python -m pip install pytest | ||
pytest -l --junitxml=$JUNITXML --pyargs sklearn | ||
displayName: Runs tests | ||
|
||
- task: PublishTestResults@2 | ||
inputs: | ||
testResultsFiles: "$(TEST_DIR)/$(JUNITXML)" | ||
testRunTitle: ${{ format('{0}-$(Agent.JobName)', 'Linux_Source_Dist') }} | ||
displayName: "Publish Test Results" | ||
condition: eq(variables['SKIP_BUILD'], 'false') | ||
|
||
- bash: | | ||
echo "##vso[task.prependpath]$CONDA/bin" | ||
sudo chown -R $USER $CONDA | ||
displayName: Add conda to PATH | ||
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest')) | ||
|
||
- bash: conda install -q -y anaconda-client | ||
displayName: Install anaconda-client | ||
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest')) | ||
|
||
- bash: | | ||
set -e | ||
if [ "$BUILD_REASON" == "Schedule" ]; then | ||
ANACONDA_ORG="scipy-wheels-nightly" | ||
TOKEN="$SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN" | ||
else | ||
ANACONDA_ORG="scikit-learn-wheels-staging" | ||
TOKEN="$SCIKIT_LEARN_STAGING_UPLOAD_TOKEN" | ||
fi | ||
if [ "$TOKEN" == "" ]; then | ||
echo "##[warning] Could not find anaconda.org upload token in secret variables" | ||
fi | ||
echo "##vso[task.setvariable variable=TOKEN]$TOKEN" | ||
echo "##vso[task.setvariable variable=ANACONDA_ORG]$ANACONDA_ORG" | ||
displayName: Retrieve secret upload token | ||
condition: and(succeeded(), eq(variables['SKIP_BUILD'], 'false'), ne(variables['Build.Reason'], 'PullRequest')) | ||
env: | ||
# Secret variables need to mapped to env variables explicitly: | ||
SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN: $(SCIKIT_LEARN_NIGHTLY_UPLOAD_TOKEN) | ||
SCIKIT_LEARN_STAGING_UPLOAD_TOKEN: $(SCIKIT_LEARN_STAGING_UPLOAD_TOKEN) | ||
|
||
- bash: | | ||
set -e | ||
# The --force option forces a replacement if the remote file already | ||
adrinjalali marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# exists. | ||
ls scikit-learn/dist/*.tar.gz | ||
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG scikit-learn/dist/*.tar.gz | ||
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple" | ||
displayName: Upload to anaconda.org (only if secret token is retrieved) | ||
condition: ne(variables['TOKEN'], '') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. posix.xml just has |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.