From 9f9453a3b088d4a82277cc43d421f9471a078ad9 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sun, 5 Apr 2026 23:57:43 -0700 Subject: [PATCH] ci: wire Forgejo Actions workflows and add .cliff.toml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the three standard CircuitForge workflows from cf-agents: - ci.yml: split backend (Python/ruff/pytest) + frontend (Node/vue-tsc/vitest) jobs - mirror.yml: push-to-GitHub + Codeberg on main/tags - release.yml: changelog generation + Forgejo release on v* tags (Docker push disabled pending BSL registry policy — cf-agents#3) Also adds .cliff.toml with conventional-commits changelog config. Full-stack ci.yml variant tracked in cf-agents#4; update when available. Required secrets: GITHUB_MIRROR_TOKEN, CODEBERG_MIRROR_TOKEN, FORGEJO_RELEASE_TOKEN Closes #69 --- .cliff.toml | 44 +++++++++++++++++++++ .forgejo/workflows/ci.yml | 57 +++++++++++++++++++++++++++ .forgejo/workflows/mirror.yml | 34 ++++++++++++++++ .forgejo/workflows/release.yml | 71 ++++++++++++++++++++++++++++++++++ 4 files changed, 206 insertions(+) create mode 100644 .cliff.toml create mode 100644 .forgejo/workflows/ci.yml create mode 100644 .forgejo/workflows/mirror.yml create mode 100644 .forgejo/workflows/release.yml diff --git a/.cliff.toml b/.cliff.toml new file mode 100644 index 0000000..ff7c437 --- /dev/null +++ b/.cliff.toml @@ -0,0 +1,44 @@ +# git-cliff changelog configuration for Peregrine +# See: https://git-cliff.org/docs/configuration + +[changelog] +header = """ +# Changelog\n +""" +body = """ +{% if version %}\ +## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ +## [Unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} +### {{ group | upper_first }} +{% for commit in commits %} +- {% if commit.scope %}**{{ commit.scope }}:** {% endif %}{{ commit.message | upper_first }}\ +{% endfor %} +{% endfor %}\n +""" +trim = true + +[git] +conventional_commits = true +filter_unconventional = true +split_commits = false +commit_preprocessors = [] +commit_parsers = [ + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Refactoring" }, + { message = "^docs", group = "Documentation" }, + { message = "^test", group = "Testing" }, + { message = "^chore", group = "Chores" }, + { message = "^ci", group = "CI/CD" }, + { message = "^revert", group = "Reverts" }, +] +filter_commits = false +tag_pattern = "v[0-9].*" +skip_tags = "" +ignore_tags = "" +topo_order = false +sort_commits = "oldest" diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml new file mode 100644 index 0000000..d18ca3c --- /dev/null +++ b/.forgejo/workflows/ci.yml @@ -0,0 +1,57 @@ +# Peregrine CI — lint, type-check, test on PR/push +# Full-stack: FastAPI (Python) + Vue 3 SPA (Node) +# Adapted from Circuit-Forge/cf-agents workflows/ci.yml (cf-agents#4 tracks the +# upstream ci-fullstack.yml variant; update this file when that lands). + +name: CI + +on: + push: + branches: [main, 'feature/**', 'fix/**'] + pull_request: + branches: [main] + +jobs: + backend: + name: Backend (Python) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + cache: pip + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Lint + run: ruff check . + + - name: Test + run: pytest tests/ -v --tb=short + + frontend: + name: Frontend (Vue) + runs-on: ubuntu-latest + defaults: + run: + working-directory: web + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + cache-dependency-path: web/package-lock.json + + - name: Install dependencies + run: npm ci + + - name: Type check + run: npx vue-tsc --noEmit + + - name: Test + run: npm run test diff --git a/.forgejo/workflows/mirror.yml b/.forgejo/workflows/mirror.yml new file mode 100644 index 0000000..83d273d --- /dev/null +++ b/.forgejo/workflows/mirror.yml @@ -0,0 +1,34 @@ +# Mirror push to GitHub and Codeberg on every push to main or tag. +# Copied from Circuit-Forge/cf-agents workflows/mirror.yml +# Required secrets: GITHUB_MIRROR_TOKEN, CODEBERG_MIRROR_TOKEN + +name: Mirror + +on: + push: + branches: [main] + tags: ['v*'] + +jobs: + mirror: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Mirror to GitHub + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_MIRROR_TOKEN }} + REPO: ${{ github.event.repository.name }} + run: | + git remote add github "https://x-access-token:${GITHUB_TOKEN}@github.com/CircuitForgeLLC/${REPO}.git" + git push github --mirror + + - name: Mirror to Codeberg + env: + CODEBERG_TOKEN: ${{ secrets.CODEBERG_MIRROR_TOKEN }} + REPO: ${{ github.event.repository.name }} + run: | + git remote add codeberg "https://CircuitForge:${CODEBERG_TOKEN}@codeberg.org/CircuitForge/${REPO}.git" + git push codeberg --mirror diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..fda07af --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,71 @@ +# Tag-triggered release workflow. +# Generates changelog and creates Forgejo release on v* tags. +# Copied from Circuit-Forge/cf-agents workflows/release.yml +# +# Docker push is intentionally disabled — BSL 1.1 registry policy not yet resolved. +# Tracked in Circuit-Forge/cf-agents#3. Re-enable the Docker steps when that lands. +# +# Required secrets: FORGEJO_RELEASE_TOKEN +# (GHCR_TOKEN not needed until Docker push is enabled) + +name: Release + +on: + push: + tags: ['v*'] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # ── Changelog ──────────────────────────────────────────────────────────── + - name: Generate changelog + uses: orhun/git-cliff-action@v3 + id: cliff + with: + config: .cliff.toml + args: --latest --strip header + env: + OUTPUT: CHANGES.md + + # ── Docker (disabled — BSL registry policy pending cf-agents#3) ────────── + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + # - name: Set up Buildx + # uses: docker/setup-buildx-action@v3 + # - name: Log in to GHCR + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.actor }} + # password: ${{ secrets.GHCR_TOKEN }} + # - name: Build and push Docker image + # uses: docker/build-push-action@v6 + # with: + # context: . + # push: true + # platforms: linux/amd64,linux/arm64 + # tags: | + # ghcr.io/circuitforgellc/peregrine:${{ github.ref_name }} + # ghcr.io/circuitforgellc/peregrine:latest + # cache-from: type=gha + # cache-to: type=gha,mode=max + + # ── Forgejo Release ─────────────────────────────────────────────────────── + - name: Create Forgejo release + env: + FORGEJO_TOKEN: ${{ secrets.FORGEJO_RELEASE_TOKEN }} + REPO: ${{ github.event.repository.name }} + TAG: ${{ github.ref_name }} + NOTES: ${{ steps.cliff.outputs.content }} + run: | + curl -sS -X POST \ + "https://git.opensourcesolarpunk.com/api/v1/repos/Circuit-Forge/${REPO}/releases" \ + -H "Authorization: token ${FORGEJO_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg tag "$TAG" --arg body "$NOTES" \ + '{tag_name: $tag, name: $tag, body: $body}')"