Files
reforger_crawler_main/.gitea/workflows/build.yaml
T
ilbinek 56d9e10621
Cross Compile Go / build (push) Canceled after 0s
admin dashboard, metrics and telemetry
- embedded React admin UI at /admin/ui (go:embed), login with ADMIN_SECRET
  via signed HttpOnly session cookie, X-ADMIN-KEY still works for scripts
- admin API: overview stats, indexing queue, addon management (priority,
  reindex, delete/restore/purge, bulk), whitelist CRUD, duplicate hashes,
  traffic, metrics explorer, services, events/audit log, system info
- built-in metrics: request latency per route, visitors, top addons and
  searches, indexer/scraper counters; minute buckets in the DB with hourly
  rollups and retention; optional Prometheus /metrics (METRICS_TOKEN)
- POST /back/telemetry for indexers/scrapers (metrics, events, heartbeat)
  and a stdlib-only Go client in telemetry/
- auth hardening: empty secrets no longer allow access, constant-time
  compare, CORS not applied to /admin and /back, TRUSTED_PROXIES setting
- Dockerfile builds the UI and no longer bakes config.yaml into the image;
  CI builds the UI, runs tests and builds arm64 with CGO
2026-10-03 18:10:57 +02:00

78 lines
2.3 KiB
YAML

name: Cross Compile Go
run-name: Build and Bundle
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: web/package-lock.json
# The admin dashboard is embedded into the binary, so build it first
- name: Build admin UI
run: |
npm ci --prefix web
npm run build --prefix web
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Vet and test
run: |
go vet ./...
go test ./...
# SQLite needs CGO, so cross-compile ARM64 with the aarch64 C toolchain
- name: Install ARM64 C toolchain
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
# Build ARM64
- name: Build ARM64
run: CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 go build -v -ldflags "-s -w -X main.buildCommit=${{ github.sha }}" -o crawler_main-linux-arm64 .
# Build AMD64
- name: Build AMD64
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -v -ldflags "-s -w -X main.buildCommit=${{ github.sha }}" -o crawler_main-linux-amd64 .
# Create organized archives for download
- name: Bundle Artifacts
run: |
# Create a directory for ARM64 release
mkdir release-arm64
cp crawler_main-linux-arm64 release-arm64/crawler_main
cp config.yaml release-arm64/
tar -czvf release-arm64.tar.gz -C release-arm64 .
# Create a directory for AMD64 release
mkdir release-amd64
cp crawler_main-linux-amd64 release-amd64/crawler_main
tar -czvf release-amd64.tar.gz -C release-amd64 .
- name: Upload ARM64 Artifact
uses: actions/upload-artifact@v3
with:
name: linux-arm64
path: release-arm64.tar.gz
if-no-files-found: error
- name: Upload AMD64 Artifact
uses: actions/upload-artifact@v3
with:
name: linux-amd64
path: release-amd64.tar.gz
if-no-files-found: error