One CI pipeline for GitHub™, Gitea™ and Forgejo

Jennifer

One workflow file, three forges: fmt, lint, docblocks, tests and the docs, for a small Jennifer app.

November 2026, by @mplx.
Based on Jennifer 0.27.0

Powered by Jennifer's Cantrip - Markdown into slide decks, https://github.com/jennifer-language/cantrip
1 / 20

The example: tempo

tempo/
  bin/tempo                 the launcher
  src/parse.j  format.j     two modules
  src/parse_test.j  format_test.j
  docs/  grimoire.toml      the book
  tools/check.sh  docs.sh  install-jennifer.sh  docblocks.j
  .github/workflows/ci.yml
$ jennifer run bin/tempo 1h30m 45m 30s
2h15m30s
2 / 20

A module with docblocks

use convert;

/**
 * Return seconds as hours, minutes and seconds, without zero parts.
 * @param total {int} the duration in seconds, not negative
 * @return {string} the duration, for example `1h30m`; `0s` for zero
 */
export func duration(total as int) {
    def h as int init $total // 3600;
    def m as int init $total % 3600 // 60;
    return convert.toString($h) + "h" + convert.toString($m) + "m";
}
3 / 20

The gate is a script, not YAML

#!/bin/sh
# The gate: the same four checks locally and in CI.
set -eu
srcs=$(ls src/*.j | grep -v '_test\.j$')
echo "== fmt";       jennifer fmt -l src/*.j bin/tempo tools/*.j
echo "== lint";      jennifer lint src/*.j bin/tempo tools/*.j
echo "== docblocks"; jennifer run tools/docblocks.j $srcs
echo "== tests"
for t in src/*_test.j; do jennifer test "$t"; done
4 / 20

Docblocks: the standard library checks them

import "docblock.j" as docblock;    # plus use fs, io and os
def bad as int init 0;
for (def file in os.ARGS[1..len(os.ARGS)]) {
    def text as string init fs.readString($file);
    def doc as docblock.FileDoc init docblock.parse($text);
    for (def d in $doc.diagnostics) {
        io.printf("%s:%d: %s\n", $file, $d.line, $d.message);
        $bad = $bad + 1;
    }
}
if ($bad > 0) {
    exit 1;
}
5 / 20

A green run

$ tools/check.sh
== fmt
== lint
== docblocks
== tests
PASS testDuration (0 ms)

1 passed, 0 failed, 1 total
PASS testRejects (0 ms)
PASS testSeconds (0 ms)

2 passed, 0 failed, 2 total
6 / 20

A red run: what each check catches

== fmt
src/parse.j
format.j:9:1: warning: unused import: `use strings` - the `strings`
  namespace is never referenced [L106]
format.j:24:5: warning: local `unused` is declared but never
  used [L101]
src/format.j:15: @param "secs" is not a param of duration
src/format.j:15: param "total" of duration has no @param
FAIL testSeconds (0 ms)
     [assertion] parse_test.j:4:5 assertEqual: 5400 != 5300
7 / 20

Installing Jennifer: from the release

set -eu
v="$1"
stage="jennifer-$v-linux-amd64"
base="https://github.com/jennifer-language/jennifer"
base="$base/releases/download/$v"
mkdir -p .ci && cd .ci
curl -fsSLO "$base/$stage.tar.gz"
curl -fsSLO "$base/$stage.tar.gz.sha256"
sha256sum -c "$stage.tar.gz.sha256"
tar xzf "$stage.tar.gz"
echo "$PWD/$stage" >> "$GITHUB_PATH"
echo "JENNIFER_SYSMODDIR=$PWD/$stage/share/jennifer/modules" \
    >> "$GITHUB_ENV"
8 / 20

The book: a pinned Grimoire

#!/bin/sh
# Build the book into site/ with Grimoire release $1.
set -eu
git clone -q -c advice.detachedHead=false \
    --depth 1 --branch "$1" \
    https://github.com/jennifer-language/grimoire.git .ci/grimoire
jennifer run .ci/grimoire/bin/grimoire build
$ tools/docs.sh 0.5.0
built 2 pages into site/ (62 KiB, 0 assets) in 9 ms
  search index: 2 sections
9 / 20

ci.yml: one gate

on:
  push: { branches: [main] }
  pull_request:
permissions: { contents: read }
env: { JENNIFER_VERSION: 0.27.0, GRIMOIRE_VERSION: 0.5.0 }
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: tools/install-jennifer.sh "$JENNIFER_VERSION"
      - run: tools/check.sh
10 / 20

ci.yml: the book, on every forge

  docs:
    needs: check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: tools/install-jennifer.sh "$JENNIFER_VERSION"
      - run: tools/docs.sh "$GRIMOIRE_VERSION"

Jobs share no files: each one checks out and installs again.

11 / 20

ci.yml: Pages, on GitHub only

  pages:
    needs: check
    if: github.server_url == 'https://github.com' &&
      github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    permissions: { contents: read, pages: write, id-token: write }
    environment: github-pages
    steps:
      # checkout, install-jennifer.sh, docs.sh: as in the docs job
      - uses: actions/upload-pages-artifact@v3
        with: { path: site }
      - uses: actions/deploy-pages@v4
12 / 20

Where each forge looks for workflows

ForgeReads
GitHub.github/workflows/
Giteathe first that exists of WORKFLOW_DIRS, by default .gitea/workflows, .github/workflows
Forgejo.forgejo/workflows/; without it, .github/workflows/

Never add a .gitea/ or .forgejo/ workflow folder to a shared repo: the .github/ workflows then vanish there, without a warning.

13 / 20

Turning Actions on

ForgeBy default
GitHubon for a repository with workflows
Giteainstance switch [actions] ENABLED; then still off per repository
Forgejoon since Forgejo 1.21 ([actions] ENABLED = false to disable)

And on Gitea and Forgejo, nothing runs without a registered runner: gitea-runner or forgejo-runner.

14 / 20

uses: actions/checkout@v4: from where?

ForgeA uses: without a host is fetched from
GitHubgithub.com
GiteaDEFAULT_ACTIONS_URL: github (default) or self
ForgejoDEFAULT_ACTIONS_URL, by default https://data.forgejo.org
# Gitea and Forgejo also take a full URL:
- uses: https://data.forgejo.org/actions/checkout@v4
15 / 20

runs-on: names a runner label

ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest
ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-22.04
debian:docker://docker.io/library/node:lts
macos:host

<label>:<type>://<image>: the runner's admin decides what ubuntu-latest is. It is not GitHub's image.

16 / 20

Tokens, secrets and contexts

GitHubGiteaForgejo
job tokenGITHUB_TOKENGITEA_TOKENFORGEJO_TOKEN = GITHUB_TOKEN
contextgithub.*gitea.*, github.* aliasforgejo.* = forge.* = github.*
reserved prefixGITHUB_GITHUB_, GITEA_ (secrets)FORGEJO_, GITHUB_, GITEA_ (variables)
17 / 20

What only GitHub has

Keep such steps in a job guarded by github.server_url.

18 / 20

Checklist

19 / 20

Read more

Based on Jennifer 0.27.0, November 2026.

20 / 20