mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
parent
89374da798
commit
9d8dbd9846
22
.github/actions/cache/action.yml
vendored
Normal file
22
.github/actions/cache/action.yml
vendored
Normal file
@ -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') }}
|
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
@ -69,12 +69,7 @@ jobs:
|
|||||||
mkdir -p $HOME/.cache
|
mkdir -p $HOME/.cache
|
||||||
cp $build_dir/uncrustify ${{ env.CACHE_UNCRUSTIFY }}
|
cp $build_dir/uncrustify ${{ env.CACHE_UNCRUSTIFY }}
|
||||||
|
|
||||||
- name: Cache artifacts
|
- uses: ./.github/actions/cache
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ env.CACHE_NVIM_DEPS_DIR }}
|
|
||||||
key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!cmake.deps/**CMakeLists.txt') }}-${{ github.base_ref }}
|
|
||||||
|
|
||||||
- name: Build third-party deps
|
- name: Build third-party deps
|
||||||
run: ./ci/before_script.sh
|
run: ./ci/before_script.sh
|
||||||
@ -167,12 +162,7 @@ jobs:
|
|||||||
ninja-build \
|
ninja-build \
|
||||||
pkg-config
|
pkg-config
|
||||||
|
|
||||||
- name: Cache artifacts
|
- uses: ./.github/actions/cache
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ env.CACHE_NVIM_DEPS_DIR }}
|
|
||||||
key: lint-${{ hashFiles('cmake/*', '**/CMakeLists.txt', '!cmake.deps/**CMakeLists.txt') }}-${{ github.base_ref }}
|
|
||||||
|
|
||||||
- name: Build third-party deps
|
- name: Build third-party deps
|
||||||
run: ./ci/before_script.sh
|
run: ./ci/before_script.sh
|
||||||
@ -273,12 +263,7 @@ jobs:
|
|||||||
- name: Setup interpreter packages
|
- name: Setup interpreter packages
|
||||||
run: ./ci/install.sh
|
run: ./ci/install.sh
|
||||||
|
|
||||||
- name: Cache dependencies
|
- uses: ./.github/actions/cache
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ env.CACHE_NVIM_DEPS_DIR }}
|
|
||||||
key: ${{ matrix.runner }}-${{ matrix.flavor }}-${{ matrix.cc }}-${{ hashFiles('cmake/*', 'cmake.deps/**', '**/CMakeLists.txt') }}-${{ github.base_ref }}
|
|
||||||
|
|
||||||
- name: Build third-party deps
|
- name: Build third-party deps
|
||||||
run: ./ci/before_script.sh
|
run: ./ci/before_script.sh
|
||||||
@ -315,15 +300,13 @@ jobs:
|
|||||||
timeout-minutes: 45
|
timeout-minutes: 45
|
||||||
env:
|
env:
|
||||||
DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps
|
DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps
|
||||||
|
CACHE_NVIM_DEPS_DIR: ${{ github.workspace }}/nvim-deps
|
||||||
DEPS_PREFIX: ${{ github.workspace }}/nvim-deps/usr
|
DEPS_PREFIX: ${{ github.workspace }}/nvim-deps/usr
|
||||||
name: windows (MSVC_64)
|
name: windows (MSVC_64)
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
- uses: ./.github/actions/cache
|
||||||
with:
|
|
||||||
path: ${{ env.DEPS_BUILD_DIR }}
|
|
||||||
key: windows-${{ hashFiles('cmake.deps/**') }}
|
|
||||||
|
|
||||||
- name: Set env
|
- name: Set env
|
||||||
run: ./.github/workflows/env.ps1
|
run: ./.github/workflows/env.ps1
|
||||||
|
Loading…
Reference in New Issue
Block a user