onnxruntime/tools/ci_build/github/azure-pipelines/templates/mac-ci.yml
Yulong Wang 009f342caf
[JS] refactor Javascript/Typescript libraries in ONNX Runtime (#7308)
* working on re-organizing js code for ortweb

* remove dup files

* move folder

* fix common references

* fix common es5

* add webpack to common

* split interfact/impl

* use cjs for node

* add npmignore for common

* update sourcemap config for common

* update node

* adjust folder/path in CI and build

* update folder

* nit: readme

* add bundle for dev

* correct nodejs paths

* enable ORT_API_MANUAL_INIT

* set name for umd library

* correct name for commonjs export

* add priority into registerBackend()

* fix npm ci pwd

* update eslintrc

* revise code

* revert package-lock lockfileVersion 2->1

* update prebuild

* resolve comments

* update document

* revise eslint config

* update eslint for typescript rules

* revert changes by mistake in backend.ts

* add env

* resolve comments
2021-04-16 01:33:10 -07:00

96 lines
3.7 KiB
YAML

parameters:
JobName: 'MacOS_CI_Dev'
SubmoduleCheckoutMode: ''
BuildCommand: ''
DoNodejsPack: 'false'
DoNugetPack: 'false'
NuPackScript: ''
ArtifactName: 'drop-osx'
# Controls whether unreleased onnx opsets are allowed. Default is set to 1
AllowReleasedOpsetOnly: '1'
jobs:
- job: ${{ parameters.JobName }}
workspace:
clean: all
timeoutInMinutes: 120
pool:
vmImage: 'macOS-10.14'
variables:
BuildCommand: ${{ parameters.BuildCommand }}
ALLOW_RELEASED_ONNX_OPSET_ONLY: ${{ parameters.AllowReleasedOpsetOnly }}
steps:
- checkout: self
${{ if ne(parameters.SubmoduleCheckoutMode, '') }}:
submodules: ${{ parameters.SubmoduleCheckoutMode }}
- task: UsePythonVersion@0
# Use python 3.8 to avoid build some of the required packages
displayName: Use Python 3.8
inputs:
versionSpec: 3.8
- task: NodeTool@0
inputs:
versionSpec: '12.x'
- script: |
set -e
pushd .
brew install libomp ninja
export CMAKE_GENERATOR=Ninja
cd $(Build.SourcesDirectory)/cmake/external/protobuf
cmake ./cmake -DCMAKE_INSTALL_PREFIX=$(Build.BinariesDirectory)/protobuf -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Relwithdebinfo
ninja -j $(getconf _NPROCESSORS_ONLN)
ninja install
popd
export PATH=$(Build.BinariesDirectory)/protobuf/bin:$PATH
export ONNX_ML=1
export CMAKE_ARGS="-DONNX_GEN_PB_TYPE_STUBS=OFF -DONNX_WERROR=OFF"
sudo python3 -m pip install -r '$(Build.SourcesDirectory)/tools/ci_build/github/linux/docker/scripts/requirements.txt'
sudo xcode-select --switch /Applications/Xcode_10.app/Contents/Developer
${{ parameters.BuildCommand }}
displayName: 'Build and Test OnnxRuntime lib for MacOS'
- task: PublishTestResults@2
displayName: 'Publish unit test results'
inputs:
testResultsFiles: '**/*.results.xml'
searchFolder: '$(Build.BinariesDirectory)'
testRunTitle: 'Unit Test Run'
condition: succeededOrFailed()
- ${{ if eq(parameters['DoNugetPack'], 'true') }}:
- script: |
${{ parameters.NuPackScript }}
displayName: 'Copy MacOS libs to Artifact Staging'
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}'
inputs:
artifactName: ${{ parameters.ArtifactName }}
targetPath: '$(Build.ArtifactStagingDirectory)'
- ${{ if eq(parameters['DoNodejsPack'], 'true') }}:
# Esrp signing
#
# TODO: ESRP team is working on enable signing workflow on Mac. Should enable the following step when it's ready.
#
# - template: mac-esrp-dll.yml
# parameters:
# FolderPath: '$(Build.SourcesDirectory)/js/node/bin/napi-v3/darwin/x64'
# DisplayName: 'ESRP - Sign Node.js binding binaries'
# DoEsrp: ${{ parameters.DoEsrp }}
# Pattern: '*.dylib,*.node'
- script: |
npm pack
cp $(Build.SourcesDirectory)/js/node/onnxruntime-*.tgz $(Build.ArtifactStagingDirectory)
cp -R $(Build.SourcesDirectory)/js/node/prebuilds $(Build.ArtifactStagingDirectory)/prebuilds
workingDirectory: '$(Build.SourcesDirectory)/js/node'
displayName: 'Create NPM Package'
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact: ${{ parameters.ArtifactName }}'
inputs:
artifactName: ${{ parameters.ArtifactName }}
targetPath: '$(Build.ArtifactStagingDirectory)'
- template: component-governance-component-detection-steps.yml
parameters :
condition : 'succeeded'
- template: clean-agent-build-directory-step.yml