Files
slack-sieve/.gitea/workflows/ci.yml
T
ilia b24544066e
CI / skip-ci-check (pull_request) Successful in 30s
CI / secret-scan (pull_request) Successful in 30s
CI / python-ci (pull_request) Failing after 42s
ci: run python-ci on ubuntu-latest runner image
Host/container nesting with node:20-bookworm kept failing on main
(~50s) while local pytest (105) and ruff stayed green. Match apply-bot:
setup-python on ubuntu-latest docker label, keep secret-scan on heavy.
2026-08-06 13:38:25 -04:00

78 lines
2.3 KiB
YAML

---
# Homelab CI — Python lane (ubuntu-latest docker image) + secret scan (git-ci-02)
# POLICY: lint and tests are HARD gates. Never add `|| true` to them.
# Skip: @skipci in branch name or commit message
name: CI
on:
push:
branches: [master, main]
pull_request:
types: [opened, synchronize, reopened]
jobs:
skip-ci-check:
runs-on: [homelab, self-hosted, linux]
container:
image: node:20-bookworm
outputs:
should-skip: ${{ steps.check.outputs.skip }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- id: check
run: |
SKIP=0
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
MSG="${GITHUB_EVENT_HEAD_COMMIT_MESSAGE:-$(git log -1 --pretty=%B 2>/dev/null || true)}"
echo "$BRANCH" "$MSG" | grep -qi '@skipci' && SKIP=1
echo "skip=$SKIP" >> $GITHUB_OUTPUT
python-ci:
needs: skip-ci-check
if: needs.skip-ci-check.outputs.should-skip != '1'
# ubuntu-latest → docker://docker.gitea.com/runner-images:ubuntu-latest
# (avoids host/container nesting quirks that broke node:20-bookworm python-ci)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python tooling
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -r requirements-dev.txt bandit pip-audit ruff
- name: Ruff lint
run: ruff check server.py slack_export.py tests scripts
- name: Bandit (advisory)
run: bandit -r . -q || true
- name: pip-audit (advisory)
run: pip-audit -r requirements.txt 2>/dev/null || pip-audit 2>/dev/null || true
- name: Pytest
env:
PYTHONPATH: .
run: python -m pytest -q --tb=short
secret-scan:
needs: skip-ci-check
if: needs.skip-ci-check.outputs.should-skip != '1'
runs-on: [homelab, self-hosted, linux, heavy]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Gitleaks
run: |
docker run --rm -v "$PWD:/repo" ghcr.io/gitleaks/gitleaks:latest \
detect --source /repo --no-banner --redact