actions: test cache/{restore,save}@v4 support

This commit is contained in:
Twenty Panda 2024-06-22 20:27:04 +02:00
parent dca3641cf3
commit 8b3c0a55e7
5 changed files with 84 additions and 1 deletions

View file

@ -0,0 +1,51 @@
on: [push]
jobs:
build:
runs-on: docker
container:
image: code.forgejo.org/oci/node:20-bookworm
steps:
- name: cache restore
id: cachestep1
uses: https://code.forgejo.org/actions/cache/restore@v4
with:
path: |
/usr/local/bin/something
key: cachekey
- name: cache hit
run: |
set -x
test "${{ steps.cachestep1.outputs.cache-hit }}" != true
- name: create something
run: echo SOMETHING > /usr/local/bin/something
- name: cache save
uses: https://code.forgejo.org/actions/cache/save@v4
with:
path: |
/usr/local/bin/something
key: ${{ steps.cachestep1.outputs.cache-primary-key }}
- name: remove something
run: rm /usr/local/bin/something
- name: cache restore
id: cachestep2
uses: https://code.forgejo.org/actions/cache/restore@v4
with:
path: |
/usr/local/bin/something
key: cachekey
- name: verify something
run: |
set -x
test SOMETHING = $(cat /usr/local/bin/something)
- name: cache hit
run: |
set -x
test "${{ steps.cachestep2.outputs.cache-hit }}" = true