diff options
author | Humberto Jimenez <humberto.jimenez@ni.com> | 2022-03-15 12:15:34 -0500 |
---|---|---|
committer | Humberto Jimenez <31545256+hjimenez-ni@users.noreply.github.com> | 2022-03-15 13:36:26 -0500 |
commit | 8df7d262edd1bc5757603563d0257014f2917be9 (patch) | |
tree | 45eab33cb2a590207dd6b608713a2c12aa0e342f | |
parent | 232a9a7345f0264602caba0caf2b96dd0856aed6 (diff) | |
download | uhd-8df7d262edd1bc5757603563d0257014f2917be9.tar.gz uhd-8df7d262edd1bc5757603563d0257014f2917be9.tar.bz2 uhd-8df7d262edd1bc5757603563d0257014f2917be9.zip |
fpga: ci: Improve IP build caching
-rw-r--r-- | fpga/.ci/templates/job-build-ip.yml | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/fpga/.ci/templates/job-build-ip.yml b/fpga/.ci/templates/job-build-ip.yml index ab58b9fcc..5f7be040c 100644 --- a/fpga/.ci/templates/job-build-ip.yml +++ b/fpga/.ci/templates/job-build-ip.yml @@ -57,13 +57,15 @@ jobs: # 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 + # 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` @@ -72,10 +74,20 @@ jobs: 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') + # 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/ |