Use distinct ccaches

Since they run in distinct jobs, using the same ccache would
cause one job to overwrite the cache of the other.

See https://github.com/ljfitz/torch-mlir/pull/16 for a proof
that this works. The first build takes a long time but ccache
takes over in the dummy commit.
pull/769/head
Clément Fournier 2022-04-13 14:26:38 +01:00 committed by powderluv
parent 8d700dee21
commit 566650c5ae
2 changed files with 13 additions and 1 deletions

View File

@ -1,6 +1,14 @@
name: "Setup build environment"
description: "Setup the build environment. An action so that it can be shared between in-tree/out-of-tree jobs"
inputs:
cache-key:
description: |
Additional string that is used to compute the ccache hash.
Different jobs running the action need distinct values for this key,
but the content is irrelevant.
required: true
runs:
using: "composite"
steps:
@ -25,4 +33,4 @@ runs:
- name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3
with:
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }}
key: ${{ runner.os }}-clangreleaseasserts-${{ steps.get-submodule-hash.outputs.hash }}-${{ inputs.cache-key }}

View File

@ -24,6 +24,8 @@ jobs:
with:
submodules: 'true'
- uses: ./.github/actions/setup-build
with:
cache-key: 'in-tree'
- name: Build and Test torch-mlir (Assert)
run: |
cd $GITHUB_WORKSPACE
@ -97,6 +99,8 @@ jobs:
with:
submodules: 'true'
- uses: ./.github/actions/setup-build
with:
cache-key: 'out-of-tree'
- name: Build LLVM (standalone)
run: |
cd $GITHUB_WORKSPACE