swtich to gitea
Asteria Qt CI / rebuild-images (linux-x86_64) (push) Skipped
Asteria Qt CI / rebuild-images (windows-arm64) (push) Skipped
Asteria Qt CI / rebuild-images (windows-x86_64) (push) Skipped
Asteria Qt CI / build-linux (push) Canceled after 0s
Asteria Qt CI / build-linux-arm64 (push) Canceled after 0s
Asteria Qt CI / build-windows (push) Canceled after 0s
Asteria Qt CI / build-windows-arm64 (push) Canceled after 0s
Asteria Qt CI / build-macos (push) Canceled after 0s
Asteria Qt CI / test-linux (push) Canceled after 0s
Asteria Qt CI / test-macos (push) Canceled after 0s
Asteria Qt CI / package-linux (push) Canceled after 0s
Asteria Qt CI / package-linux-arm64 (push) Canceled after 0s
Asteria Qt CI / rebuild-images (linux-arm64) (push) Skipped
Asteria Qt CI / package-windows (push) Canceled after 0s
Asteria Qt CI / package-windows-arm64 (push) Canceled after 0s
Asteria Qt CI / package-macos (push) Canceled after 0s
Asteria Qt CI / release (push) Canceled after 0s

This commit is contained in:
Agel committed 2026-11-22 17:28:07 +01:00
1 parent 4ae1cf34fb
commit b05a2fecf8
14 files changed
+981 -841

No files matched your search

