chore(ci): use uv for Python 3.12 (arm64) instead of actions/setup-python
This commit is contained in:
parent
775d7a8a13
commit
ef95250b7d
3 changed files with 30 additions and 84 deletions
|
|
@ -1,5 +1,9 @@
|
|||
name: CI
|
||||
|
||||
# Runs on the Forgejo runner job image (default label image: node:20-bookworm,
|
||||
# which has node + git). Python 3.12 is provisioned with `uv`, because
|
||||
# actions/setup-python has no Linux/arm64 builds for 3.12.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, main]
|
||||
|
|
@ -12,54 +16,23 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.12"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
env:
|
||||
POSTGRES_DB: infrasynth
|
||||
POSTGRES_USER: infrasynth
|
||||
POSTGRES_PASSWORD: infrasynth
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
ports:
|
||||
- 6379:6379
|
||||
options: >-
|
||||
--health-cmd "redis-cli ping"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
cache: pip
|
||||
- name: Install uv
|
||||
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Create Python 3.12 venv + install deps
|
||||
run: |
|
||||
pip install --upgrade pip setuptools wheel
|
||||
pip install -e ".[dev]"
|
||||
"$HOME/.local/bin/uv" venv --python 3.12
|
||||
"$HOME/.local/bin/uv" pip install -e ".[dev]"
|
||||
|
||||
- name: Run tests
|
||||
run: pytest --cov=infrasynth --cov-report=term-missing -v
|
||||
run: .venv/bin/python -m pytest --cov=infrasynth --cov-report=term-missing -v
|
||||
env:
|
||||
DJANGO_SETTINGS_MODULE: config.settings.test
|
||||
|
||||
|
|
@ -69,18 +42,14 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install ruff
|
||||
- name: Install uv
|
||||
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
- name: Run ruff
|
||||
run: ruff check .
|
||||
run: '$HOME/.local/bin/uvx ruff check .'
|
||||
|
||||
- name: Check formatting
|
||||
run: ruff format --check infrasynth/ config/ tests/
|
||||
run: '$HOME/.local/bin/uvx ruff format --check infrasynth/ config/ tests/'
|
||||
|
||||
typecheck:
|
||||
name: Type Check
|
||||
|
|
@ -88,32 +57,13 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
cache: pip
|
||||
- name: Install uv
|
||||
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Create Python 3.12 venv + install deps
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
"$HOME/.local/bin/uv" venv --python 3.12
|
||||
"$HOME/.local/bin/uv" pip install -e ".[dev]"
|
||||
|
||||
- name: Run mypy
|
||||
run: mypy infrasynth/
|
||||
|
||||
docker:
|
||||
name: Docker Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
load: true
|
||||
tags: infrasynth-base:ci
|
||||
run: .venv/bin/mypy infrasynth/
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ name: Publish
|
|||
# FORGEJO_USERNAME your Forgejo username (e.g. moravak)
|
||||
# FORGEJO_TOKEN an access token with the `write:package` scope
|
||||
#
|
||||
# `runs-on` must match a label registered by your Forgejo runner
|
||||
# (commonly `ubuntu-latest` or `docker`).
|
||||
# Uses `uv` for Python 3.12 (arm64-friendly); no actions/setup-python needed.
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -19,7 +18,6 @@ permissions:
|
|||
contents: read
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.12"
|
||||
# Forgejo's PyPI registry is /api/packages/<owner>/pypi
|
||||
REGISTRY_URL: https://git.infrasynth.net/api/packages/moravak/pypi
|
||||
|
||||
|
|
@ -30,20 +28,18 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
cache: pip
|
||||
|
||||
- name: Install build tooling
|
||||
run: python -m pip install --upgrade pip build twine
|
||||
- name: Install uv
|
||||
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
|
||||
- name: Build sdist + wheel
|
||||
run: python -m build
|
||||
run: |
|
||||
"$HOME/.local/bin/uv" venv --python 3.12
|
||||
"$HOME/.local/bin/uv" pip install build twine
|
||||
.venv/bin/python -m build
|
||||
|
||||
- name: Publish to Forgejo PyPI registry
|
||||
env:
|
||||
TWINE_USERNAME: ${{ secrets.FORGEJO_USERNAME }}
|
||||
TWINE_PASSWORD: ${{ secrets.FORGEJO_TOKEN }}
|
||||
run: |
|
||||
python -m twine upload --non-interactive --repository-url "$REGISTRY_URL" dist/*
|
||||
.venv/bin/twine upload --non-interactive --repository-url "$REGISTRY_URL" dist/*
|
||||
|
|
|
|||
4
PLAN.md
4
PLAN.md
|
|
@ -133,7 +133,7 @@ InfraSynth Base es un conjunto de Django apps reutilizables que proveen la infra
|
|||
- [x] ruff check . sin errores
|
||||
- [x] mypy infrasynth/ sin errores
|
||||
- [x] pre-commit hooks configurados
|
||||
- [x] Forgejo Actions: tests + lint + typecheck + docker build
|
||||
- [x] Forgejo Actions: tests + lint + typecheck (Python 3.12 vía `uv`, arm64-friendly)
|
||||
- [x] Dockerfile multi-stage + docker-compose con health checks
|
||||
- [x] Badges (CI, python, django, ruff, mypy) en PLAN.md
|
||||
- [ ] Docker push (pendiente de registry config)
|
||||
|
|
@ -3440,7 +3440,7 @@ volumes:
|
|||
- **Cache:** Redis (caching + sessions + Celery broker)
|
||||
- **Monitoring:** Sentry (errors) + Prometheus + Grafana (metrics)
|
||||
- **Logging:** structlog → JSON stdout → Loki + Grafana
|
||||
- **CI/CD:** Forgejo Actions (tests + lint + typecheck + docker build)
|
||||
- **CI/CD:** Forgejo Actions (tests + lint + typecheck)
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue