From 59e5966a8c3d8d6938f12e1ab09847470f5087ca Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Tue, 3 Sep 2024 17:53:37 -0700 Subject: [PATCH 1/3] Dont reuse the full deployment deps cache in PRs This means the first PR action will rebuild the deps, however all subsequent PRs will be able to reuse the deps. If a PR changes deps then it will also get cached. Previous changing deps in a PR would rebuild the deps on each deploy. --- actions/build_deploy_python_executable/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actions/build_deploy_python_executable/action.yml b/actions/build_deploy_python_executable/action.yml index 8391dba7..b3f1a923 100644 --- a/actions/build_deploy_python_executable/action.yml +++ b/actions/build_deploy_python_executable/action.yml @@ -38,7 +38,7 @@ runs: # Don't use cached deps if instructed if: ${{ inputs.force_rebuild_deps != 'true' }} # For PR commits, use the target branch name as the cache-tag, for other commits, use the branch name itself - run: echo "FLAG_DEPS_CACHE_FROM=--deps-cache-from=${{ github.repository }}/${{ github.base_ref && github.base_ref || github.ref_name }}" >> $GITHUB_ENV + run: echo "FLAG_DEPS_CACHE_FROM=--deps-cache-from=${{ github.repository }}/${{ github.ref_name }}" >> $GITHUB_ENV shell: bash - name: Set deps-cache-to From 9f27fd7e08d423c44a76464db78bb4308159a386 Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Tue, 3 Sep 2024 18:25:13 -0700 Subject: [PATCH 2/3] Set deps cache to --- actions/build_deploy_python_executable/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/actions/build_deploy_python_executable/action.yml b/actions/build_deploy_python_executable/action.yml index b3f1a923..b68a9b20 100644 --- a/actions/build_deploy_python_executable/action.yml +++ b/actions/build_deploy_python_executable/action.yml @@ -43,7 +43,6 @@ runs: - name: Set deps-cache-to # Only write to the cache-tag for non PR commits so PR commits don't upgrade dependency versions - if: ${{ github.base_ref == '' }} run: echo "FLAG_DEPS_CACHE_TO=--deps-cache-to=${{ github.repository }}/${{ github.ref_name }}" >> $GITHUB_ENV shell: bash From 2eeac1f47997e0494877424b93cb17a5bf13892b Mon Sep 17 00:00:00 2001 From: Shalabh Chaturvedi Date: Tue, 3 Sep 2024 21:29:44 -0700 Subject: [PATCH 3/3] Use repo scoped deps cache --- actions/build_deploy_python_executable/action.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/actions/build_deploy_python_executable/action.yml b/actions/build_deploy_python_executable/action.yml index b68a9b20..7e54ce78 100644 --- a/actions/build_deploy_python_executable/action.yml +++ b/actions/build_deploy_python_executable/action.yml @@ -37,13 +37,11 @@ runs: - name: Set deps-cache-from # Don't use cached deps if instructed if: ${{ inputs.force_rebuild_deps != 'true' }} - # For PR commits, use the target branch name as the cache-tag, for other commits, use the branch name itself - run: echo "FLAG_DEPS_CACHE_FROM=--deps-cache-from=${{ github.repository }}/${{ github.ref_name }}" >> $GITHUB_ENV + run: echo "FLAG_DEPS_CACHE_FROM=--deps-cache-from=${{ github.repository }}" >> $GITHUB_ENV shell: bash - name: Set deps-cache-to - # Only write to the cache-tag for non PR commits so PR commits don't upgrade dependency versions - run: echo "FLAG_DEPS_CACHE_TO=--deps-cache-to=${{ github.repository }}/${{ github.ref_name }}" >> $GITHUB_ENV + run: echo "FLAG_DEPS_CACHE_TO=--deps-cache-to=${{ github.repository }}" >> $GITHUB_ENV shell: bash - name: Set up Python 3.8