aboutsummaryrefslogtreecommitdiff
path: root/.github/actions/cache/action.yml
blob: 858045c02ad54407c292efd9c59f7cc1edf70e14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
name: 'Cache'
description: "This action caches neovim dependencies"
runs:
  using: "composite"
  steps:
    - run: echo "CACHE_KEY=${{ github.job }}-${{ github.base_ref }}" >> $GITHUB_ENV
      shell: bash

    - if: ${{ matrix }}
      run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.*, '-') }}" >> $GITHUB_ENV
      shell: bash

    # Avoid using '**/CMakeLists.txt' (or any pattern starting with '**/') even
    # if it makes the expression below simpler. hashFiles() has a timer that
    # will fail the job if it times out, which can happen if there are too many
    # files to search through.
    - uses: actions/cache@v3
      with:
        path: ${{ env.CACHE_NVIM_DEPS_DIR }}
        key: ${{ env.CACHE_KEY }}-${{ hashFiles('cmake**', 'ci/**',
          '.github/workflows/ci.yml', 'CMakeLists.txt',
          'runtime/CMakeLists.txt', 'src/nvim/**/CMakeLists.txt') }}