-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
93 lines (83 loc) · 3.68 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
jobs:
- job: BuildAndTest
strategy:
matrix:
linux_amd64_3.1.100:
poolName: 'Azure Pipelines'
vmImage: 'ubuntu-latest'
systemName: 'linux'
bazel_startup: '--host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m'
platform: 'linux_amd64_3.1.100'
windows_amd64_3.1.100:
poolName: 'Azure Pipelines'
vmImage: 'windows-2019'
systemName: 'windows'
bazel_startup: '--output_user_root=c:\tmp --host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m'
platform: 'windows_amd64_3.1.100'
darwin_amd64_3.1.100:
poolName: 'Azure Pipelines'
vmImage: 'macOS-10.15'
systemName: 'mac'
bazel_startup: '--host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m'
platform: 'darwin_amd64_3.1.100'
pool:
name: $(poolName)
vmImage: $(vmImage)
steps:
- script: |
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
sudo apt-get update && sudo apt-get install -y bazel
displayName: 'Install dependencies'
condition: and(succeeded(), eq(variables['systemName'], 'linux'))
- script: |
rm /usr/local/bin/bazel || true
brew list bazel && brew remove bazel
brew list bazel || brew install bazel
displayName: 'Install dependencies osx'
condition: and(succeeded(), eq(variables['systemName'], 'mac'))
- script: |
bazel version
displayName: 'Show bazel version'
- script: |
bazel $(bazel_startup) build --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:$(platform) --platforms @io_bazel_rules_dotnet//dotnet/toolchain:$(platform) //:all.build
displayName: 'Build all'
- script: |
bazel $(bazel_startup) test -c dbg --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:$(platform) --platforms @io_bazel_rules_dotnet//dotnet/toolchain:$(platform) @moq4//:Moq.Tests.dll
continueOnError: true
displayName: 'Run moq4 tests'
- script: |
bazel $(bazel_startup) test -c dbg --host_platform @io_bazel_rules_dotnet//dotnet/toolchain:$(platform) --platforms @io_bazel_rules_dotnet//dotnet/toolchain:$(platform) @nunit.3.12//:nunit.framework.tests.dll
continueOnError: true
displayName: 'Run moq4 tests'
- powershell: |
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$template = Resolve-Path "tools/converttests/n3.xslt"
$xslt.Load($template);
function doProcess($file)
{
$result = [io.path]::GetDirectoryName($file) + "/" + [io.path]::GetFileNameWithoutExtension($file) + "-junit.xml"
echo "Processing $file to $result"
[xml]$xml = Get-Content $file
$n = Select-Xml "//testsuites" $xml
if ($n.count -gt 0) {
echo "junit"
copy-item $file $result
} else {
echo "Transforming"
$xslt.Transform($file, $result)
}
}
gci -r bazel-out -filter "test*.xml" -exclude "*-junit.xml" | foreach { doProcess($_.FullName) }
displayName: 'Convert test files'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit' # Options: JUnit, NUnit, VSTest, xUnit
testResultsFiles: 'bazel-testlogs/**/test-junit.xml'
testRunTitle: $(systemName)
buildPlatform: $(systemName)
#searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
#mergeTestResults: false # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
publishRunAttachments: true # Optional