Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (55 sloc) 2.49 KB
# Build CI pipeline for ML.NET model, its trainer app and end-user WebAPI service
trigger:
- master
# Microsoft hosted agent
pool:
vmImage: 'windows-2019'
# Custom self-hosted agent (Azure VM with Azure DevOps Agent)
#pool:
# name: Default
variables:
buildConfiguration: 'Release'
steps:
- script: 'if not exist X:\ (net use X: \\mlnetfilestorage.file.core.windows.net\datasets /u:mlnetfilestorage $(mlnetfilestorage.key))'
displayName: 'Map disk drive to Azure Files share folder'
- script: dotnet build MLModel.Train/SentimentModel/SentimentModel.ConsoleApp/SentimentModel.ConsoleApp.csproj --configuration $(buildConfiguration)
displayName: 'Build Trainer Console App (dotnet build) $(buildConfiguration)'
- script: dotnet run --project MLModel.Train/SentimentModel/SentimentModel.ConsoleApp/SentimentModel.ConsoleApp.csproj --configuration $(buildConfiguration)
displayName: 'Train ML model (dotnet run)'
# Train running .dll instead of using 'dotnet run'
#- task: DotNetCoreCLI@2
# displayName: 'Train ML model (Task)'
# inputs:
# command: custom
# custom: SentimentModel.ConsoleApp.dll
# workingDirectory: MLModel.Train/SentimentModel/SentimentModel.ConsoleApp/bin/Release/netcoreapp2.1
- script: dotnet build MLModel.Train/UnitTests/UnitTests.csproj --configuration $(buildConfiguration)
displayName: 'Build Test project for ML Model (dotnet build) $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests using trained ML model'
inputs:
command: test
projects: '**/UnitTests.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: CopyFiles@2
displayName: 'Copy ML model file from Trainer app to WebAPI app'
inputs:
SourceFolder: 'MLModel.Train/SentimentModel/SentimentModel.Model'
Contents: 'MLModel.zip'
TargetFolder: 'Scalable.WebAPI/ML'
OverWrite: true
- script: dotnet build Scalable.WebAPI/Scalable.WebAPI.csproj --configuration $(buildConfiguration)
displayName: 'Build WebAPI service (dotnet build) $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: 'Generate WebAPI binaries (dotnet publish)'
inputs:
command: publish
publishWebProjects: false
projects: Scalable.WebAPI/Scalable.WebAPI.csproj
arguments: '--configuration $(buildConfiguration) --output $(Build.ArtifactStagingDirectory)'
modifyOutputPath: false
- task: PublishPipelineArtifact@0
displayName: 'Publish WebAPI as pipeline artifact'
inputs:
artifactName: MLNETWebAPI
targetPath: '$(Build.ArtifactStagingDirectory)'
You can’t perform that action at this time.