end-to-end/actions/example-cache/.forgejo/workflows/test.yml

52 lines
1.3 KiB
YAML
Raw Normal View History

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