diff --git a/ci/onnx2bnn_build.yml b/ci/onnx2bnn_build.yml index ca24bcf..c38a2ff 100644 --- a/ci/onnx2bnn_build.yml +++ b/ci/onnx2bnn_build.yml @@ -27,7 +27,7 @@ pr: - dabnn/* jobs: -- job: Linux_AppImage +- job: LinuxAppImage pool: vmImage: 'ubuntu-16.04' steps: @@ -43,63 +43,37 @@ jobs: inputs: contents: 'onnx2bnn.AppImage' targetFolder: $(Build.ArtifactStagingDirectory) - - task: PublishBuildArtifacts@1 - inputs: - pathtoPublish: $(Build.ArtifactStagingDirectory) - artifactName: onnx2bnn AppImage - - task: GitHubRelease@0 - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - inputs: - gitHubConnection: 'dabnn release' - repositoryName: '$(Build.Repository.Name)' - action: 'edit' - tag: '$(Build.SourceBranchName)' - target: '$(Build.SourceVersion)' - assets: '$(Build.ArtifactStagingDirectory)/*' - assetUploadMode: 'replace' -- job: Windows_Python_Package + - template: template_onnx2bnn_publish_artifacts.yml + - template: template_onnx2bnn_github_release.yml +- job: Windows pool: vmImage: 'vs2017-win2016' steps: - checkout: self submodules: true - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.7' - addToPath: true - architecture: 'x64' - - template: template_onnx2bnn_build_python.yml - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.6' - addToPath: true - architecture: 'x64' - - template: template_onnx2bnn_build_python.yml - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.5' - addToPath: true - architecture: 'x64' - - template: template_onnx2bnn_build_python.yml + - template: template_onnx2bnn_build_python_all_version.yml - task: CopyFiles@2 inputs: sourceFolder: '.setuptools-cmake-build\tools\onnx2bnn\Release\' contents: 'onnx2bnn.exe' targetFolder: $(Build.ArtifactStagingDirectory) - - task: GitHubRelease@0 - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) + - template: template_onnx2bnn_publish_artifacts.yml + - template: template_onnx2bnn_github_release.yml + - template: template_onnx2bnn_upload_to_pypi.yml +- job: macOS + pool: + vmImage: 'macOS-10.14' + steps: + - checkout: self + submodules: true + - template: template_onnx2bnn_build_python_all_version.yml + - script: 'cp .setuptools-cmake-build/tools/onnx2bnn/onnx2bnn .setuptools-cmake-build/tools/onnx2bnn/onnx2bnn-macos' + displayName: 'Rename onnx2bnn' + - task: CopyFiles@2 inputs: - gitHubConnection: 'dabnn release' - repositoryName: '$(Build.Repository.Name)' - action: 'edit' - tag: '$(Build.SourceBranchName)' - target: '$(Build.SourceVersion)' - assets: '$(Build.ArtifactStagingDirectory)/*' - assetUploadMode: 'replace' - - script: python -m twine upload dist/* --verbose - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - displayName: Upload wheel to PyPI - workingDirectory: tools/onnx2bnn/python/ - env: - TWINE_USERNAME: $(twineUsername) - TWINE_PASSWORD: $(twinePassword) + sourceFolder: '.setuptools-cmake-build/tools/onnx2bnn' + contents: 'onnx2bnn-macos' + targetFolder: $(Build.ArtifactStagingDirectory) + - template: template_onnx2bnn_publish_artifacts.yml + - template: template_onnx2bnn_github_release.yml + - template: template_onnx2bnn_upload_to_pypi.yml diff --git a/ci/template_onnx2bnn_build_python.yml b/ci/template_onnx2bnn_build_python.yml index 01bf84f..2c3487e 100644 --- a/ci/template_onnx2bnn_build_python.yml +++ b/ci/template_onnx2bnn_build_python.yml @@ -1,6 +1,6 @@ steps: - script: python -m pip install --user --upgrade setuptools wheel twine displayName: Install setuptools, wheel and twine -- script: python setup.py sdist bdist_wheel +- script: python setup.py bdist_wheel workingDirectory: tools/onnx2bnn/python/ displayName: Build onnx2bnn python package diff --git a/ci/template_onnx2bnn_build_python_all_version.yml b/ci/template_onnx2bnn_build_python_all_version.yml new file mode 100644 index 0000000..74e5380 --- /dev/null +++ b/ci/template_onnx2bnn_build_python_all_version.yml @@ -0,0 +1,20 @@ +steps: +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + addToPath: true + architecture: 'x64' +- template: template_onnx2bnn_build_python.yml +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.6' + addToPath: true + architecture: 'x64' +- template: template_onnx2bnn_build_python.yml +- task: UsePythonVersion@0 + inputs: + versionSpec: '3.5' + addToPath: true + architecture: 'x64' +- template: template_onnx2bnn_build_python.yml + diff --git a/ci/template_onnx2bnn_github_release.yml b/ci/template_onnx2bnn_github_release.yml new file mode 100644 index 0000000..0e067e7 --- /dev/null +++ b/ci/template_onnx2bnn_github_release.yml @@ -0,0 +1,12 @@ +steps: +- task: GitHubRelease@0 + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) + inputs: + gitHubConnection: 'dabnn release' + repositoryName: '$(Build.Repository.Name)' + action: 'edit' + tag: '$(Build.SourceBranchName)' + target: '$(Build.SourceVersion)' + assets: '$(Build.ArtifactStagingDirectory)/*' + assetUploadMode: 'replace' + diff --git a/ci/template_onnx2bnn_publish_artifacts.yml b/ci/template_onnx2bnn_publish_artifacts.yml new file mode 100644 index 0000000..f013ada --- /dev/null +++ b/ci/template_onnx2bnn_publish_artifacts.yml @@ -0,0 +1,6 @@ +steps: +- task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: $(Build.ArtifactStagingDirectory) + artifactName: onnx2bnn + diff --git a/ci/template_onnx2bnn_upload_to_pypi.yml b/ci/template_onnx2bnn_upload_to_pypi.yml new file mode 100644 index 0000000..df57b90 --- /dev/null +++ b/ci/template_onnx2bnn_upload_to_pypi.yml @@ -0,0 +1,9 @@ +steps: +- script: python -m twine upload dist/* --verbose + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) + displayName: Upload wheel to PyPI + workingDirectory: tools/onnx2bnn/python/ + env: + TWINE_USERNAME: $(twineUsername) + TWINE_PASSWORD: $(twinePassword) +