Skip to content

2. Gitea Actions and the local runner ​

Home · Full index

Use .gitea/workflows/. The snippets use the ubuntu-latest label from the existing lab. A Gitea label maps to a runner configured by your instance. Inspect runner mode, runner version and container image before assuming which tools are available.

2.1 G01 · Identify the job environment ​

Gitea · Full workflow. Uses a push trigger so you can run this without first verifying manual-dispatch support.

yaml
name: Gitea runner probe
on: [push]
jobs:
  probe:
    runs-on: ubuntu-latest
    steps:
      - run: |
          id
          pwd
          uname -m
          cat /etc/os-release
          command -v git
          command -v python3

Verify. Look for the requested label and the job image in Gitea's runner log. A root user inside a container alone tells you little about whether the host runner is privileged.

2.2 G02 · Python tests with uv and a lockfile ​

Gitea · Full workflow. Requires checkout and setup-uv to work on your runner, a committed uv.lock and pytest in the default dev group. Run uv add --dev pytest locally and commit the project metadata before enabling CI. Adjust the test path if needed.

yaml
name: Gitea Python test
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: astral-sh/setup-uv@v6
        with:
          enable-cache: false
      - run: uv sync --locked --python 3.12
      - run: uv run --no-sync python -m pytest -q 30oct/test_calculator.py

Verify. Compare a passing test run with a run that changes a project dependency without updating uv.lock. uv sync --locked checks the lockfile and prepares the environment. uv run --no-sync then uses that environment. An alternative for a single step is uv run --locked --python 3.12 python -m pytest -q, which can sync before running the command.

2.3 G03 · Lint, test and build a Python wheel ​

Gitea · Full workflow. Requires a buildable package with a configured build backend, a committed uv.lock, and ruff and pytest in the default dev group. Each job sets up its own tooling. Use G04 before adding artifact upload.

yaml
name: Gitea quality and package
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: astral-sh/setup-uv@v6
        with:
          enable-cache: false
      - run: uv run --locked --python 3.12 ruff check .
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: astral-sh/setup-uv@v6
        with:
          enable-cache: false
      - run: uv run --locked --python 3.12 python -m pytest -q
  package:
    needs: [lint, test]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: astral-sh/setup-uv@v6
        with:
          enable-cache: false
      - run: |
          uv build --python 3.12 --wheel
          ls -l dist/*.whl

Verify. Make Ruff fail on a scratch branch. Confirm the package job is skipped. Restore it and confirm a wheel appears in the job log.

2.4 G04 · Check runner artifact support ​

Gitea · Full workflow for runners that patch the standard artifact actions. Read the documentation for your installed version first. Current runner documentation describes automatic action adaptation. Runner 2.x documents a different artifact implementation and may require Gitea-compatible forks. Choose an upload and download pair from the same documented implementation.

yaml
name: Gitea artifact probe
on: [push]
jobs:
  make:
    runs-on: ubuntu-latest
    steps:
      - run: printf 'hello from Gitea\n' > evidence.txt
      - uses: actions/upload-artifact@v4
        with:
          name: probe-evidence
          path: evidence.txt
          if-no-files-found: error
  read:
    needs: make
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          name: probe-evidence
          path: evidence
      - run: grep -Fx 'hello from Gitea' evidence/evidence.txt

Verify. Confirm which runner picked up each job, that download succeeds in the second job and that the file appears in Gitea's run UI. If the upload endpoint times out, check connectivity from inside the job container to the endpoint reported by the runner.

2.5 G05 · Check runner cache access ​

Gitea · Full workflow for a runner with the documented cache service v2 support. For older versions, match the action version to the runner documentation. Trigger two separate pushes and use the same runner for both. Keep the key stable until both runs finish.

yaml
name: Gitea cache probe
on: [push]
jobs:
  cache:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/cache@v4
        id: cache
        with:
          path: .ci-cache
          key: gitea-cache-probe-v1
      - env:
          CACHE_HIT: ${{ steps.cache.outputs.cache-hit }}
        run: printf 'exact cache hit=%s\n' "$CACHE_HIT"
      - if: steps.cache.outputs.cache-hit != 'true'
        run: |
          mkdir -p .ci-cache
          printf 'cached\n' > .ci-cache/probe
      - run: cat .ci-cache/probe

Verify. Look for a cache save in the first run and an exact cache hit in the next. Different runner machines may have separate caches. A warning or timeout is different from a normal cold cache miss.

2.6 G06 · Explicit action source ​

Gitea · Steps fragment. Use a reviewed source and ensure the runner can reach it. The runner also needs a Node runtime compatible with this checkout action.

yaml
- uses: https://github.com/actions/checkout@v4
  with:
    persist-credentials: false
- run: git rev-parse --short HEAD

Verify. The checkout log identifies the source and the next step prints a commit ID. Gitea also documents self: and builtin: on supported runners.

2.7 G07 · Measure runner capacity ​

Gitea · Operational lab. Use F03. Temporarily replace the command in both independent jobs.

bash
date -u '+start %FT%TZ'
sleep 15
date -u '+finish %FT%TZ'

Verify. Compare the two time intervals. Overlap proves concurrent execution. If the intervals are disjoint, review runner capacity, competing jobs and label availability before interpreting the job graph.

Reference · Gitea Actions comparison, runner documentation, current runner cache and artifacts, runner 2.x cache, uv CI guide.