Fogejo Actions tests
This commit is contained in:
parent
d255395fc8
commit
7ccbeb7a46
34 changed files with 764 additions and 1 deletions
59
actions/example-service/.forgejo/workflows/test.yml
Normal file
59
actions/example-service/.forgejo/workflows/test.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
on: [push]
|
||||
|
||||
jobs:
|
||||
#
|
||||
# No volume involved
|
||||
#
|
||||
simple:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: code.forgejo.org/oci/debian:bookworm
|
||||
|
||||
services:
|
||||
pgsql:
|
||||
image: code.forgejo.org/oci/postgres:15
|
||||
env:
|
||||
POSTGRES_DB: test
|
||||
POSTGRES_PASSWORD: postgres
|
||||
steps:
|
||||
- run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq postgresql-client
|
||||
PGPASSWORD=postgres psql -h pgsql -U postgres -c '\dt' test
|
||||
#
|
||||
# A --volume option will expose the volume from the docker host to the job
|
||||
#
|
||||
volume-on-step:
|
||||
needs: [simple]
|
||||
runs-on: docker
|
||||
container:
|
||||
image: code.forgejo.org/oci/debian:bookworm
|
||||
options: "--volume /srv/example-service-volume-valid:/srv/example-service-volume-valid --volume /srv/example-service-volume-invalid:/srv/example-service-volume-invalid"
|
||||
|
||||
steps:
|
||||
- run: |
|
||||
test -f /srv/example-service-volume-valid
|
||||
! test -f /srv/example-service-volume-invalid
|
||||
|
||||
#
|
||||
# A --volume option will expose the volume from the docker host to the service
|
||||
#
|
||||
volume-on-service:
|
||||
needs: [volume-on-step]
|
||||
runs-on: docker
|
||||
container:
|
||||
image: code.forgejo.org/oci/debian:bookworm
|
||||
options: "--volume /srv/example-service-volume-valid:/srv/example-service-volume-valid"
|
||||
|
||||
services:
|
||||
myservice:
|
||||
image: code.forgejo.org/oci/debian:bookworm
|
||||
options: "--volume /srv/example-service-volume-valid:/srv/example-service-volume-valid"
|
||||
cmd: ["bash", "-c", "echo -n SUCCESS > /srv/example-service-volume-valid ; sleep infinity"]
|
||||
|
||||
steps:
|
||||
- run: |
|
||||
set -x
|
||||
f=/srv/example-service-volume-valid
|
||||
test -f $f
|
||||
test $(cat $f) = SUCCESS
|
30
actions/example-service/runner-config.yaml
Normal file
30
actions/example-service/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:16-bullseye"]
|
||||
|
||||
cache:
|
||||
enabled: false
|
||||
dir: ""
|
||||
host: ""
|
||||
port: 0
|
||||
|
||||
container:
|
||||
network: ""
|
||||
privileged: false
|
||||
options:
|
||||
workdir_parent:
|
||||
valid_volumes: ["/srv/example-service-volume-valid"]
|
||||
docker_host: ""
|
||||
|
||||
host:
|
||||
workdir_parent:
|
3
actions/example-service/setup.sh
Executable file
3
actions/example-service/setup.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
> /srv/example-service-volume-valid
|
||||
> /srv/example-service-volume-invalid
|
||||
FORGEJO_RUNNER_CONFIG=$EXAMPLE_DIR/runner-config.yaml forgejo-runner.sh reload
|
1
actions/example-service/teardown.sh
Executable file
1
actions/example-service/teardown.sh
Executable file
|
@ -0,0 +1 @@
|
|||
forgejo-runner.sh reload
|
Loading…
Add table
Reference in a new issue