diff --git a/.gitignore b/.gitignore index 4bd1d0bc..5462c855 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -act_runner +forgejo-runner .env .runner diff --git a/Makefile b/Makefile index 3092f42d..cabf404b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ DIST := dist -EXECUTABLE := act_runner +EXECUTABLE := forgejo-runner GOFMT ?= gofumpt -l DIST := dist DIST_DIRS := $(DIST)/binaries $(DIST)/release diff --git a/README.md b/README.md index b5cf9591..b233ded5 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,5 @@ -# act runner +# Forgejo Actions runner -Act runner is a runner for Gitea based on [act](https://gitea.com/gitea/act). +Runs workflows found in `.forgejo/workflows`, using a format similar to GitHub actions but with a Free Software implementation. -## Prerequisites - -Docker Engine Community version is required. To install Docker CE, follow the official [install instructions](https://docs.docker.com/engine/install/). - -## Quickstart - -### Build - -```bash -make build -``` - -### Register - -```bash -./act_runner register -``` - -And you will be asked to input: - -1. Gitea instance URL, like `http://192.168.8.8:3000/`. You should use your gitea instance ROOT_URL as the instance argument - and you should not use `localhost` or `127.0.0.1` as instance IP; -2. Runner token, you can get it from `http://192.168.8.8:3000/admin/runners`; -3. Runner name, you can just leave it blank; -4. Runner labels, you can just leave it blank. - -The process looks like: - -```text -INFO Registering runner, arch=amd64, os=darwin, version=0.1.5. -WARN Runner in user-mode. -INFO Enter the Gitea instance URL (for example, https://gitea.com/): -http://192.168.8.8:3000/ -INFO Enter the runner token: -fe884e8027dc292970d4e0303fe82b14xxxxxxxx -INFO Enter the runner name (if set empty, use hostname:Test.local ): - -INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, self-hosted,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster): - -INFO Registering runner, name=Test.local, instance=http://192.168.8.8:3000/, labels=[ubuntu-latest:docker://node:16-bullseye ubuntu-22.04:docker://node:16-bullseye ubuntu-20.04:docker://node:16-bullseye ubuntu-18.04:docker://node:16-buster]. -DEBU Successfully pinged the Gitea instance server -INFO Runner registered successfully. -``` - -You can also register with command line arguments. - -```bash -./act_runner register --instance http://192.168.8.8:3000 --token --no-interactive -``` - -If the registry succeed, it will run immediately. Next time, you could run the runner directly. - -### Run - -```bash -./act_runner daemon -``` \ No newline at end of file +It is compatible with Forgejo v1.19.0-0-rc0 diff --git a/client/http.go b/client/http.go index 2c2d6282..0f08f81d 100644 --- a/client/http.go +++ b/client/http.go @@ -8,7 +8,7 @@ import ( "code.gitea.io/actions-proto-go/ping/v1/pingv1connect" "code.gitea.io/actions-proto-go/runner/v1/runnerv1connect" - "gitea.com/gitea/act_runner/core" + "codeberg.org/forgejo/runner/core" "github.com/bufbuild/connect-go" ) diff --git a/cmd/daemon.go b/cmd/daemon.go index 46d78ad4..79e6a345 100644 --- a/cmd/daemon.go +++ b/cmd/daemon.go @@ -5,11 +5,11 @@ import ( "os" "strings" - "gitea.com/gitea/act_runner/client" - "gitea.com/gitea/act_runner/config" - "gitea.com/gitea/act_runner/engine" - "gitea.com/gitea/act_runner/poller" - "gitea.com/gitea/act_runner/runtime" + "codeberg.org/forgejo/runner/client" + "codeberg.org/forgejo/runner/config" + "codeberg.org/forgejo/runner/engine" + "codeberg.org/forgejo/runner/poller" + "codeberg.org/forgejo/runner/runtime" "github.com/joho/godotenv" "github.com/mattn/go-isatty" diff --git a/cmd/register.go b/cmd/register.go index 8990f0fe..b123db48 100644 --- a/cmd/register.go +++ b/cmd/register.go @@ -11,9 +11,9 @@ import ( "time" pingv1 "code.gitea.io/actions-proto-go/ping/v1" - "gitea.com/gitea/act_runner/client" - "gitea.com/gitea/act_runner/config" - "gitea.com/gitea/act_runner/register" + "codeberg.org/forgejo/runner/client" + "codeberg.org/forgejo/runner/config" + "codeberg.org/forgejo/runner/register" "github.com/bufbuild/connect-go" "github.com/joho/godotenv" diff --git a/config/config.go b/config/config.go index 53a4cf1c..607df95a 100644 --- a/config/config.go +++ b/config/config.go @@ -7,7 +7,7 @@ import ( "runtime" "strconv" - "gitea.com/gitea/act_runner/core" + "codeberg.org/forgejo/runner/core" "github.com/joho/godotenv" "github.com/kelseyhightower/envconfig" diff --git a/go.mod b/go.mod index 994c70c4..0bccc01c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module gitea.com/gitea/act_runner +module codeberg.org/forgejo/runner go 1.18 @@ -77,4 +77,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/nektos/act => gitea.com/gitea/act v0.234.2 +replace github.com/nektos/act => codeberg.org/forgejo/act v1.0.1 diff --git a/go.sum b/go.sum index a81ca83c..439f85c9 100644 --- a/go.sum +++ b/go.sum @@ -24,9 +24,9 @@ cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0Zeo cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= code.gitea.io/actions-proto-go v0.2.0 h1:nYh9nhhfk67YA4wVNLsCzd//RCvXnljwXClJ33+HPVk= code.gitea.io/actions-proto-go v0.2.0/go.mod h1:00ys5QDo1iHN1tHNvvddAcy2W/g+425hQya1cCSvq9A= +codeberg.org/forgejo/act v1.0.1 h1:+MtGk54/MWmNjK3s/9t/W+mOrRJyP7liVMQpCrMYglg= +codeberg.org/forgejo/act v1.0.1/go.mod h1:2C/WbTalu1VPNgbVaZJaZDzlOtAKqkXJhdOClxkMy14= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gitea.com/gitea/act v0.234.2 h1:bayHPYv545SurAe4z9hMiX7kOafE3SnMvpS9llZ+ik0= -gitea.com/gitea/act v0.234.2/go.mod h1:2C/WbTalu1VPNgbVaZJaZDzlOtAKqkXJhdOClxkMy14= github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= diff --git a/main.go b/main.go index 333e615a..8562842f 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "os/signal" "syscall" - "gitea.com/gitea/act_runner/cmd" + "codeberg.org/forgejo/runner/cmd" ) func withContextFunc(ctx context.Context, f func()) context.Context { diff --git a/poller/poller.go b/poller/poller.go index abb96c8d..1600dc46 100644 --- a/poller/poller.go +++ b/poller/poller.go @@ -7,7 +7,7 @@ import ( "time" runnerv1 "code.gitea.io/actions-proto-go/runner/v1" - "gitea.com/gitea/act_runner/client" + "codeberg.org/forgejo/runner/client" "github.com/bufbuild/connect-go" log "github.com/sirupsen/logrus" diff --git a/register/register.go b/register/register.go index 3c5e7d16..4458174c 100644 --- a/register/register.go +++ b/register/register.go @@ -8,9 +8,9 @@ import ( "strings" runnerv1 "code.gitea.io/actions-proto-go/runner/v1" - "gitea.com/gitea/act_runner/client" - "gitea.com/gitea/act_runner/config" - "gitea.com/gitea/act_runner/core" + "codeberg.org/forgejo/runner/client" + "codeberg.org/forgejo/runner/config" + "codeberg.org/forgejo/runner/core" "github.com/bufbuild/connect-go" log "github.com/sirupsen/logrus" diff --git a/runtime/reporter.go b/runtime/reporter.go index b6d38bf6..544852ad 100644 --- a/runtime/reporter.go +++ b/runtime/reporter.go @@ -8,7 +8,7 @@ import ( "time" runnerv1 "code.gitea.io/actions-proto-go/runner/v1" - "gitea.com/gitea/act_runner/client" + "codeberg.org/forgejo/runner/client" retry "github.com/avast/retry-go/v4" "github.com/bufbuild/connect-go" diff --git a/runtime/runtime.go b/runtime/runtime.go index 4bac6788..e5e096bd 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -5,7 +5,7 @@ import ( "strings" runnerv1 "code.gitea.io/actions-proto-go/runner/v1" - "gitea.com/gitea/act_runner/client" + "codeberg.org/forgejo/runner/client" ) // Runner runs the pipeline. diff --git a/runtime/task.go b/runtime/task.go index b899c5bd..7d6bb6db 100644 --- a/runtime/task.go +++ b/runtime/task.go @@ -11,7 +11,7 @@ import ( "time" runnerv1 "code.gitea.io/actions-proto-go/runner/v1" - "gitea.com/gitea/act_runner/client" + "codeberg.org/forgejo/runner/client" "github.com/nektos/act/pkg/artifacts" "github.com/nektos/act/pkg/common"