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" name: "Setup build environment"
description: "Setup the build environment. An action so that it can be shared between in-tree/out-of-tree jobs" 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: runs:
using: "composite" using: "composite"
steps: steps:
@ -25,4 +33,4 @@ runs:
- name: Ccache for C++ compilation - name: Ccache for C++ compilation
uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3 uses: hendrikmuhs/ccache-action@4687d037e4d7cf725512d9b819137a3af34d39b3
with: 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: with:
submodules: 'true' submodules: 'true'
- uses: ./.github/actions/setup-build - uses: ./.github/actions/setup-build
with:
cache-key: 'in-tree'
- name: Build and Test torch-mlir (Assert) - name: Build and Test torch-mlir (Assert)
run: | run: |
cd $GITHUB_WORKSPACE cd $GITHUB_WORKSPACE
@ -97,6 +99,8 @@ jobs:
with: with:
submodules: 'true' submodules: 'true'
- uses: ./.github/actions/setup-build - uses: ./.github/actions/setup-build
with:
cache-key: 'out-of-tree'
- name: Build LLVM (standalone) - name: Build LLVM (standalone)
run: | run: |
cd $GITHUB_WORKSPACE cd $GITHUB_WORKSPACE