aboutsummaryrefslogtreecommitdiff
path: root/.github/actions/cache
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-12-05 11:57:52 +0100
committerGitHub <noreply@github.com>2022-12-05 11:57:52 +0100
commit9d8dbd9846e79c110481847dcd98c94fb2d2d3dd (patch)
tree9e7f898583ad89dfb733af60e2cfa5adedc96620 /.github/actions/cache
parent89374da798ff29e651c47ed4159aa89e3395af9f (diff)
downloadrneovim-9d8dbd9846e79c110481847dcd98c94fb2d2d3dd.tar.gz
rneovim-9d8dbd9846e79c110481847dcd98c94fb2d2d3dd.tar.bz2
rneovim-9d8dbd9846e79c110481847dcd98c94fb2d2d3dd.zip
ci: use local action to make make cache keys consistent (#20538)
The advantages of using an action is that it reduces boilerplate and repetition from the main ci.yml workflow.
Diffstat (limited to '.github/actions/cache')
-rw-r--r--.github/actions/cache/action.yml22
1 files changed, 22 insertions, 0 deletions
diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml
new file mode 100644
index 0000000000..858045c02a
--- /dev/null
+++ b/.github/actions/cache/action.yml
@@ -0,0 +1,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') }}