-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild-for-os.yaml
138 lines (125 loc) · 5.08 KB
/
build-for-os.yaml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
parameters:
- name: dockerTypes
displayName: "Configuration Types"
type: object
default:
- value: "mariner"
displayName: "CBL-Mariner"
id: "mariner"
- value: "ubuntu22.04"
displayName: "Ubuntu 22.04"
id: "ubuntu22_04"
- value: "ubuntu24.04"
displayName: "Ubuntu 24.04"
id: "ubuntu24_04"
- name: testCases
displayName: Test Cases
type: object
default:
- description: "Dynamic"
id: test0
staticBuildParam: ""
sanitizerBuildParam: ""
- description: "Static"
id: test1
staticBuildParam: "-e JBPF_STATIC=1"
sanitizerBuildParam: ""
- description: "Dynamic with ASAN"
id: test2
staticBuildParam: ""
sanitizerBuildParam: "-e SANITIZER=1"
- description: "Static with ASAN"
id: test3
staticBuildParam: "-e JBPF_STATIC=1"
sanitizerBuildParam: "-e SANITIZER=1"
- description: "Experimental Features, Dynamic with ASAN"
id: test4
staticBuildParam: ""
sanitizerBuildParam: "-e SANITIZER=1 -e JBPF_EXPERIMENTAL_FEATURES=1"
- description: "Experimental Features, Static with ASAN"
id: test5
staticBuildParam: "-e JBPF_STATIC=1 -e JBPF_EXPERIMENTAL_FEATURES=1"
sanitizerBuildParam: "-e SANITIZER=1"
- description: "Experimental Features, Dynamic"
id: test6
staticBuildParam: ""
sanitizerBuildParam: "-e JBPF_EXPERIMENTAL_FEATURES=1"
- description: "Experimental Features, Static"
id: test7
staticBuildParam: "-e JBPF_STATIC=1 -e JBPF_EXPERIMENTAL_FEATURES=1"
sanitizerBuildParam: ""
stages:
- stage: CoverageTests
displayName: CoverageTests
dependsOn: []
jobs:
- job: Cleanup
displayName: Cleanup
condition: always()
steps:
- template: agentpool/cleanup.yaml@templates
- job: BuildAndRunCoverageTests
dependsOn: Cleanup
displayName: BuildAndRunCoverageTests
steps:
- template: agentpool/cleanup.yaml@templates
- template: print-debug-info.yaml
- template: build-lib.yaml
parameters:
dockerType: ubuntu22.04
- bash: |
set -x
if ! docker run --init --privileged --network host --cap-add=SYS_ADMIN --shm-size=1g --mount type=tmpfs,destination=/dev/shm -v `pwd`:/jbpf_out_lib -v `pwd`/build:/jbpf/build -e JBPF_PATH=/jbpf -e CLANG_FORMAT_CHECK=1 -e JBPF_COVERAGE=1 -e JBPF_DEBUG=1 $(containerRegistry)/jbpf-lib-ubuntu22.04:$(imageTag); then
echo ERROR Running Coverage Tests
exit 1
fi
cat build/Testing/Temporary/LastTest.log
cp build/Testing/Temporary/LastTest.log $(Build.ArtifactStagingDirectory)
cp -R `pwd`/out/jbpf_coverage.xml $(Build.ArtifactStagingDirectory)
displayName: Run Coverage Tests
continueOnError: false
- task: PublishBuildArtifacts@1
condition: always()
inputs:
ArtifactName: artifacts
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
packageType: sdk
version: 6.0.x
installationPath: $(Agent.ToolsDirectory)/dotnet
# Publish code coverage results v1
# Publish Cobertura or JaCoCo code coverage results from a build.
- task: PublishCodeCoverageResults@2
inputs:
codeCoverageTool: 'Cobertura' # 'Cobertura' | 'JaCoCo'. Required. Code coverage tool. Default: JaCoCo.
summaryFileLocation: 'out/jbpf_coverage.xml'
#pathToSources: # string. Path to Source files.
#reportDirectory: # string. Report directory.
#additionalCodeCoverageFiles: # string. Additional files.
#failIfCoverageEmpty: false # boolean. Fail when code coverage results are missing. Default: false.
- template: agentpool/cleanup.yaml@templates
- ${{ each dockerType in parameters.dockerTypes }}:
- stage: ${{ dockerType.id }}
displayName: ${{ dockerType.displayName }}
dependsOn: []
jobs:
- ${{ each testCase in parameters.testCases }}:
- job: ${{ testCase.id }}_${{ dockerType.id }}
dependsOn: []
displayName: Test - ${{ testCase.description }}
workspace:
clean: all
steps:
- template: agentpool/cleanup.yaml@templates
- template: setup-on-vm.yaml
- template: print-debug-info.yaml
- template: build-lib.yaml
parameters:
dockerType: ${{ dockerType.value }}
- template: standard-tests.yaml
parameters:
dockerType: ${{ dockerType.value }}
testCase: ${{ testCase }}
- template: agentpool/cleanup.yaml@templates
- template: agentpool/cleanup.yaml@templates