blob: 5f7be040c4e72669870303c928c4e356aa73d9fe (
plain)
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
|
#
# Copyright 2022 Ettus Research, a National Instruments Brand
#
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# Description:
#
# This template should be used for IP builds within the uhddev repository.
# This job uses Azure's caching mechanism to speed up the build. A
# successful job publishes the corresponding build-ip/ directory as a
# pipeline artifact.
#
# See description for the parameters below.
#
parameters:
### Required parameters
# PATH to device's top directory (where Makefile is located)
- name: directory
type: string
# Name of the IP Make target (e.g. X410_IP for X410's IP)
- name: ip_target
type: string
### Optional parameters
# Option to ignore cached artifacts (when available) and perform
# a clean IP build.
- name: clean_build
type: boolean
default: false
jobs:
- job: ${{ parameters.ip_target }}
displayName: 'Build ${{ parameters.ip_target }}'
pool:
name: Hardware
timeoutInMinutes: 240
variables:
- group: sdr-pipeline-vars
steps:
- checkout: self
clean: true
persistCredentials: true
- checkout: hwtools
clean: true
path: s/hwtools/head
persistCredentials: true
# Pipeline caching is leveraged in this job to minimize the time it takes
# to build all the IP.
# At a high level, the pipeline checks for an available and valid cache
# artifact from its scope (target branch in PR or its own branch) and
# downloads it to the workspace (Cache hit).
# If no valid cache artifact exists (Cache miss), then the build will run
# and the pipeline will automatically save the result as a cache artifact
# for subsequent runs.
# Further details on "Pipeline caching" available online:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
# We always allow the Cache task to run, even in clean builds. This way
# when in a cache miss, the IP build from that run will be saved as an
# artifact for subsequent CI and PR runs to fetch.
- task: Cache@2
inputs:
key: "uhddev-fpga-${{ parameters.ip_target }}"
path: ${{ parameters.directory }}/build-ip
cacheHitVar: CACHE_RESTORED
displayName: Cache IP
- bash: |
BUILD_IP_CACHE_HASH=`cat build-ip/.ci/build-hash`
echo "BUILD_IP_CACHE_HASH=$BUILD_IP_CACHE_HASH"
git fetch origin $BUILD_IP_CACHE_HASH
bash $(Build.SourcesDirectory)/uhddev/fpga/.ci/scripts/refresh_ip.sh \
`realpath build-ip/` $BUILD_IP_CACHE_HASH
workingDirectory: ${{ parameters.directory }}
# Refresh IP when caching is allowed (clean_build = false) and a cache
# artifact was fetched.
condition: and(eq('${{ parameters.clean_build }}', 'false'), eq(variables.CACHE_RESTORED, 'true'))
displayName: "Refresh IP"
- bash: |
echo "Clean IP build requested, removing existing build-ip"
rm -rf build-ip
workingDirectory: ${{ parameters.directory }}
# Remove build-ip directory whenever a clean IP build is requested.
condition: eq('${{ parameters.clean_build }}', 'true')
displayName: "Prune IP"
- bash: |
source $(Build.SourcesDirectory)/uhddev/fpga/.ci/scripts/run_setup.sh ./
make ${{ parameters.ip_target }}
mkdir -p build-ip/.ci/
git rev-parse --verify HEAD 2>/dev/null 1>build-ip/.ci/build-hash
workingDirectory: ${{ parameters.directory }}
env:
PATCHES_PATH: $(sdr-vivado-patches)
displayName: "Build IP"
- publish: ${{ parameters.directory }}/build-ip
artifact: '${{ parameters.ip_target }} (Attempt $(System.JobAttempt))'
condition: failed()
- publish: ${{ parameters.directory }}/build-ip
artifact: ${{ parameters.ip_target }}
condition: succeeded()
- template: check_clean_repo_steps.yml
parameters:
directory: ${{ parameters.directory }}
|