Skip to content

Commit

Permalink
update pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
KnicKnic committed Jan 5, 2020
1 parent d12acfb commit 813b2da
Showing 1 changed file with 68 additions and 45 deletions.
113 changes: 68 additions & 45 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,74 +13,97 @@ variables:
solution: '**/*.sln'
buildPlatform: 'x64'
buildConfiguration: 'Release'
GOPATH: 'c:\go_tmp'
GOBIN: '$(GOPATH)\bin'

steps:
- checkout: self
submodules: recursive

- task: NuGetToolInstaller@0
# # build dll
# - task: NuGetToolInstaller@0

- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
# - task: NuGetCommand@2
# inputs:
# restoreSolution: '$(solution)'

- task: VSBuild@1
inputs:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
# - task: VSBuild@1
# inputs:
# solution: '$(solution)'
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'

- task: VSTest@2
# - task: VSTest@2
# inputs:
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'
# - task: PowerShell@2
# inputs:
# targetType: 'inline'
# script: 'choco install -y golang --no-progress;
# refreshenv ;
# copy native-powershell\host.h .\pkg\powershell\ ;
# copy native-powershell\x64\Release\psh_host.dll . ;
# copy native-powershell\x64\Release\psh_host.dll .\pkg\powershell\ ;
# copy native-powershell\x64\Release\psh_host.dll .\tests\benchmarks\ ;'
- task: PowerShell@2
displayName: Copy psh_host
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
targetType: 'inline'
script: '
copy bin\psh_host.dll . ;
copy bin\psh_host.dll .\pkg\powershell\ ;
copy bin\psh_host.dll .\tests\benchmarks\ ;'

- task: PowerShell@2
displayName: "Setup Go environment"
inputs:
targetType: 'inline'
script: 'choco install -y golang --no-progress;
refreshenv ;
copy native-powershell\host.h .\pkg\powershell\ ;
copy native-powershell\x64\Release\psh_host.dll . ;
copy native-powershell\x64\Release\psh_host.dll .\pkg\powershell\ ;
copy native-powershell\x64\Release\psh_host.dll .\tests\benchmarks\ ;
script: '
Write-Host "##vso[task.prependpath]$(GOBIN)";
mkdir c:\go_tmp;
$env:GOPATH="c:\go_tmp";
$env:GOBIN=$env:GOPATH + "\bin";
write-host $env:GOBIN $pwd $env:GOPATH $env:GOROOT;
dir . ;'
- task: CmdLine@2
'

# Go
# Get, build, or test a Go application, or run a custom Go command
- task: Go@0
displayName: 'go build .\...'
inputs:
script: 'go build github.com/KnicKnic/go-powershell/pkg/powershell'
# - task: PowerShell@2
# inputs:
# errorActionPreference: 'continue'
# ignoreLASTEXITCODE: true
# targetType: 'inline'
# script: 'go build -x -v 2>&1 >a.pdb'
command: 'build' # Options: get, build, test, custom
#customCommand: # Required when command == Custom
arguments: '.\...' # Optional

# - task: CopyFiles@2
# inputs:
# sourceFolder: '$(Build.SourcesDirectory)'
# contents: '**/$(BuildConfiguration)/**/?(*.exe|*.dll|*.pdb)'
# TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
# run tests
- task: Go@0
displayName: 'Install gotestsum'
inputs:
sourceFolder: '$(Build.SourcesDirectory)'
contents: '**/?(*.exe|*.dll|*.pdb)'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
command: 'get' # Options: get, build, test, custom
#customCommand: # Required when command == Custom
arguments: 'gotest.tools/gotestsum' # Optional

- task: CmdLine@2
displayName: "Run Tests"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: drop
# run tests
- task: CmdLine@2
script: 'gotestsum --junitfile junit.xml'

- task: PublishTestResults@2
inputs:
script: 'go test github.com/KnicKnic/go-powershell/pkg/powershell'
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit, cTest
testResultsFiles: 'junit.xml'
#searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
#mergeTestResults: false # Optional
failTaskOnFailedTests: true # Optional
#testRunTitle: # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
publishRunAttachments: true # Optional

- task: CmdLine@2
displayName: Build examples_cmd.exe
inputs:
script: 'go build -a -o examples_cmd.exe github.com/KnicKnic/go-powershell/examples/cmd'
- task: PowerShell@2
displayName: Test examples_cmd.exe
inputs:
targetType: 'inline'
script: '.\examples_cmd.exe -command .\\tests\t1.ps1 -command .\\tests\\t2.ps1'

0 comments on commit 813b2da

Please sign in to comment.