This repository was archived by the owner on May 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathwindows.yml
150 lines (142 loc) · 6.13 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
parameters:
name: ""
vmImage: ""
matrix: []
jobs:
- job: ${{ parameters.name }}
pool:
vmImage: ${{ parameters.vmImage }}
variables:
BUILD_COMMIT: "v1.5.3"
NP_BUILD_DEP: "1.17.3"
CYTHON_BUILD_DEP: "0.29.32"
NIGHTLY_BUILD_COMMIT: "main"
NIGHTLY_BUILD: "false"
PYTHON_ARCH: "x64"
TEST_DEPENDS: "pytest pytest-xdist hypothesis==6.52.1"
TEST_DIR: '$(Agent.WorkFolder)/tmp_for_test'
strategy:
matrix:
${{ insert }}: ${{ parameters.matrix }}
steps:
- checkout: self
submodules: true
- task: UsePythonVersion@0
inputs:
versionSpec: $(PYTHON_VERSION)
architecture: $(PYTHON_ARCH)
allowUnstable: true
displayName: Set python version
- bash: |
set -e
echo PYTHON $PYTHON_VERSION $PYTHON_ARCH
echo Build Reason: $BUILD_REASON
python --version
python -c "import struct; print(struct.calcsize('P') * 8)"
pip --version
displayName: Check that we have the expected version and architecture for Python
- 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 pandas@$BUILD_COMMIT"
echo "##vso[task.setvariable variable=BUILD_COMMIT]$BUILD_COMMIT"
echo "##vso[task.setvariable variable=SKIP_BUILD]$SKIP_BUILD"
# Store original Python path to be able to create test_venv pointing
# to same Python version.
PYTHON_EXE=`which python`
echo "##vso[task.setvariable variable=PYTHON_EXE]$PYTHON_EXE"
displayName: Define build env variables
- bash: |
set -e
cd pandas
git checkout $BUILD_COMMIT
git clean -fxd
git reset --hard
displayName: Checkout pandas commit
condition: eq(variables['SKIP_BUILD'], 'false')
- bash: |
set -e
pip install --timeout=60 numpy==$NP_BUILD_DEP
pip install --timeout=60 $TEST_DEPENDS Cython==$CYTHON_BUILD_DEP
pip install versioneer[toml]
pip install twine wheel
pushd pandas
cp "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.29.30133/$PYTHON_ARCH/Microsoft.VC142.CRT/msvcp140.dll" pandas/_libs/window
cp "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.29.30133/$PYTHON_ARCH/Microsoft.VC142.CRT/concrt140.dll" pandas/_libs/window
if [ "$PYTHON_ARCH" == "x64" ]; then
cp "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.29.30133/x64/Microsoft.VC142.CRT/vcruntime140_1.dll" pandas/_libs/window
fi
python setup.py build
python setup.py bdist_wheel
ls dist
twine check dist/*
popd
displayName: Build wheel
condition: eq(variables['SKIP_BUILD'], 'false')
- bash: |
set -e
source extra_functions.sh
source config.sh
setup_test_venv
pip install pandas/dist/pandas-*.whl
run_tests
teardown_test_venv
displayName: Install wheel and test
condition: eq(variables['SKIP_BUILD'], 'false')
- bash: |
if [[ $PYTHON_VERSION == *"-dev"* ]]; then
stripped_ver=$(echo $PYTHON_VERSION | sed -e "s/dev/rc/g")
echo $stripped_ver
echo "##vso[task.setvariable variable=STRIPPED_PYTHON_VERSION]$stripped_ver"
else
echo "##vso[task.setvariable variable=STRIPPED_PYTHON_VERSION]$PYTHON_VERSION"
fi
displayName: Strip dev postfix from PYTHON_VERSION for pre-releases
condition: eq(variables['SKIP_BUILD'], 'false')
- script: |
docker pull python:$(STRIPPED_PYTHON_VERSION)-windowsservercore
docker run -v %cd%:c:\pandas python:$(STRIPPED_PYTHON_VERSION)-windowsservercore /pandas/check_windows_dlls.bat
displayName: Ensure wheel imports correctly
# No Windows images for x86
condition: and(eq(variables['SKIP_BUILD'], 'false'), eq(variables['PYTHON_ARCH'], 'x64'))
- bash: echo "##vso[task.prependpath]$CONDA/Scripts"
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="$PANDAS_NIGHTLY_UPLOAD_TOKEN"
else
ANACONDA_ORG="multibuild-wheels-staging"
TOKEN="$PANDAS_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:
PANDAS_NIGHTLY_UPLOAD_TOKEN: $(PANDAS_NIGHTLY_UPLOAD_TOKEN)
PANDAS_STAGING_UPLOAD_TOKEN: $(PANDAS_STAGING_UPLOAD_TOKEN)
- bash: |
set -e
# The --force option forces a replacement if the remote file already
# exists.
ls pandas/dist/pandas-*.whl
anaconda -t $TOKEN upload --force -u $ANACONDA_ORG pandas/dist/pandas-*.whl
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'], '')