forked from oneapi-src/level-zero-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
99 lines (96 loc) · 3.28 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
94
95
96
97
98
99
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
dockerRepoFull: $(dockerNamespace)/$(dockerRepo)
refSlug: $[ lower(replace(variables['Build.SourceBranch'], '/', '-')) ]
mainBranch: master
isMain: $[eq(variables['Build.SourceBranch'], format('refs/heads/{0}', variables['mainBranch']))]
DOCKER_BUILDKIT: 1
jobs:
- job: ubuntu_bionic_install
variables:
buildPlatform: ubuntu-bionic
steps:
- checkout: self
submodules: true
- task: Docker@2
displayName: Login to Docker Hub
inputs:
command: login
containerRegistry: DockerHub
- task: Docker@2
displayName: Build container
inputs:
command: build
Dockerfile: docker/build-ubuntu.Dockerfile
repository: $(dockerRepoFull)
tags: level-zero-tests-toolchain-$(buildPlatform)-$(refSlug)
arguments:
--cache-from $(dockerRepoFull):level-zero-tests-toolchain-$(buildPlatform)-refs-heads-$(mainBranch)
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg IMAGE_VERSION=bionic-20200807
- task: Docker@2
displayName: Push build image to registry cache if on main branch
inputs:
command: push
repository: $(dockerRepoFull)
tags: level-zero-tests-toolchain-$(buildPlatform)-$(refSlug)
condition: and(succeeded(), eq(variables.isMain, true))
- script: |
mkdir $(Build.Repository.LocalPath)/ccache
mkdir $(Build.Repository.LocalPath)/build
mkdir $(Build.Repository.LocalPath)/install
- task: Cache@2
displayName: ccache
inputs:
key: ccache | $(Agent.OS) | "$(Build.Repository.ID)" | $(Build.SourceVersion)
path: $(Build.Repository.LocalPath)/ccache
restoreKeys: ccache | $(Agent.OS) | "$(Build.Repository.ID)"
- task: DownloadPipelineArtifact@2
displayName: Download level-zero artifact
inputs:
source: specific
project: $(System.TeamProjectId)
pipeline: 2
runVersion: latestFromBranch
artifact: level-zero-$(buildPlatform)-install
path: $(Build.Repository.LocalPath)/level-zero
- task: Docker@2
displayName: CMake configure in container
inputs:
command: run
arguments:
--rm
-v $(Build.Repository.LocalPath):/project
-w /project/build
-e CCACHE_DIR=/project/ccache
-e CCACHE_BASEDIR=/project
$(dockerRepoFull):level-zero-tests-toolchain-$(buildPlatform)-$(refSlug)
cmake
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
-D CMAKE_PREFIX_PATH=/project/level-zero
-D CMAKE_INSTALL_PREFIX=/project/install
..
- task: Docker@2
displayName: CMake build in container
inputs:
command: run
arguments:
--rm
-v $(Build.Repository.LocalPath):/project
-w /project/build
-e CCACHE_DIR=/project/ccache
-e CCACHE_BASEDIR=/project
$(dockerRepoFull):level-zero-tests-toolchain-$(buildPlatform)-$(refSlug)
cmake --build . --target install
- task: PublishPipelineArtifact@1
displayName: Publish level-zero-tests artifact
inputs:
targetPath: $(Build.Repository.LocalPath)/install
artifactName: level-zero-tests-$(buildPlatform)-install
condition: and(succeeded(), eq(variables.isMain, true))