Skip to content

Commit

Permalink
ci: restrict PyTorch cache to just the main branch (llvm#1540)
Browse files Browse the repository at this point in the history
If PyTorch build caches are created on a branch other than the main
branch, then GitHub does not share those caches with the main branch,
making every CI run that runs for each PR slow.  This patch resolves the
problem by letting only the main branch create and use PyTorch build
caches.
  • Loading branch information
ashay authored Oct 31, 2022
1 parent 0701464 commit 2cf1092
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/RollPyTorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ jobs:
git add pytorch-version.txt pytorch-requirements.txt lib/Dialect/Torch/Transforms/ShapeLibrary.cpp include/torch-mlir/Dialect/Torch/IR/GeneratedTorchOps.td
git diff --cached --exit-code || (git commit -m "update PyTorch version to ${{ env.PT_RELEASE }}" && git push --set-upstream origin main)
- name: Update PyTorch Build Cache
- name: Update PyTorch Build Cache (if running on main branch)
if: github.ref_name == 'main'
id: cache-pytorch
uses: actions/cache@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ jobs:
with:
arch: x64

- name: Cache PyTorch Build
if: ${{ matrix.os-arch != 'windows-x86_64' }}
- name: Cache PyTorch Build (if running on main branch)
if: github.ref_name == 'main' && matrix.os-arch != 'windows-x86_64'
id: cache-pytorch
uses: actions/cache@v3
with:
Expand Down

0 comments on commit 2cf1092

Please sign in to comment.