mirror of
https://code.forgejo.org/actions/setup-forgejo.git
synced 2024-11-24 03:01:04 -05:00
Merge pull request 'examples to use as references for the actions documentation' (#24) from earl-warren/setup-forgejo:wip-example into main
Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/24 Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
commit
df36663bb0
6 changed files with 65 additions and 12 deletions
23
.forgejo/workflows/integration-nested.yml
Normal file
23
.forgejo/workflows/integration-nested.yml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
on: [ push, pull_request ]
|
||||||
|
jobs:
|
||||||
|
integration:
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: |
|
||||||
|
set -x
|
||||||
|
LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh
|
||||||
|
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.19
|
||||||
|
#
|
||||||
|
# Uncomment the following for a shortcut to debugging the Forgejo runner.
|
||||||
|
# It will build the runner from a designated repository and branch instead of
|
||||||
|
# downloading it from a canonical release.
|
||||||
|
#
|
||||||
|
# ./forgejo-test-helper.sh build_runner http://code.forgejo.org/forgejo/runner branch-under-debug
|
||||||
|
# export PATH=$(pwd)/forgejo-runner:$PATH
|
||||||
|
#
|
||||||
|
./forgejo-runner.sh setup
|
||||||
|
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||||
|
echo "============================ sanity-check ==================="
|
||||||
|
./forgejo-test-helper.sh push_self_action http://root:admin1234@$(cat forgejo-ip):3000 root setup-forgejo vTest
|
||||||
|
./forgejo-test-helper.sh run_workflow testdata/sanity-checks http://root:admin1234@$(cat forgejo-ip):3000 root sanity-check setup-forgejo $(cat forgejo-token)
|
|
@ -6,19 +6,14 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- run: |
|
- run: |
|
||||||
set -x
|
set -x
|
||||||
LXC_IP_PREFIX=10.0.9 ./forgejo-dependencies.sh
|
LXC_IP_PREFIX=10.0.10 ./forgejo-dependencies.sh
|
||||||
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.19
|
./forgejo.sh setup root admin1234 codeberg.org/forgejo/forgejo 1.19
|
||||||
#
|
|
||||||
# Uncomment the following for a shortcut to debugging the Forgejo runner.
|
|
||||||
# It will build the runner from a designated repository and branch instead of
|
|
||||||
# downloading it from a canonical release.
|
|
||||||
#
|
|
||||||
# ./forgejo-test-helper.sh build_runner http://code.forgejo.org/forgejo/runner branch-under-debug
|
|
||||||
# export PATH=$(pwd)/forgejo-runner:$PATH
|
|
||||||
#
|
|
||||||
./forgejo-runner.sh setup
|
./forgejo-runner.sh setup
|
||||||
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
export FORGEJO_RUNNER_LOGS=forgejo-runner.log
|
||||||
|
for example in echo container ; do
|
||||||
|
echo "============================ 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)
|
||||||
|
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
|
./forgejo-test-helper.sh run_workflow testdata/demo http://root:admin1234@$(cat forgejo-ip):3000 root demo setup-forgejo $(cat forgejo-token) > /tmp/output
|
||||||
grep '^sha=' /tmp/output
|
grep '^sha=' /tmp/output
|
||||||
./forgejo-test-helper.sh push_self_action http://root:admin1234@$(cat forgejo-ip):3000 root setup-forgejo vTest
|
|
||||||
./forgejo-test-helper.sh run_workflow testdata/sanity-checks http://root:admin1234@$(cat forgejo-ip):3000 root sanity-check setup-forgejo $(cat forgejo-token)
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
: ${FORGEJO_RUNNER_CONFIG:=$(pwd)/runner-config.yaml}
|
||||||
|
|
||||||
function dependencies() {
|
function dependencies() {
|
||||||
if ! which curl daemon > /dev/null ; then
|
if ! which curl daemon > /dev/null ; then
|
||||||
apt-get install -y -qq curl daemon
|
apt-get install -y -qq curl daemon
|
||||||
|
@ -27,7 +29,7 @@ function register() {
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
rm -f forgejo-runner.log
|
rm -f forgejo-runner.log
|
||||||
daemon --chdir=$(pwd) --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- forgejo-runner --config $(pwd)/runner-config.yaml daemon
|
daemon --chdir=$(pwd) --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --env="USER=$USER" --env="TERM=dumb" --env="USERNAME=$USERNAME" --env="LANG=$LANG" --pidfile=$(pwd)/forgejo-runner-pid --errlog=$(pwd)/forgejo-runner.log --output=$(pwd)/forgejo-runner.log -- forgejo-runner --config $FORGEJO_RUNNER_CONFIG daemon
|
||||||
sleep 1
|
sleep 1
|
||||||
cat forgejo-runner.log
|
cat forgejo-runner.log
|
||||||
}
|
}
|
||||||
|
|
8
testdata/example-container/.forgejo/workflows/test.yml
vendored
Normal file
8
testdata/example-container/.forgejo/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: alpine:3.18
|
||||||
|
steps:
|
||||||
|
- run: grep Alpine /etc/os-release
|
6
testdata/example-echo/.forgejo/workflows/test.yml
vendored
Normal file
6
testdata/example-echo/.forgejo/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
on: [push]
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: echo All Good
|
19
testdata/example-service/.forgejo/workflows/test.yml
vendored
Normal file
19
testdata/example-service/.forgejo/workflows/test.yml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
services:
|
||||||
|
pgsql:
|
||||||
|
image: postgres:15
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: test
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
apt-get update -qq
|
||||||
|
apt-get install -y -qq postgresql-client-11
|
||||||
|
PGPASSWORD=postgres psql -h pgsql -U postgres -c '\dt' test
|
Loading…
Reference in a new issue