summaryrefslogtreecommitdiffstatshomepage
path: root/.github/actions/cache/action.yml
blob: ba17a3b6d0238e9e73ffb2c31c62ae436f33119c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: 'Cache'
description: "This action caches neovim dependencies"
runs:
  using: "composite"
  steps:
    - run: echo "CACHE_KEY=${GITHUB_WORKFLOW}" >> $GITHUB_ENV # zizmor: ignore[github-env]
      shell: bash

    - run: echo "CACHE_KEY=${GITHUB_JOB}" >> $GITHUB_ENV # zizmor: ignore[github-env]
      shell: bash

    - if: ${{ matrix }}
      env:
        MATRIX_JOIN: ${{ join(matrix.*, '-') }}
      run: echo "CACHE_KEY=${CACHE_KEY}-${MATRIX_JOIN}" >> $GITHUB_ENV # zizmor: ignore[github-env]
      shell: bash

    - if: ${{ matrix.build }}
      env:
        MATRIX_JOIN: ${{ join(matrix.build.*, '-') }}
      run: echo "CACHE_KEY=${CACHE_KEY}-${MATRIX_JOIN}" >> $GITHUB_ENV # zizmor: ignore[github-env]
      shell: bash

    - id: image
      run: echo "version=$ImageVersion" >> $GITHUB_OUTPUT
      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@v5.0.5
      with:
        path: .deps
        key: ${{ env.CACHE_KEY }}-${{ steps.image.outputs.version }}-${{ hashFiles('cmake**',
          '.github/**', 'CMakeLists.txt',
          'runtime/CMakeLists.txt', 'src/nvim/**/CMakeLists.txt') }}