Merge ci/test-workflows: fix Gitea Actions workflow
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# Minimal workflow to verify act_runner is online.
|
||||
name: Runner smoke test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
hello:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
echo "Runner works"
|
||||
python3 --version
|
||||
uname -a
|
||||
@@ -1,13 +1,8 @@
|
||||
# Sync vendored recipe JSON from tristinbaker/IdleFantasy, run smoke tests, deploy.
|
||||
#
|
||||
# Secrets (repo settings → Actions → Secrets):
|
||||
# DEPLOY_SSH_KEY — private key for DEPLOY_HOST
|
||||
# Optional variables:
|
||||
# DEPLOY_HOST — default root@10.0.0.5
|
||||
# DEPLOY_DIR — default /opt/apps/Idle-Fantasy-Save-Viewer
|
||||
# DEPLOY_SERVICE — default viewer
|
||||
#
|
||||
# Set AUTO_DEPLOY=false to sync + test only (no SSH deploy).
|
||||
# Requires: act_runner registered for this repo/org/instance (label ubuntu-latest).
|
||||
# Secrets: DEPLOY_SSH_KEY (optional, for deploy)
|
||||
# Variables: AUTO_DEPLOY=false to skip deploy; DEPLOY_HOST, DEPLOY_DIR, DEPLOY_SERVICE
|
||||
name: Sync Upstream Game Data
|
||||
|
||||
on:
|
||||
@@ -20,9 +15,6 @@ on:
|
||||
required: false
|
||||
default: manual
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
sync-test-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -33,18 +25,13 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Sync recipe JSON from upstream IdleFantasy
|
||||
run: python scripts/sync_game_data.py
|
||||
run: python3 scripts/sync_game_data.py
|
||||
|
||||
- name: Smoke tests
|
||||
run: |
|
||||
python test_db_goals.py
|
||||
python test_advisor.py
|
||||
python3 test_db_goals.py
|
||||
python3 test_advisor.py
|
||||
|
||||
- name: Commit and push if game_data changed
|
||||
id: commit
|
||||
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# Register and start a Gitea Actions runner (act_runner) for gitea.elpatron.me
|
||||
#
|
||||
# Prerequisites: Docker, access to Gitea as admin
|
||||
#
|
||||
# 1. In Gitea: Site Administration → Actions → Runners → Create new Runner
|
||||
# (or: Repo → Settings → Actions → Runners)
|
||||
# Copy the registration token.
|
||||
#
|
||||
# 2. Run:
|
||||
# GITEA_RUNNER_TOKEN='paste-token-here' bash scripts/setup-gitea-runner.sh
|
||||
#
|
||||
# 3. Verify: Gitea → Administration → Actions → Runners → Status "Online"
|
||||
# Then re-run: Actions → Sync Upstream Game Data (or "Runner smoke test")
|
||||
set -euo pipefail
|
||||
|
||||
GITEA_URL="${GITEA_URL:-https://gitea.elpatron.me}"
|
||||
RUNNER_NAME="${GITEA_RUNNER_NAME:-linux-docker-$(hostname -s)}"
|
||||
RUNNER_LABELS="${GITEA_RUNNER_LABELS:-ubuntu-latest:docker://catthehacker/ubuntu:act-22.04,ubuntu-22.04:docker://catthehacker/ubuntu:act-22.04}"
|
||||
DATA_DIR="${GITEA_RUNNER_DATA:-$HOME/.local/gitea-act-runner}"
|
||||
CONTAINER_NAME="${GITEA_RUNNER_CONTAINER:-gitea-act-runner}"
|
||||
|
||||
if [[ -z "${GITEA_RUNNER_TOKEN:-}" ]]; then
|
||||
echo "ERROR: Set GITEA_RUNNER_TOKEN (from Gitea → Administration → Actions → Runners)"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " GITEA_RUNNER_TOKEN='...' bash scripts/setup-gitea-runner.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$DATA_DIR"
|
||||
|
||||
if docker ps -a --format '{{.Names}}' | grep -qx "$CONTAINER_NAME"; then
|
||||
echo "==> Stopping existing container $CONTAINER_NAME"
|
||||
docker rm -f "$CONTAINER_NAME" >/dev/null
|
||||
fi
|
||||
|
||||
echo "==> Starting act_runner"
|
||||
echo " Gitea: $GITEA_URL"
|
||||
echo " Name: $RUNNER_NAME"
|
||||
echo " Labels: $RUNNER_LABELS"
|
||||
echo " Data: $DATA_DIR"
|
||||
|
||||
docker run -d \
|
||||
--name "$CONTAINER_NAME" \
|
||||
--restart unless-stopped \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v "$DATA_DIR:/data" \
|
||||
-e GITEA_INSTANCE_URL="$GITEA_URL" \
|
||||
-e GITEA_RUNNER_REGISTRATION_TOKEN="$GITEA_RUNNER_TOKEN" \
|
||||
-e GITEA_RUNNER_NAME="$RUNNER_NAME" \
|
||||
-e GITEA_RUNNER_LABELS="$RUNNER_LABELS" \
|
||||
gitea/act_runner:latest
|
||||
|
||||
echo ""
|
||||
echo "==> Logs (Ctrl+C to stop watching):"
|
||||
sleep 2
|
||||
docker logs -f "$CONTAINER_NAME"
|
||||
Reference in New Issue
Block a user