# # 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 - ${{ if eq(parameters.clean_build, false) }}: - 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 }} condition: eq(variables.CACHE_RESTORED, 'true') displayName: "Refresh 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 }}