Merge pull request 'upgrade runner 3.0.1' (#53) from earl-warren/setup-forgejo:wip-test-runner-act into main

Reviewed-on: https://code.forgejo.org/actions/setup-forgejo/pulls/53
Reviewed-by: dachary <dachary@noreply.code.forgejo.org>
This commit is contained in:
earl-warren 2023-10-04 15:44:49 +00:00
commit 3117f64380
10 changed files with 36 additions and 17 deletions

View file

@ -20,7 +20,7 @@ jobs:
( (
echo codeberg.org/forgejo/forgejo 1.19.4-0 echo codeberg.org/forgejo/forgejo 1.19.4-0
echo codeberg.org/forgejo/forgejo 1.20.4-1 echo codeberg.org/forgejo/forgejo 1.20.4-1
echo codeberg.org/forgejo-experimental/forgejo 1.21.0-0-rc0 echo codeberg.org/forgejo-experimental/forgejo 1.21.0-2-rc0
) | while read url version ; do ) | while read url version ; do
echo "=========================== launching forgejo v$version ==========" echo "=========================== launching forgejo v$version =========="
forgejo.sh setup root admin1234 $url $version forgejo.sh setup root admin1234 $url $version

View file

@ -6,21 +6,21 @@ jobs:
strategy: strategy:
matrix: matrix:
info: info:
- version: "1.21.0-1-rc0" - version: "1.21.0-2-rc0"
image: codeberg.org/forgejo-experimental/forgejo image: codeberg.org/forgejo-experimental/forgejo
tests: "service" tests: "service"
- version: "1.21.0-1-rc0" - version: "1.21.0-2-rc0"
image: codeberg.org/forgejo-experimental/forgejo image: codeberg.org/forgejo-experimental/forgejo
tests: "artifacts" tests: "artifacts"
- version: "1.21.0-1-rc0" - version: "1.21.0-2-rc0"
image: codeberg.org/forgejo-experimental/forgejo image: codeberg.org/forgejo-experimental/forgejo
tests: "cron" tests: "cron"
- version: "1.21.0-1-rc0" - version: "1.21.0-2-rc0"
image: codeberg.org/forgejo-experimental/forgejo image: codeberg.org/forgejo-experimental/forgejo
tests: "${{ vars.V121_TESTS || 'echo pull-request container expression local-action docker-action if if-fail' }}" tests: "${{ vars.V121_TESTS || 'echo checkout pull-request container expression local-action docker-action if if-fail' }}"
- version: "1.20" - version: "1.20"
image: codeberg.org/forgejo/forgejo image: codeberg.org/forgejo/forgejo
tests: "${{ vars.V120_TESTS || 'echo service container expression local-action docker-action if if-fail' }}" tests: "${{ vars.V120_TESTS || 'echo checkout service container expression local-action docker-action if if-fail' }}"
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- if: matrix.info.tests != 'none' - if: matrix.info.tests != 'none'

View file

@ -22,7 +22,7 @@ The forgejo-test-helper.sh script is available to help test and debug actions.
Creates the repository `$forgejo/root/testrepo` and populates it with the Creates the repository `$forgejo/root/testrepo` and populates it with the
content of the `testrepo` directory. The SHA of the tip of the repository content of the `testrepo` directory. The SHA of the tip of the repository
is in the output, on a line starting with `sha=`. is in the output, on a line starting with `sha=`.
* `forgejo-test-helper.sh build_runner $forgejo/forgejo/runner v3.0.0` * `forgejo-test-helper.sh build_runner $forgejo/forgejo/runner v3.0.1`
Builds the forgejo runner from source in `./forgejo-runner/forgejo-runner`. Builds the forgejo runner from source in `./forgejo-runner/forgejo-runner`.
`export PATH=$(pwd)/forgejo-runner:$PATH` will ensure that calling `forgejo-runner.sh` `export PATH=$(pwd)/forgejo-runner:$PATH` will ensure that calling `forgejo-runner.sh`
will use this binary instead of downloading a released version of the runner. will use this binary instead of downloading a released version of the runner.
@ -48,7 +48,7 @@ It can only be run on the `self-hosted` platform, running on a host with LXC ins
| user | Administrator user name | `false` | root | | user | Administrator user name | `false` | root |
| password | Administrator password | `false` | admin1234 | | password | Administrator password | `false` | admin1234 |
| runner | Runner git repository | `false` | https://code.forgejo.org/forgejo/runner | | runner | Runner git repository | `false` | https://code.forgejo.org/forgejo/runner |
| runner-version | Runner version | `false` | v2.5.0 | | runner-version | Runner version | `false` | v3.0.1 |
| container | Name of the container running the Forgejo instance | `false` | forgejo | | container | Name of the container running the Forgejo instance | `false` | forgejo |
| lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 | | lxc-ip-prefix | Class C IP prefix used by LXC | `false` | 10.0.23 |
<!-- action-docs-inputs --> <!-- action-docs-inputs -->

View file

@ -21,7 +21,7 @@ description: |
Creates the repository `$forgejo/root/testrepo` and populates it with the Creates the repository `$forgejo/root/testrepo` and populates it with the
content of the `testrepo` directory. The SHA of the tip of the repository content of the `testrepo` directory. The SHA of the tip of the repository
is in the output, on a line starting with `sha=`. is in the output, on a line starting with `sha=`.
* `forgejo-test-helper.sh build_runner $forgejo/forgejo/runner v3.0.0` * `forgejo-test-helper.sh build_runner $forgejo/forgejo/runner v3.0.1`
Builds the forgejo runner from source in `./forgejo-runner/forgejo-runner`. Builds the forgejo runner from source in `./forgejo-runner/forgejo-runner`.
`export PATH=$(pwd)/forgejo-runner:$PATH` will ensure that calling `forgejo-runner.sh` `export PATH=$(pwd)/forgejo-runner:$PATH` will ensure that calling `forgejo-runner.sh`
will use this binary instead of downloading a released version of the runner. will use this binary instead of downloading a released version of the runner.
@ -52,7 +52,7 @@ inputs:
default: 'https://code.forgejo.org/forgejo/runner' default: 'https://code.forgejo.org/forgejo/runner'
runner-version: runner-version:
description: 'Runner version' description: 'Runner version'
default: 'v2.5.0' default: 'v3.0.1'
container: container:
description: 'Name of the container running the Forgejo instance' description: 'Name of the container running the Forgejo instance'
default: 'forgejo' default: 'forgejo'

View file

@ -16,7 +16,10 @@ function download() {
local version="$2" local version="$2"
if ! which forgejo-runner > /dev/null; then if ! which forgejo-runner > /dev/null; then
curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-amd64 > /bin/forgejo-runner if ! curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-${version#v}-linux-amd64 > /bin/forgejo-runner ; then
# backward compatibility for for the naming scheme prior to 3.0.0
curl -L --fail -sS $runner_repository/releases/download/$version/forgejo-runner-linux-amd64 > /bin/forgejo-runner
fi
chmod 755 /bin/forgejo-runner chmod 755 /bin/forgejo-runner
fi fi
} }
@ -41,7 +44,7 @@ function reload() {
function setup() { function setup() {
local runner_repository="${1:-https://code.forgejo.org/forgejo/runner}" local runner_repository="${1:-https://code.forgejo.org/forgejo/runner}"
local version="${2:-v2.5.0}" local version="${2:-v3.0.1}"
local forgejo="${3:-http://$(cat forgejo-ip):3000/}" local forgejo="${3:-http://$(cat forgejo-ip):3000/}"
dependencies dependencies

View file

@ -12,14 +12,14 @@ DIR=$(mktemp -d)
trap "rm -fr $DIR" EXIT trap "rm -fr $DIR" EXIT
function dependency_go() { function dependency_go() {
go_version="1.21.0.linux-amd64" # Set the desired Go version here go_version="1.21.1.linux-amd64" # Set the desired Go version here
if ! which go > /dev/null ; then if ! which go > /dev/null ; then
apt-get update apt-get update
apt-get install -y -qq wget tar apt-get install -y -qq wget tar
wget --quiet "https://go.dev/dl/go$go_version.tar.gz" wget --quiet "https://go.dev/dl/go$go_version.tar.gz"
tar zxf "go$go_version.tar.gz" tar zxf "go$go_version.tar.gz"
export PATH="$PATH:$(pwd)/go/bin" export PATH="$(pwd)/go/bin:$PATH"
fi fi
} }

View file

@ -0,0 +1,8 @@
on: [push]
jobs:
ls:
runs-on: docker
steps:
- uses: actions/checkout@v3
- run: |
ls ${{ github.workspace }}

View file

@ -0,0 +1,8 @@
on: [push]
jobs:
ls:
runs-on: docker
steps:
- uses: actions/checkout@v4
- run: |
ls ${{ github.workspace }}

View file

@ -2,7 +2,7 @@
# As of Forgejo v1.20 running this example would require using the web # As of Forgejo v1.20 running this example would require using the web
# endpoints because there is no API to do the same. # endpoints because there is no API to do the same.
# #
# It was manually tested to **not work** with Forgejo v1.20 & runner 2.5.0 # It was manually tested to **not work** with Forgejo v1.21 & runner 3.0.1
# #
on: [push] on: [push]

View file

@ -13,7 +13,7 @@ jobs:
# #
# This is documented in GitHub Actions and does not work in Forgejo Actions # This is documented in GitHub Actions and does not work in Forgejo Actions
# as of 3.0.0. # as of 3.0.1.
# #
# If you have a chain of dependent jobs, failure() returns true if any ancestor job fails. # If you have a chain of dependent jobs, failure() returns true if any ancestor job fails.
# #