mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 02:01:02 -05:00
Merge pull request 'run service example in the CI' (#32) from earl-warren/setup-forgejo:wip-example-service into main
Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/32 Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
commit
df44f56dd9
5 changed files with 64 additions and 35 deletions
|
@ -1,4 +1,14 @@
|
|||
on: [ push, pull_request ]
|
||||
|
||||
env:
|
||||
#
|
||||
# List of tests to run as found in testdata/example-$test. The
|
||||
# directory will be used to create a git repository, uploaded to a
|
||||
# Forgejo instance. The test will be a success once the status of
|
||||
# the commit is success, as set by the Forgejo Action run.
|
||||
#
|
||||
TESTS: 'echo service container expression local-action'
|
||||
|
||||
jobs:
|
||||
integration:
|
||||
runs-on: self-hosted
|
||||
|
@ -10,9 +20,17 @@ jobs:
|
|||
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.19
|
||||
./forgejo-runner.sh setup
|
||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||
for example in echo container expression local-action ; do
|
||||
echo "============================ example-$example ==================="
|
||||
for example in $TESTS ; do
|
||||
config=$(pwd)/testdata/example-$example/runner-config.yaml
|
||||
if test -f $config ; then
|
||||
FORGEJO_RUNNER_CONFIG=$config ./forgejo-runner.sh reload
|
||||
fi
|
||||
echo "============================ BEGIN example-$example ==================="
|
||||
./forgejo-test-helper.sh run_workflow testdata/example-$example http://root:admin1234@$(cat forgejo-ip):3000 root example-$example setup-forgejo $(cat forgejo-token)
|
||||
echo "============================ END example-$example ==================="
|
||||
if test -f $config ; then
|
||||
./forgejo-runner.sh reload
|
||||
fi
|
||||
done
|
||||
echo "============================ demo ==================="
|
||||
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
|
||||
|
|
|
@ -34,6 +34,11 @@ function run() {
|
|||
cat forgejo-runner.log
|
||||
}
|
||||
|
||||
function reload() {
|
||||
teardown
|
||||
run
|
||||
}
|
||||
|
||||
function setup() {
|
||||
local runner_repository="${1:-https://code.forgejo.org/forgejo/runner}"
|
||||
local version="${2:-v2.1.0}"
|
||||
|
|
|
@ -1,55 +1,29 @@
|
|||
# Example configuration file, it's safe to copy this as the default config file without any modification.
|
||||
|
||||
log:
|
||||
# The level of logging, can be trace, debug, info, warn, error, fatal
|
||||
level: debug
|
||||
|
||||
runner:
|
||||
# Where to store the registration result.
|
||||
file: .runner
|
||||
# Execute how many tasks concurrently at the same time.
|
||||
capacity: 1
|
||||
# Extra environment variables to run jobs.
|
||||
#envs:
|
||||
# A_TEST_ENV_NAME_1: a_test_env_value_1
|
||||
# A_TEST_ENV_NAME_2: a_test_env_value_2
|
||||
# Extra environment variables to run jobs from a file.
|
||||
# It will be ignored if it's empty or the file doesn't exist.
|
||||
env_file: .env
|
||||
# The timeout for a job to be finished.
|
||||
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
|
||||
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
||||
timeout: 3h
|
||||
# Whether skip verifying the TLS certificate of the Gitea instance.
|
||||
insecure: false
|
||||
# The timeout for fetching the job from the Gitea instance.
|
||||
fetch_timeout: 5s
|
||||
# The interval for fetching the job from the Gitea instance.
|
||||
fetch_interval: 2s
|
||||
labels: []
|
||||
|
||||
cache:
|
||||
# Enable cache server to use actions/cache.
|
||||
enabled: false
|
||||
# The directory to store the cache data.
|
||||
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
|
||||
dir: ""
|
||||
# The host of the cache server.
|
||||
# It's not for the address to listen, but the address to connect from job containers.
|
||||
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
|
||||
host: ""
|
||||
# The port of the cache server.
|
||||
# 0 means to use a random available port.
|
||||
port: 0
|
||||
|
||||
container:
|
||||
# Specifies the network to which the container will connect.
|
||||
# Could be host, bridge or the name of a custom network.
|
||||
# If it's empty, act_runner will create a network automatically.
|
||||
network: "bridge"
|
||||
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
|
||||
privileged: false
|
||||
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
||||
options:
|
||||
# The parent directory of a job's working directory.
|
||||
# If it's empty, /workspace will be used.
|
||||
workdir_parent:
|
||||
valid_volumes: []
|
||||
docker_host: ""
|
||||
|
||||
host:
|
||||
workdir_parent:
|
||||
|
|
|
@ -3,6 +3,8 @@ on: [push]
|
|||
jobs:
|
||||
test:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: debian:bookworm
|
||||
|
||||
services:
|
||||
pgsql:
|
||||
|
@ -15,5 +17,5 @@ jobs:
|
|||
steps:
|
||||
- run: |
|
||||
apt-get update -qq
|
||||
apt-get install -y -qq postgresql-client-11
|
||||
apt-get install -y -qq postgresql-client
|
||||
PGPASSWORD=postgres psql -h pgsql -U postgres -c '\dt' test
|
||||
|
|
30
testdata/example-service/runner-config.yaml
vendored
Normal file
30
testdata/example-service/runner-config.yaml
vendored
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: []
|
||||
|
||||
cache:
|
||||
enabled: false
|
||||
dir: ""
|
||||
host: ""
|
||||
port: 0
|
||||
|
||||
container:
|
||||
network: ""
|
||||
privileged: false
|
||||
options:
|
||||
workdir_parent:
|
||||
valid_volumes: []
|
||||
docker_host: ""
|
||||
|
||||
host:
|
||||
workdir_parent:
|
Loading…
Reference in a new issue