It seems like Actions can be executed while maintaining compatibility between Github and Gitea
Hello, I'm incompetent.
What I'm doing is mostly the introduction of Gitea Actions.
Setting up the execution environment for Gitea Actions
What I'm doing is mostly the same as the following,
Gitea Actions is here!
By the way, it seems that even if you don't set [actions] to ENABLED=true in app.ini, it's On by default.
Version at the time of introduction
$ gitea -v
Gitea version 1.22.4 built with GNU Make 4.3, go1.22.9 : bindata, sqlite, sqlite_unlock_notify
The version of Go installed with apt on Debian on Hetzner was old and I got an error when building, so I will install the latest version of Go.
wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
exec bash
go version
At this time, I had already done apt remove, but it was still looking at /usr/bin/go, and I had forgotten to pass the path, so I set the path.
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
rm /usr/bin/go
exec bash
go version
Building the Gitea Actions runner
It needs to run as a separate daemon, and docker is also required, so I will install it.
apt install -y make docker.io
service docker status
git clone https://gitea.com/gitea/act_runner
cd act_runner/
make build
mv ./act_runner /usr/local/bin
exec bash
Linking with act_runner register
Perhaps, I understood the reason why this is separated from the main Gitea binary at this point.
I think it's probably to easily separate the environment for running Gitea Actions on a server different from the one hosting Gitea itself.
# act_runner register
INFO Registering runner, arch=amd64, os=linux, version=v0.2.11+6-g8bc0275.
INFO Enter the Gitea instance URL (for example, https://gitea.com/):
https://git.domain.tld/
INFO Enter the runner token:
Secret key
INFO Enter the runner name (if set empty, use hostname: debian-2gb-hel1-1):
danzig
INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-latest:docker://gitea/runner-images:ubuntu-latest):
INFO Registering runner, name=danzig, instance=https://git.domain.tld/, labels=[ubuntu-latest:docker://gitea/runner-images:ubuntu-latest ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04 ubuntu-20.04:docker://gitea/runner-images:ubuntu-20.04].
DEBU Successfully pinged the Gitea instance server
INFO Runner registered successfully.
By the way, regarding obtaining the token to pass to the Runner, it was different from the aforementioned site and is currently
https://git.domain.tld/admin/actions/runners
now.
It's trivial, but I named the runner 'danzig' after the vocalist of Misfits.
It's amusing to imagine Glenn Danzig doing build work behind the scenes.
It seems apparmor needs to be installed
Apparently, the necessary modules are missing.
It seems a Linux Security Modules different from SE Linux is required.
So, I will install it.
apt install -y apparmor apparmor-utils
Regarding what to do with the executable binary for the act_runner daemon, for now, during the testing period, I put it in rc.local to only handle startup.
The reason is that if I put it into Systemd or Supervisord from the beginning, it would be troublesome to check when the daemon dies midway, so if it dies cleanly, it seems easier to just look at the daemon's death log in nohup.out later, making it easier to find.
Write the following to /etc/rc.local
nohup act_runner daemon &
Then restart the Docker daemon.
service docker restart
By the way, the reason I hardly use systemctl is because it's generic and can be used similarly in other distributions and BSD environments.
Edit yaml
Honestly, I don't quite understand where actions/checkout@v4 is looking when it runs without explicit specification, but looking at the logs, it seems that act_runner is cleverly adjusting to understand this syntax.
Therefore, it seems to be using assets directly from Github, rather than some mirrored assets of actions/checkout@v4 held by act_runner.
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.3'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
According to the Qiita article, it's necessary to explicitly specify the full URL for everything except actions/checkout@v4, so I specified the full URL for uses under name: Set up Go. However, if it works as mentioned earlier, now that the version has increased, maybe it will cleverly recognize it as a Github asset? But then I thought, if that's the case, there might be conflicts with assets on Gitea, so it seems safer to specify the full URL.
※Addendum
Apparently, both Github and Gitea seem to work even with owner/repo@ref as is, so it seems I can proceed without thinking too much.
Works successfully

Yay!!!!
So, that's all for this time.
See you next time.