"ts/webui/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "d5921a7312da8c12199e1acb0faf090bebce2b7c"
Commit 2ea753a6 authored by demianzhang's avatar demianzhang Committed by chicm-ms
Browse files

Fix windows pypi pipeline and add win32 version (#1010)

Fix windows pypi pipeline and add win32 version
parent acc311dd
......@@ -172,7 +172,7 @@ jobs:
condition: eq( variables['upload_package'], 'true')
displayName: 'upload nni package to pypi/testpypi'
- job: 'Build_upload_nni_windows'
- job: 'Build_upload_nni_win32'
dependsOn: version_number_validation
condition: succeeded()
pool:
......@@ -182,35 +182,78 @@ jobs:
Python36:
PYTHON_VERSION: '3.6'
steps:
- script: |
python -m pip install --upgrade pip setuptools --user
python -m pip install twine --user
- powershell: |
python -m pip install --upgrade pip setuptools
python -m pip install twine
displayName: 'Install twine'
- script: |
cd deployment/pypi
if [ $(build_type) = 'prerelease' ]
then
- powershell: |
cd deployment\pypi
if($env:BUILD_TYPE -eq 'prerelease'){
# NNI build scripts (powershell) uses branch tag as package version number
git tag $(build_version)
echo 'building prerelease package...'
powershell.exe ./install.ps1 -version_ts $True
else
echo 'building release package...'
powershell.exe ./install.ps1
fi
git tag $env:BUILD_VERSION
Write-Host 'building prerelease package...'
.\install.ps1 -version_os 32 -version_ts $True
}
else{
Write-Host 'building release package...'
.\install.ps1 -version_os 32 -version_ts $False
}
condition: eq( variables['upload_package'], 'true')
displayName: 'build nni bdsit_wheel'
- script: |
cd deployment/pypi
if [ $(build_type) = 'prerelease' ]
then
echo 'uploading prerelease package to testpypi...'
python -m twine upload -u $(testpypi_user) -p $(testpypi_pwd) --repository-url https://test.pypi.org/legacy/ dist/*
else
echo 'uploading release package to pypi...'
python -m twine upload -u $(pypi_user) -p $(pypi_pwd) dist/*
fi
- powershell: |
cd deployment\pypi
if($env:BUILD_TYPE -eq 'prerelease'){
Write-Host 'uploading prerelease package to testpypi...'
python -m twine upload -u $env:TESTPYPI_USER -p $env:TESTPYPI_PWD --repository-url https://test.pypi.org/legacy/ dist/*
}
else{
Write-Host 'uploading release package to pypi...'
python -m twine upload -u $env:PYPI_USER -p $env:PYPI_PWD dist/*
}
condition: eq( variables['upload_package'], 'true')
displayName: 'upload nni package to pypi/testpypi'
- job: 'Build_upload_nni_win_amd64'
dependsOn: version_number_validation
condition: succeeded()
pool:
vmImage: 'vs2017-win2016'
strategy:
matrix:
Python36:
PYTHON_VERSION: '3.6'
steps:
- powershell: |
python -m pip install --upgrade pip setuptools
python -m pip install twine
displayName: 'Install twine'
- powershell: |
cd deployment\pypi
if($env:BUILD_TYPE -eq 'prerelease'){
# NNI build scripts (powershell) uses branch tag as package version number
git tag $env:BUILD_VERSION
Write-Host 'building prerelease package...'
.\install.ps1 -version_os 64 -version_ts $True
}
else{
Write-Host 'building release package...'
.\install.ps1 -version_os 64 -version_ts $False
}
condition: eq( variables['upload_package'], 'true')
displayName: 'build nni bdsit_wheel'
- powershell: |
cd deployment\pypi
if($env:BUILD_TYPE -eq 'prerelease'){
Write-Host 'uploading prerelease package to testpypi...'
python -m twine upload -u $env:TESTPYPI_USER -p $env:TESTPYPI_PWD --repository-url https://test.pypi.org/legacy/ dist/*
}
else{
Write-Host 'uploading release package to pypi...'
python -m twine upload -u $env:PYPI_USER -p $env:PYPI_PWD dist/*
}
condition: eq( variables['upload_package'], 'true')
displayName: 'upload nni package to pypi/testpypi'
\ No newline at end of file
......@@ -47,15 +47,14 @@ This is the PyPI build and upload tool for NNI project.
powershell
Python >= 3.5
Pip
Node.js
Yarn
tar
```
* __How to build__
parameter `version_os` is used to build for Windows 64-bit or 32-bit.
```bash
powershell ./install.ps1
powershell ./install.ps1 -version_os [64/32]
```
* __How to upload__
......@@ -70,4 +69,4 @@ This is the PyPI build and upload tool for NNI project.
```bash
powershell ./upload.ps1 -test $False
```
You may need to input the account and password of https://pypi.org during this process.
\ No newline at end of file
You may need to input the account and password of https://pypi.org during this process.
......@@ -4,4 +4,4 @@ Remove-Item $CWD\build -Recurse -Force
Remove-Item $CWD\dist -Recurse -Force
Remove-Item $CWD\nni -Recurse -Force
Remove-Item $CWD\nni.egg-info -Recurse -Force
Remove-Item $CWD\node-$OS_SPEC-x64 -Recurse -Force
\ No newline at end of file
Remove-Item $CWD\node-$OS_SPEC -Recurse -Force
\ No newline at end of file
param([bool]$version_ts=$false)
param([int]$version_os, [bool]$version_ts=$false)
[System.Net.ServicePointManager]::DefaultConnectionLimit = 100
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$CWD = $PWD
$OS_SPEC = "windows"
$WHEEL_SPEC = "win_amd64"
if($version_os -eq 64){
$OS_VERSION = 'win64'
$WHEEL_SPEC = 'win_amd64'
}
else{
$OS_VERSION = 'win32'
$WHEEL_SPEC = 'win32'
}
$TIME_STAMP = date -u "+%y%m%d%H%M"
$NNI_VERSION_VALUE = git describe --tags --abbrev=0
......@@ -17,18 +25,21 @@ if($version_ts){
$NNI_VERSION_TEMPLATE = "999.0.0-developing"
python -m pip install --user --upgrade setuptools wheel
python -m pip install --upgrade setuptools wheel
$nodeUrl = "https://aka.ms/nni/nodejs-download/win64"
$NNI_NODE_ZIP = "$CWD\node-$OS_SPEC-x64.zip"
$NNI_NODE_FOLDER = "$CWD\node-$OS_SPEC-x64"
$nodeUrl = "https://aka.ms/nni/nodejs-download/" + $OS_VERSION
$NNI_NODE_ZIP = "$CWD\node-$OS_SPEC.zip"
$NNI_NODE_FOLDER = "$CWD\node-$OS_SPEC"
$unzipNodeDir = "node-v*"
(New-Object Net.WebClient).DownloadFile($nodeUrl, $NNI_NODE_ZIP)
if(Test-Path $NNI_NODE_FOLDER){
Remove-Item $NNI_NODE_FOLDER -Recurse -Force
}
New-Item $NNI_NODE_FOLDER -ItemType Directory
cmd /c tar -xf $NNI_NODE_ZIP -C $NNI_NODE_FOLDER --strip-components 1
Expand-Archive $NNI_NODE_ZIP -DestinationPath $CWD
$unzipNodeDir = Get-ChildItem "$CWD\$unzipNodeDir"
Rename-Item $unzipNodeDir $NNI_NODE_FOLDER
$env:PATH = $NNI_NODE_FOLDER+';'+$env:PATH
cd $CWD\..\..\src\nni_manager
yarn
yarn build
......@@ -46,4 +57,4 @@ cd $CWD\nni
yarn --prod
cd $CWD
(Get-Content setup.py).replace($NNI_VERSION_TEMPLATE, $NNI_VERSION_VALUE) | Set-Content setup.py
python setup.py bdist_wheel -p $WHEEL_SPEC
\ No newline at end of file
python setup.py bdist_wheel -p $WHEEL_SPEC
......@@ -34,7 +34,7 @@ else:
data_files = [('bin', ['node-{}-x64/bin/node'.format(os_type.lower())])]
if os_type == 'Windows':
data_files = [('.\Scripts', ['node-{}-x64/node.exe'.format(os_type.lower())])]
data_files = [('.\Scripts', ['node-{}/node.exe'.format(os_type.lower())])]
for (dirpath, dirnames, filenames) in walk('./nni'):
files = [path.normpath(path.join(dirpath, filename)) for filename in filenames]
......
......@@ -3,8 +3,14 @@
$install_node = $true
$install_yarn = $true
if([Environment]::Is64BitOperatingSystem){
$OS_VERSION = 'win64'
}
else{
$OS_VERSION = 'win32'
}
# nodejs
$nodeUrl = "https://aka.ms/nni/nodejs-download/win64"
$nodeUrl = "https://aka.ms/nni/nodejs-download/" + $OS_VERSION
$yarnUrl = "https://yarnpkg.com/latest.tar.gz"
$unzipNodeDir = "node-v*"
$unzipYarnDir = "yarn-v*"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment