110 lines
3.1 KiB
Markdown
110 lines
3.1 KiB
Markdown
# Gitea Actions Runner Configuration for j3270
|
|
|
|
This repository includes Gitea Actions workflows in `.gitea/workflows/build.yaml` to automatically:
|
|
1. Compile and run the JUnit 5 test suite via `test_all.sh`.
|
|
2. Build the standalone `j3270.jar` executable via `build_all.sh`.
|
|
3. Upload `j3270.jar` as a downloadable artifact.
|
|
4. Report test results and diagnostics.
|
|
|
|
---
|
|
|
|
## 1. Setting up `act_runner` (Gitea Actions Runner)
|
|
|
|
To run CI workflows on your Gitea instance:
|
|
|
|
### Step 1: Download & Generate Config
|
|
Download the `act_runner` binary for your platform from the [Gitea act_runner releases](https://gitea.com/gitea/act_runner/releases).
|
|
|
|
Generate a default runner config file:
|
|
```bash
|
|
./act_runner generate-config > config.yaml
|
|
```
|
|
|
|
### Step 2: Configure Network & DNS in `config.yaml`
|
|
If your Gitea instance is hosted on a custom or internal domain (e.g., `git.hugfreevikings.wtf`), configure the container network mode or DNS resolution in `config.yaml`:
|
|
|
|
```yaml
|
|
container:
|
|
# Option A (Recommended): Use host network mode so job containers share the host's DNS and network:
|
|
network: "host"
|
|
|
|
# Option B (Bridge mode): If using bridge network, add extra host mapping:
|
|
extra_hosts:
|
|
- "git.hugfreevikings.wtf:host-gateway"
|
|
```
|
|
|
|
### Step 3: Register the Runner
|
|
Obtain a runner registration token from **Repository Settings -> Actions -> Runners** or **Site Administration -> Actions -> Runners**, then register:
|
|
|
|
```bash
|
|
./act_runner register \
|
|
--config config.yaml \
|
|
--instance https://git.hugfreevikings.wtf \
|
|
--token <YOUR_REGISTRATION_TOKEN> \
|
|
--name "j3270-runner" \
|
|
--labels "ubuntu-latest:docker://node:18-bullseye,ubuntu-22.04:docker://node:18-bullseye"
|
|
```
|
|
|
|
### Step 4: Run the Runner Daemon
|
|
```bash
|
|
./act_runner daemon --config config.yaml
|
|
```
|
|
|
|
Or using Docker Compose:
|
|
```yaml
|
|
version: '3.8'
|
|
services:
|
|
runner:
|
|
image: gitea/act_runner:latest
|
|
restart: always
|
|
environment:
|
|
- GITEA_INSTANCE_URL=https://git.hugfreevikings.wtf
|
|
- GITEA_RUNNER_REGISTRATION_TOKEN=<YOUR_REGISTRATION_TOKEN>
|
|
- GITEA_RUNNER_NAME=j3270-runner
|
|
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:18-bullseye
|
|
extra_hosts:
|
|
- "git.hugfreevikings.wtf:host-gateway"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- ./data:/data
|
|
- ./config.yaml:/config.yaml
|
|
```
|
|
|
|
---
|
|
|
|
## 2. Troubleshooting "Could not resolve host"
|
|
|
|
If job containers fail during checkout with:
|
|
```
|
|
fatal: unable to access 'https://git.hugfreevikings.wtf/...': Could not resolve host: git.hugfreevikings.wtf
|
|
```
|
|
This means Docker's bridge network inside the runner container cannot resolve the host domain.
|
|
|
|
**Fix**:
|
|
1. Edit `config.yaml` on the runner machine and set `network: "host"` under `container:`:
|
|
```yaml
|
|
container:
|
|
network: "host"
|
|
```
|
|
2. Restart the `act_runner` daemon:
|
|
```bash
|
|
./act_runner daemon --config config.yaml
|
|
```
|
|
|
|
---
|
|
|
|
## 3. Local Build & Test Verification
|
|
|
|
You can verify the entire build and test suite locally at any time without external tools:
|
|
|
|
```bash
|
|
# Compile and run all 25 unit tests (130ms):
|
|
sh ./test_all.sh
|
|
|
|
# Build executable standalone JAR:
|
|
sh ./build_all.sh
|
|
|
|
# Run the emulator:
|
|
sh ./run.sh
|
|
```
|