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: ...@@ -172,7 +172,7 @@ jobs:
condition: eq( variables['upload_package'], 'true') condition: eq( variables['upload_package'], 'true')
displayName: 'upload nni package to pypi/testpypi' displayName: 'upload nni package to pypi/testpypi'
- job: 'Build_upload_nni_windows' - job: 'Build_upload_nni_win32'
dependsOn: version_number_validation dependsOn: version_number_validation
condition: succeeded() condition: succeeded()
pool: pool:
...@@ -182,35 +182,78 @@ jobs: ...@@ -182,35 +182,78 @@ jobs:
Python36: Python36:
PYTHON_VERSION: '3.6' PYTHON_VERSION: '3.6'
steps: steps:
- script: | - powershell: |
python -m pip install --upgrade pip setuptools --user python -m pip install --upgrade pip setuptools
python -m pip install twine --user python -m pip install twine
displayName: 'Install twine' displayName: 'Install twine'
- script: | - powershell: |
cd deployment/pypi cd deployment\pypi
if [ $(build_type) = 'prerelease' ] if($env:BUILD_TYPE -eq 'prerelease'){
then
# NNI build scripts (powershell) uses branch tag as package version number # NNI build scripts (powershell) uses branch tag as package version number
git tag $(build_version) git tag $env:BUILD_VERSION
echo 'building prerelease package...' Write-Host 'building prerelease package...'
powershell.exe ./install.ps1 -version_ts $True .\install.ps1 -version_os 32 -version_ts $True
else }
echo 'building release package...' else{
powershell.exe ./install.ps1 Write-Host 'building release package...'
fi .\install.ps1 -version_os 32 -version_ts $False
}
condition: eq( variables['upload_package'], 'true') condition: eq( variables['upload_package'], 'true')
displayName: 'build nni bdsit_wheel' displayName: 'build nni bdsit_wheel'
- script: | - powershell: |
cd deployment/pypi cd deployment\pypi
if [ $(build_type) = 'prerelease' ] if($env:BUILD_TYPE -eq 'prerelease'){
then Write-Host 'uploading prerelease package to testpypi...'
echo '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/*
python -m twine upload -u $(testpypi_user) -p $(testpypi_pwd) --repository-url https://test.pypi.org/legacy/ dist/* }
else else{
echo 'uploading release package to pypi...' Write-Host 'uploading release package to pypi...'
python -m twine upload -u $(pypi_user) -p $(pypi_pwd) dist/* python -m twine upload -u $env:PYPI_USER -p $env:PYPI_PWD dist/*
fi }
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') condition: eq( variables['upload_package'], 'true')
displayName: 'upload nni package to pypi/testpypi' 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. ...@@ -47,15 +47,14 @@ This is the PyPI build and upload tool for NNI project.
powershell powershell
Python >= 3.5 Python >= 3.5
Pip Pip
Node.js
Yarn Yarn
tar
``` ```
* __How to build__ * __How to build__
parameter `version_os` is used to build for Windows 64-bit or 32-bit.
```bash ```bash
powershell ./install.ps1 powershell ./install.ps1 -version_os [64/32]
``` ```
* __How to upload__ * __How to upload__
......
...@@ -4,4 +4,4 @@ Remove-Item $CWD\build -Recurse -Force ...@@ -4,4 +4,4 @@ Remove-Item $CWD\build -Recurse -Force
Remove-Item $CWD\dist -Recurse -Force Remove-Item $CWD\dist -Recurse -Force
Remove-Item $CWD\nni -Recurse -Force Remove-Item $CWD\nni -Recurse -Force
Remove-Item $CWD\nni.egg-info -Recurse -Force Remove-Item $CWD\nni.egg-info -Recurse -Force
Remove-Item $CWD\node-$OS_SPEC-x64 -Recurse -Force Remove-Item $CWD\node-$OS_SPEC -Recurse -Force
\ No newline at end of file \ 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 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$CWD = $PWD $CWD = $PWD
$OS_SPEC = "windows" $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" $TIME_STAMP = date -u "+%y%m%d%H%M"
$NNI_VERSION_VALUE = git describe --tags --abbrev=0 $NNI_VERSION_VALUE = git describe --tags --abbrev=0
...@@ -17,18 +25,21 @@ if($version_ts){ ...@@ -17,18 +25,21 @@ if($version_ts){
$NNI_VERSION_TEMPLATE = "999.0.0-developing" $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" $nodeUrl = "https://aka.ms/nni/nodejs-download/" + $OS_VERSION
$NNI_NODE_ZIP = "$CWD\node-$OS_SPEC-x64.zip" $NNI_NODE_ZIP = "$CWD\node-$OS_SPEC.zip"
$NNI_NODE_FOLDER = "$CWD\node-$OS_SPEC-x64" $NNI_NODE_FOLDER = "$CWD\node-$OS_SPEC"
$unzipNodeDir = "node-v*"
(New-Object Net.WebClient).DownloadFile($nodeUrl, $NNI_NODE_ZIP) (New-Object Net.WebClient).DownloadFile($nodeUrl, $NNI_NODE_ZIP)
if(Test-Path $NNI_NODE_FOLDER){ if(Test-Path $NNI_NODE_FOLDER){
Remove-Item $NNI_NODE_FOLDER -Recurse -Force Remove-Item $NNI_NODE_FOLDER -Recurse -Force
} }
New-Item $NNI_NODE_FOLDER -ItemType Directory Expand-Archive $NNI_NODE_ZIP -DestinationPath $CWD
cmd /c tar -xf $NNI_NODE_ZIP -C $NNI_NODE_FOLDER --strip-components 1 $unzipNodeDir = Get-ChildItem "$CWD\$unzipNodeDir"
Rename-Item $unzipNodeDir $NNI_NODE_FOLDER
$env:PATH = $NNI_NODE_FOLDER+';'+$env:PATH
cd $CWD\..\..\src\nni_manager cd $CWD\..\..\src\nni_manager
yarn yarn
yarn build yarn build
......
...@@ -34,7 +34,7 @@ else: ...@@ -34,7 +34,7 @@ else:
data_files = [('bin', ['node-{}-x64/bin/node'.format(os_type.lower())])] data_files = [('bin', ['node-{}-x64/bin/node'.format(os_type.lower())])]
if os_type == 'Windows': 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'): for (dirpath, dirnames, filenames) in walk('./nni'):
files = [path.normpath(path.join(dirpath, filename)) for filename in filenames] files = [path.normpath(path.join(dirpath, filename)) for filename in filenames]
......
...@@ -3,8 +3,14 @@ ...@@ -3,8 +3,14 @@
$install_node = $true $install_node = $true
$install_yarn = $true $install_yarn = $true
if([Environment]::Is64BitOperatingSystem){
$OS_VERSION = 'win64'
}
else{
$OS_VERSION = 'win32'
}
# nodejs # 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" $yarnUrl = "https://yarnpkg.com/latest.tar.gz"
$unzipNodeDir = "node-v*" $unzipNodeDir = "node-v*"
$unzipYarnDir = "yarn-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