"vscode:/vscode.git/clone" did not exist on "d95143d53882409a4d12993db78c77de5fd609bb"
release.yml 4.17 KB
Newer Older
1
2
3
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

liuzhe-lz's avatar
liuzhe-lz committed
4
5
6
trigger: none
pr: none

7
8
9
10
11
12
13
14
15
16
17
18
jobs:
- job: validate_version_number
  pool:
    vmImage: Ubuntu 18.04

  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: 3.8
    displayName: Configure Python version

  - script: |
19
20
      echo $(build_type)
      echo $(NNI_RELEASE)
21
22
      export BRANCH_TAG=`git describe --tags --abbrev=0`
      echo $BRANCH_TAG
23
      if [[ $BRANCH_TAG == v$(NNI_RELEASE) && $(NNI_RELEASE) =~ ^v[0-9](.[0-9])+$ ]]; then
24
25
26
27
28
29
30
31
32
        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: |
33
      echo $(build_type)
34
      echo $(NNI_RELEASE)
35
      if [[ $(NNI_RELEASE) =~ ^[0-9](.[0-9])+(a|b|rc)[0-9]$ ]]; then
36
37
38
39
40
41
        echo 'Valid prerelease version $(NNI_RELEASE)'
        echo `git describe --tags --abbrev=0`
      else
        echo 'Invalid build version $(NNI_RELEASE)'
        exit 1
      fi
42
    condition: ne( variables['build_type'], 'release' )
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    displayName: Validate prerelease version number

- job: linux
  dependsOn: validate_version_number
  condition: succeeded()
  pool:
    vmImage: Ubuntu 18.04

  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: 3.8
    displayName: Configure Python version

  - script: |
liuzhe-lz's avatar
liuzhe-lz committed
58
      python -m pip install --upgrade pip setuptools wheel twine
59
      python test/vso_tools/build_wheel.py $(NNI_RELEASE)
liuzhe-lz's avatar
liuzhe-lz committed
60
    displayName: Build wheel
61

liuzhe-lz's avatar
liuzhe-lz committed
62
  - script: |
63
64
      if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
        echo 'uploading to pypi...'
65
66
        python -m twine upload -u nni -p $(pypi_password) dist/*
      else
67
        echo 'uploading to testpypi...'
68
69
        python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
      fi
liuzhe-lz's avatar
liuzhe-lz committed
70
    displayName: Upload wheel
71
72

  - script: |
73
      if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
74
75
76
77
78
79
80
81
82
83
84
        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}:$(NNI_RELEASE)
      docker push ${IMAGE_NAME}:$(NNI_RELEASE)
85
86
87
      if [[ $(build_type) != 'rc' ]]; then
        docker push ${IMAGE_NAME}
      fi
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    displayName: Build and upload docker image

- job: macos
  dependsOn: validate_version_number
  condition: succeeded()
  pool:
    vmImage: macOS-10.15

  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: 3.8
    displayName: Configure Python version

  - script: |
liuzhe-lz's avatar
liuzhe-lz committed
103
      python -m pip install --upgrade pip setuptools wheel twine
104
      python test/vso_tools/build_wheel.py $(NNI_RELEASE)
liuzhe-lz's avatar
liuzhe-lz committed
105
    displayName: Build wheel
106

liuzhe-lz's avatar
liuzhe-lz committed
107
  - script: |
108
      if [[ $(build_type) == 'release' || $(build_type) == 'rc' ]]; then
109
110
111
112
113
114
        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
liuzhe-lz's avatar
liuzhe-lz committed
115
    displayName: Upload wheel
116
117
118
119
120
121
122
123
124
125
126
127
128
129

- job: windows
  dependsOn: validate_version_number
  condition: succeeded()
  pool:
    vmImage: windows-2019

  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: 3.8
    displayName: Configure Python version

  - powershell: |
liuzhe-lz's avatar
liuzhe-lz committed
130
      python -m pip install --upgrade pip setuptools wheel twine
131
      python test/vso_tools/build_wheel.py $(NNI_RELEASE)
liuzhe-lz's avatar
liuzhe-lz committed
132
    displayName: Build wheel
133

liuzhe-lz's avatar
liuzhe-lz committed
134
  - powershell: |
135
      if ($env:BUILD_TYPE -eq 'release' -Or $env:BUILD_TYPE -eq 'rc') {
136
137
        Write-Host '## uploading to pypi ##'
        python -m twine upload -u nni -p $(pypi_password) dist/*
138
      } else {
139
140
141
        Write-Host '## uploading to testpypi ##'
        python -m twine upload -u nni -p $(pypi_password) --repository-url https://test.pypi.org/legacy/ dist/*
      }
liuzhe-lz's avatar
liuzhe-lz committed
142
    displayName: Upload wheel