-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
release.yml
141 lines (122 loc) · 4.3 KB
/
release.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
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
trigger: none
pr: none
jobs:
- job: validate_version_number
pool:
vmImage: ubuntu-latest
steps:
- template: templates/config-version.yml
parameters:
platform: ubuntu-latest
- script: |
echo $(build_type)
echo $(NNI_RELEASE)
export BRANCH_TAG=`git describe --tags --abbrev=0`
echo $BRANCH_TAG
if [[ $BRANCH_TAG == v$(NNI_RELEASE) && $(NNI_RELEASE) =~ ^[0-9](.(0|[1-9][0-9]*))+$ ]]; then
echo 'Build version match branch tag'
else
echo 'Build version does not match branch tag'
exit 1
fi
condition: eq( variables['build_type'], 'release' )
displayName: Validate release version number and branch tag
- script: |
echo $(build_type)
echo $(NNI_RELEASE)
if [[ $(NNI_RELEASE) =~ ^[0-9](.(0|[1-9][0-9]*))+(a|b|rc)[0-9]$ ]]; then
echo 'Valid prerelease version $(NNI_RELEASE)'
echo `git describe --tags --abbrev=0`
else
echo 'Invalid build version $(NNI_RELEASE)'
exit 1
fi
condition: ne( variables['build_type'], 'release' )
displayName: Validate prerelease version number
- job: linux
dependsOn: validate_version_number
condition: succeeded()
pool:
vmImage: ubuntu-latest
steps:
- template: templates/config-version.yml
parameters:
platform: ubuntu-latest
- script: |
python -m pip install --upgrade pip setuptools wheel twine
python -m pip install -r dependencies/develop.txt
python test/vso_tools/build_wheel.py $(NNI_RELEASE)
displayName: Build wheel
- script: |
if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
echo 'uploading to pypi...'
python -m twine upload -u nni -p $(pypi_password) dist/*
else
echo 'uploading to testpypi...'
python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
fi
displayName: Upload wheel
- script: |
if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
docker login -u msranni -p $(docker_hub_password)
export IMAGE_NAME=msranni/nni
else
docker login -u nnidev -p $(docker_hub_password)
export IMAGE_NAME=nnidev/nni-test
fi
echo "## Building ${IMAGE_NAME}:$(NNI_RELEASE) ##"
docker build --build-arg NNI_RELEASE=$(NNI_RELEASE) -t ${IMAGE_NAME} .
docker tag ${IMAGE_NAME} ${IMAGE_NAME}:v$(NNI_RELEASE)
docker push ${IMAGE_NAME}:v$(NNI_RELEASE)
if [[ $(build_type) != 'rc' ]]; then
docker push ${IMAGE_NAME}
fi
displayName: Build and upload docker image
- job: macos
dependsOn: validate_version_number
condition: succeeded()
pool:
vmImage: macOS-latest
steps:
- template: templates/config-version.yml
parameters:
platform: macOS-latest
- script: |
python -m pip install --upgrade pip setuptools wheel twine
python -m pip install -r dependencies/develop.txt
python test/vso_tools/build_wheel.py $(NNI_RELEASE)
displayName: Build wheel
- script: |
if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
echo '## uploading to pypi ##'
python -m twine upload -u nni -p $(pypi_password) dist/*
else
echo '## uploading to testpypi ##'
python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
fi
displayName: Upload wheel
- job: windows
dependsOn: validate_version_number
condition: succeeded()
pool:
vmImage: windows-latest
steps:
- template: templates/config-version.yml
parameters:
platform: windows-latest
- powershell: |
python -m pip install --upgrade pip setuptools wheel twine
python -m pip install -r dependencies/develop.txt
python test/vso_tools/build_wheel.py $(NNI_RELEASE)
displayName: Build wheel
- powershell: |
if ($env:BUILD_TYPE -eq 'release' -Or $env:BUILD_TYPE -eq 'rc') {
Write-Host '## uploading to pypi ##'
python -m twine upload -u nni -p $(pypi_password) dist/*
} else {
Write-Host '## uploading to testpypi ##'
python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
}
displayName: Upload wheel