Skip to content

Commit

Permalink
Azure pipeline updates
Browse files Browse the repository at this point in the history
Signed-off-by: Lisanna Dettwyler <[email protected]>
  • Loading branch information
lisanna-dettwyler committed Sep 24, 2020
1 parent 35bf3a9 commit 629d5ca
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 65 deletions.
86 changes: 41 additions & 45 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,45 @@ pool:
vmImage: 'ubuntu-latest'

variables:
dockerNamespace: oneapilevelzero
dockerRepo: github-ci-cache
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: eoan
- job: ubuntu_bionic_install
variables:
buildPlatform: ubuntu-bionic
IMAGE_VERSION: bionic-20200807
steps:
- task: Docker@2
displayName: Login to Docker Hub
inputs:
command: login
containerRegistry: DockerHub
- task: Docker@2
displayName: Try to pull master version of image
inputs:
command: pull
arguments: $(dockerRepoFull):level-zero-toolchain-ubuntu-eoan-refs-heads-master
continueOnError: true
- task: Docker@2
displayName: Try to pull prior version of image for same ref
inputs:
command: pull
arguments: $(dockerRepoFull):level-zero-toolchain-ubuntu-eoan-$(refSlug)
continueOnError: true
- task: Docker@2
displayName: Build container
inputs:
command: build
Dockerfile: docker/build-ubuntu.Dockerfile
repository: $(dockerRepoFull)
tags: level-zero-toolchain-ubuntu-eoan-$(refSlug)
tags: level-zero-toolchain-$(buildPlatform)-$(refSlug)
arguments:
--cache-from $(dockerRepoFull):level-zero-toolchain-ubuntu-eoan-refs-heads-master
--build-arg IMAGE_VERSION=eoan-20200114
- script: mkdir $(Build.Repository.LocalPath)/ccache
--cache-from $(dockerRepoFull):level-zero-toolchain-$(buildPlatform)-refs-heads-$(mainBranch)
--build-arg BUILDKIT_INLINE_CACHE=1
--build-arg IMAGE_VERSION
- task: Docker@2
displayName: Push build image to registry cache if on main branch
inputs:
command: push
repository: $(dockerRepoFull)
tags: level-zero-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:
Expand All @@ -53,40 +56,33 @@ jobs:
command: run
arguments:
--rm
-v $(Build.Repository.LocalPath):$(Build.Repository.LocalPath)
-v $(Build.BinariesDirectory):$(Build.BinariesDirectory)
-w $(Build.BinariesDirectory)
-e CCACHE_DIR=$(Build.Repository.LocalPath)/ccache
-e CCACHE_BASEDIR=$(Build.Repository.LocalPath)
$(dockerRepoFull):level-zero-toolchain-ubuntu-eoan-$(refSlug)
-v $(Build.Repository.LocalPath):/project
-w /project/build
-e CCACHE_DIR=/project/ccache
-e CCACHE_BASEDIR=/project
$(dockerRepoFull):level-zero-toolchain-$(buildPlatform)-$(refSlug)
cmake
-G Ninja
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_C_COMPILER_LAUNCHER=ccache
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache
$(Build.Repository.LocalPath)
-D CMAKE_INSTALL_PREFIX=/project/install
..
- task: Docker@2
displayName: CMake build in container
inputs:
command: run
arguments:
--rm
-v $(Build.Repository.LocalPath):$(Build.Repository.LocalPath)
-v $(Build.BinariesDirectory):$(Build.BinariesDirectory)
-w $(Build.BinariesDirectory)
-e CCACHE_DIR=$(Build.Repository.LocalPath)/ccache
-e CCACHE_BASEDIR=$(Build.Repository.LocalPath)
$(dockerRepoFull):level-zero-toolchain-ubuntu-eoan-$(refSlug)
cmake --build . --config Release
- task: Docker@2
displayName: CMake build packages in container
-v $(Build.Repository.LocalPath):/project
-w /project/build
-e CCACHE_DIR=/project/ccache
-e CCACHE_BASEDIR=/project
$(dockerRepoFull):level-zero-toolchain-$(buildPlatform)-$(refSlug)
cmake --build . --target install
- task: PublishPipelineArtifact@1
displayName: Publish level-zero artifact
inputs:
command: run
arguments:
--rm
-v $(Build.Repository.LocalPath):$(Build.Repository.LocalPath)
-v $(Build.BinariesDirectory):$(Build.BinariesDirectory)
-w $(Build.BinariesDirectory)
-e CCACHE_DIR=$(Build.Repository.LocalPath)/ccache
-e CCACHE_BASEDIR=$(Build.Repository.LocalPath)
$(dockerRepoFull):level-zero-toolchain-ubuntu-eoan-$(refSlug)
cmake --build . --config Release --target package
targetPath: $(Build.Repository.LocalPath)/install
artifactName: level-zero-$(buildPlatform)-install
condition: and(succeeded(), eq(variables.isMain, true))
20 changes: 0 additions & 20 deletions docker/build-ubuntu.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,11 @@
ARG IMAGE_VERSION=eoan-20200114
FROM ubuntu:$IMAGE_VERSION

ARG http_proxy
ENV http_proxy=$http_proxy
ARG https_proxy
ENV https_proxy=$https_proxy

RUN apt-get update && apt-get install -y \
build-essential \
ccache \
cmake \
file \
git \
ninja-build \
opencl-headers \
&& rm -rf /var/lib/apt/lists/*

ARG UID=0
ARG UNAME=user
ARG GID=0
RUN groupadd --non-unique --force -g $GID user_group && \
useradd \
--shell /bin/bash \
-u $UID \
-g user_group \
--non-unique \
--comment '' \
--create-home \
$UNAME
USER $UNAME

0 comments on commit 629d5ca

Please sign in to comment.