Files
tai/.gitea/workflows/ci.yml
zphinx 3be14f8f6f
All checks were successful
CI / test (push) Successful in 27s
commit all of this
2026-05-14 20:00:38 +02:00

101 lines
2.9 KiB
YAML

name: CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Ensure git is available
run: |
if command -v git >/dev/null 2>&1; then
git --version
exit 0
fi
if command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y git
elif command -v dnf >/dev/null 2>&1; then
dnf install -y git
elif command -v yum >/dev/null 2>&1; then
yum install -y git
else
echo "No supported package manager found to install git."
exit 1
fi
git --version
- name: Checkout source (native git)
env:
CI_GIT_TOKEN: ${{ secrets.CI_GIT_TOKEN }}
run: |
if [ -z "${CI_GIT_TOKEN:-}" ]; then
echo "Missing secret CI_GIT_TOKEN. Add it in repository Actions secrets."
exit 1
fi
auth_server="${GITHUB_SERVER_URL#https://}"
auth_server="${auth_server#http://}"
remote_url="https://oauth2:${CI_GIT_TOKEN}@${auth_server}/${GITHUB_REPOSITORY}.git"
if [ -n "${GITHUB_WORKSPACE:-}" ]; then
cd "$GITHUB_WORKSPACE"
fi
if [ ! -d .git ]; then
git init
fi
git remote remove origin >/dev/null 2>&1 || true
git remote add origin "$remote_url"
git fetch --depth 1 origin "$GITHUB_SHA"
git checkout --force FETCH_HEAD
- name: Ensure Python and pip are available
run: |
if command -v apt-get >/dev/null 2>&1; then
apt-get update
apt-get install -y python3.12 python3.12-venv python3-pip || \
apt-get install -y python3 python3-pip python3-venv
elif command -v dnf >/dev/null 2>&1; then
dnf install -y python3 python3-pip
elif command -v yum >/dev/null 2>&1; then
yum install -y python3 python3-pip
else
echo "No supported package manager found to install Python."
exit 1
fi
python3.12 --version || python3 --version
- name: Install package and dev dependencies
run: |
python3.12 -m venv .venv 2>/dev/null || python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Lint
run: .venv/bin/python -m ruff check .
- name: Lint Markdown
run: .venv/bin/mdformat --check README.md ROADMAP.md CHANGELOG.md
- name: Lint YAML
run: .venv/bin/yamllint .
- name: Type-check
run: .venv/bin/python -m mypy src
- name: Validate man-page sync with CLI
run: .venv/bin/python -m pytest tests/test_cli.py::test_man_page_covers_cli_long_options -v
- name: Test
run: .venv/bin/python -m pytest