CI: clear workspace directory before checkout (#1900)

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.
pull/1905/head
Ashay Rane 2023-02-24 14:44:35 -06:00 committed by GitHub
parent 207229297e
commit ea00371d85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 13 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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 }}

View File

@ -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 }}