Skip to content

Commit

Permalink
CI: clear workspace directory before checkout (#1900)
Browse files Browse the repository at this point in the history
We have recently started seeing errors like:

```
  Synchronizing submodule url for 'externals/llvm-project'
  Synchronizing submodule url for 'externals/mlir-hlo'
  /usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1
  Error: fatal: Unable to create '/home/anush/actions-runner/_work/torch-mlir/torch-mlir/.git/modules/externals/llvm-project/index.lock': File exists.
```

As a workaround, this patch removes the workspace directory before the
checkout step.
  • Loading branch information
ashay committed Feb 24, 2023
1 parent 2072292 commit ea00371
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/RollPyTorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ jobs:
if: github.repository == 'llvm/torch-mlir'

steps:
- name: chown $GITHUB_WORKSPACE

- name: Prepare workspace
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Get torch-mlir
uses: actions/checkout@v3
with:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/bazelBuildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Prepare workspace
run: |
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Checkout torch-mlir
uses: actions/checkout@v3
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ jobs:

steps:

- name: chown $GITHUB_WORKSPACE
- name: Prepare workspace
if: ${{ matrix.os-arch == 'ubuntu-x86_64' }}
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Checkout torch-mlir
uses: actions/checkout@v3
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/buildRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ jobs:
name: Manylinux Build
runs-on: a100
steps:
- name: chown $GITHUB_WORKSPACE

- name: Prepare workspace
run: |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Get torch-mlir
uses: actions/checkout@v3
with:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/gh-pages-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ jobs:
if: github.repository == 'llvm/torch-mlir'

steps:
- name: Prepare workspace
run: |
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}
- name: Run scrape releases script
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/oneshotSnapshotPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ jobs:
# Don't run this in everyone's forks.
if: github.repository == 'llvm/torch-mlir'
steps:
- name: Prepare workspace
run: |
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/releaseSnapshotPackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ jobs:
# Don't run this in everyone's forks.
if: github.repository == 'llvm/torch-mlir'
steps:

- name: Prepare workspace
run: |
# Clear the workspace directory so that we don't run into errors about
# existing lock files.
rm -rf $GITHUB_WORKSPACE/*
- name: Checking out repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.WORKFLOW_INVOCATION_TOKEN }}

Expand Down

0 comments on commit ea00371

Please sign in to comment.