+59 -41
View File
@@ -1,12 +1,10 @@
#!/usr/bin/env bash
# Start a local GitLab Runner for macOS builds (shell executor).
# Start a local Gitea Actions Runner for macOS builds (host mode).
#
# First-time registration usage:
# RUNNER_TOKEN="glrt-..." ./scripts/start-runner-macos.sh
# or with a legacy registration token:
# REGISTRATION_TOKEN="..." ./scripts/start-runner-macos.sh
# RUNNER_TOKEN="..." ./scripts/start-runner-macos.sh
#
# Subsequent runs (once config.toml exists):
# Subsequent runs (once .runner exists):
# ./scripts/start-runner-macos.sh
set -euo pipefail
@@ -18,21 +16,32 @@ fi
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
if ! command -v gitlab-runner >/dev/null 2>&1; then
RUNNER_BIN=""
if command -v gitea-runner >/dev/null 2>&1; then
RUNNER_BIN="gitea-runner"
elif command -v act_runner >/dev/null 2>&1; then
RUNNER_BIN="act_runner"
else
if ! command -v brew >/dev/null 2>&1; then
echo "ERROR: Homebrew is required to install gitlab-runner. Please install Homebrew from https://brew.sh" >&2
echo "ERROR: Homebrew is required to install gitea-runner. Please install Homebrew from https://brew.sh" >&2
exit 1
fi
echo "gitlab-runner not found. Installing via Homebrew..."
brew install gitlab-runner
echo "gitea-runner not found. Installing via Homebrew..."
brew install gitea-runner
if command -v gitea-runner >/dev/null 2>&1; then
RUNNER_BIN="gitea-runner"
else
RUNNER_BIN="act_runner"
fi
fi
RUNNER_CONFIG_DIR="${RUNNER_CONFIG_DIR:-$HOME/.gitlab-runner}"
CONFIG_FILE="${RUNNER_CONFIG_DIR}/config.toml"
RUNNER_CONFIG_DIR="${RUNNER_CONFIG_DIR:-$HOME/.gitea-runner}"
CONFIG_FILE="${RUNNER_CONFIG_DIR}/config.yaml"
RUNNER_FILE="${RUNNER_CONFIG_DIR}/.runner"
RUNNER_WORKDIR="${RUNNER_WORKDIR:-${RUNNER_CONFIG_DIR}/builds}"
CI_SERVER_URL="${CI_SERVER_URL:-https://gitlab.com}"
GITEA_INSTANCE_URL="${GITEA_INSTANCE_URL:-${CI_SERVER_URL:-https://gitea.agel.dev}}"
RUNNER_NAME="${RUNNER_NAME:-asteria-qt-macos-runner}"
RUNNER_TAGS="${RUNNER_TAGS:-macos-qt}"
RUNNER_LABELS="${RUNNER_LABELS:-${RUNNER_TAGS:-macos-qt:host}}"
export QT_MACOS_DIR="${QT_MACOS_DIR:-/opt/qt/6.12.0/macos}"
if command -v brew >/dev/null 2>&1; then
@@ -43,39 +52,48 @@ if command -v brew >/dev/null 2>&1; then
fi
mkdir -p "${RUNNER_CONFIG_DIR}" "${RUNNER_WORKDIR}"
cd "${RUNNER_CONFIG_DIR}"
if [ ! -f "${CONFIG_FILE}" ]; then
if [ -n "${RUNNER_TOKEN:-}" ]; then
echo "Registering runner with authentication token..."
echo "NOTE: Ensure the runner in GitLab has the tag '${RUNNER_TAGS}' assigned."
gitlab-runner register \
--non-interactive \
cat > "${CONFIG_FILE}" <<EOF
log:
level: info
runner:
file: ${RUNNER_FILE}
capacity: 1
timeout: 3h
insecure: false
fetch_timeout: 5s
fetch_interval: 2s
labels:
- "${RUNNER_LABELS}"
cache:
enabled: true
dir: ${RUNNER_CONFIG_DIR}/cache
host:
workdir_parent: ${RUNNER_WORKDIR}
EOF
if [ ! -f "${RUNNER_FILE}" ]; then
TOKEN="${RUNNER_TOKEN:-${GITEA_RUNNER_REGISTRATION_TOKEN:-${REGISTRATION_TOKEN:-}}}"
if [ -n "${TOKEN}" ]; then
echo "Registering Gitea runner '${RUNNER_NAME}' at '${GITEA_INSTANCE_URL}' with labels '${RUNNER_LABELS}'..."
"${RUNNER_BIN}" register \
--no-interactive \
--config "${CONFIG_FILE}" \
--url "${CI_SERVER_URL}" \
--token "${RUNNER_TOKEN}" \
--executor shell \
--shell bash \
--name "${RUNNER_NAME}"
elif [ -n "${REGISTRATION_TOKEN:-}" ]; then
echo "Registering runner with legacy registration token and tags '${RUNNER_TAGS}'..."
gitlab-runner register \
--non-interactive \
--config "${CONFIG_FILE}" \
--url "${CI_SERVER_URL}" \
--registration-token "${REGISTRATION_TOKEN}" \
--executor shell \
--shell bash \
--instance "${GITEA_INSTANCE_URL}" \
--token "${TOKEN}" \
--name "${RUNNER_NAME}" \
--tag-list "${RUNNER_TAGS}" \
--run-untagged="${RUNNER_RUN_UNTAGGED:-false}" \
--locked="${RUNNER_LOCKED:-false}"
--labels "${RUNNER_LABELS}"
else
echo "ERROR: No runner configuration found at ${CONFIG_FILE}." >&2
echo "Provide RUNNER_TOKEN (glrt-...) or REGISTRATION_TOKEN to register first:" >&2
echo " RUNNER_TOKEN=glrt-... $0" >&2
echo "ERROR: No runner registration found at ${RUNNER_FILE}." >&2
echo "Provide RUNNER_TOKEN from Gitea (Org/Repo Settings -> Actions -> Runners) to register first:" >&2
echo " RUNNER_TOKEN=<token> $0" >&2
exit 1
fi
fi
echo "Starting local macOS GitLab Runner (config: ${CONFIG_FILE}, workdir: ${RUNNER_WORKDIR})..."
exec gitlab-runner run --config "${CONFIG_FILE}" --working-directory "${RUNNER_WORKDIR}"
echo "Starting local macOS Gitea Runner (bin: ${RUNNER_BIN}, config: ${CONFIG_FILE}, workdir: ${RUNNER_WORKDIR})..."
exec "${RUNNER_BIN}" daemon --config "${CONFIG_FILE}"