Merge pull request 'actions: test cache/{restore,save}@v4 support' (#206) from twenty-panda/end-to-end:wip-cache into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/206 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
commit
c2b7f36bc8
5 changed files with 87 additions and 2 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
ACTIONS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
RUNNER_VERSION=v3.5.0
|
||||
|
||||
function actions_verify_example() {
|
||||
local example=$1
|
||||
|
||||
|
@ -68,7 +70,7 @@ function actions_setup() {
|
|||
|
||||
actions_cleanup_example_volume
|
||||
export FORGEJO_RUNNER_CONFIG=$ACTIONS_DIR/runner-config.yaml
|
||||
forgejo-runner.sh setup '' '' http://${HOST_PORT}
|
||||
forgejo-runner.sh setup '' $RUNNER_VERSION http://${HOST_PORT}
|
||||
}
|
||||
|
||||
function actions_teardown() {
|
||||
|
@ -103,7 +105,7 @@ function test_actions() {
|
|||
done
|
||||
fi
|
||||
|
||||
for example in echo checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context ; do
|
||||
for example in echo cache checkout service container expression local-action docker-action if if-fail push tag push-cancel artifacts pull-request context ; do
|
||||
run actions_verify_example $example
|
||||
done
|
||||
|
||||
|
|
51
actions/example-cache/.forgejo/workflows/test.yml
Normal file
51
actions/example-cache/.forgejo/workflows/test.yml
Normal 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
|
30
actions/example-cache/runner-config.yaml
Normal file
30
actions/example-cache/runner-config.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
|
||||
log:
|
||||
level: info
|
||||
|
||||
runner:
|
||||
file: .runner
|
||||
capacity: 1
|
||||
env_file: .env
|
||||
timeout: 3h
|
||||
insecure: false
|
||||
fetch_timeout: 5s
|
||||
fetch_interval: 2s
|
||||
labels: ["docker:docker://code.forgejo.org/oci/node:20-bookworm"]
|
||||
|
||||
cache:
|
||||
enabled: true
|
||||
dir: "/srv/example/cache"
|
||||
host: ""
|
||||
port: 0
|
||||
|
||||
container:
|
||||
network: "bridge"
|
||||
privileged: false
|
||||
options:
|
||||
workdir_parent:
|
||||
valid_volumes: ["/srv/example"]
|
||||
docker_host: ""
|
||||
|
||||
host:
|
||||
workdir_parent:
|
1
actions/example-cache/setup.sh
Executable file
1
actions/example-cache/setup.sh
Executable file
|
@ -0,0 +1 @@
|
|||
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
|
1
actions/example-cache/teardown.sh
Executable file
1
actions/example-cache/teardown.sh
Executable file
|
@ -0,0 +1 @@
|
|||
forgejo-runner.sh reload
|
Loading…
Add table
Reference in a new issue