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
|
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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master, main]
|
branches: [master, main]
|
||||||
|
|
@ -12,54 +16,23 @@ concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
env:
|
|
||||||
PYTHON_VERSION: "3.12"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Tests
|
name: Tests
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- name: Install uv
|
||||||
with:
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
cache: pip
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Create Python 3.12 venv + install deps
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip setuptools wheel
|
"$HOME/.local/bin/uv" venv --python 3.12
|
||||||
pip install -e ".[dev]"
|
"$HOME/.local/bin/uv" pip install -e ".[dev]"
|
||||||
|
|
||||||
- name: Run tests
|
- 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:
|
env:
|
||||||
DJANGO_SETTINGS_MODULE: config.settings.test
|
DJANGO_SETTINGS_MODULE: config.settings.test
|
||||||
|
|
||||||
|
|
@ -69,18 +42,14 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- name: Install uv
|
||||||
with:
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pip install ruff
|
|
||||||
|
|
||||||
- name: Run ruff
|
- name: Run ruff
|
||||||
run: ruff check .
|
run: '$HOME/.local/bin/uvx ruff check .'
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: ruff format --check infrasynth/ config/ tests/
|
run: '$HOME/.local/bin/uvx ruff format --check infrasynth/ config/ tests/'
|
||||||
|
|
||||||
typecheck:
|
typecheck:
|
||||||
name: Type Check
|
name: Type Check
|
||||||
|
|
@ -88,32 +57,13 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- name: Install uv
|
||||||
with:
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
cache: pip
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Create Python 3.12 venv + install deps
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
"$HOME/.local/bin/uv" venv --python 3.12
|
||||||
pip install -e ".[dev]"
|
"$HOME/.local/bin/uv" pip install -e ".[dev]"
|
||||||
|
|
||||||
- name: Run mypy
|
- name: Run mypy
|
||||||
run: mypy infrasynth/
|
run: .venv/bin/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
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ name: Publish
|
||||||
# FORGEJO_USERNAME your Forgejo username (e.g. moravak)
|
# FORGEJO_USERNAME your Forgejo username (e.g. moravak)
|
||||||
# FORGEJO_TOKEN an access token with the `write:package` scope
|
# FORGEJO_TOKEN an access token with the `write:package` scope
|
||||||
#
|
#
|
||||||
# `runs-on` must match a label registered by your Forgejo runner
|
# Uses `uv` for Python 3.12 (arm64-friendly); no actions/setup-python needed.
|
||||||
# (commonly `ubuntu-latest` or `docker`).
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -19,7 +18,6 @@ permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.12"
|
|
||||||
# Forgejo's PyPI registry is /api/packages/<owner>/pypi
|
# Forgejo's PyPI registry is /api/packages/<owner>/pypi
|
||||||
REGISTRY_URL: https://git.infrasynth.net/api/packages/moravak/pypi
|
REGISTRY_URL: https://git.infrasynth.net/api/packages/moravak/pypi
|
||||||
|
|
||||||
|
|
@ -30,20 +28,18 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- name: Install uv
|
||||||
with:
|
run: curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
cache: pip
|
|
||||||
|
|
||||||
- name: Install build tooling
|
|
||||||
run: python -m pip install --upgrade pip build twine
|
|
||||||
|
|
||||||
- name: Build sdist + wheel
|
- 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
|
- name: Publish to Forgejo PyPI registry
|
||||||
env:
|
env:
|
||||||
TWINE_USERNAME: ${{ secrets.FORGEJO_USERNAME }}
|
TWINE_USERNAME: ${{ secrets.FORGEJO_USERNAME }}
|
||||||
TWINE_PASSWORD: ${{ secrets.FORGEJO_TOKEN }}
|
TWINE_PASSWORD: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
run: |
|
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] ruff check . sin errores
|
||||||
- [x] mypy infrasynth/ sin errores
|
- [x] mypy infrasynth/ sin errores
|
||||||
- [x] pre-commit hooks configurados
|
- [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] Dockerfile multi-stage + docker-compose con health checks
|
||||||
- [x] Badges (CI, python, django, ruff, mypy) en PLAN.md
|
- [x] Badges (CI, python, django, ruff, mypy) en PLAN.md
|
||||||
- [ ] Docker push (pendiente de registry config)
|
- [ ] Docker push (pendiente de registry config)
|
||||||
|
|
@ -3440,7 +3440,7 @@ volumes:
|
||||||
- **Cache:** Redis (caching + sessions + Celery broker)
|
- **Cache:** Redis (caching + sessions + Celery broker)
|
||||||
- **Monitoring:** Sentry (errors) + Prometheus + Grafana (metrics)
|
- **Monitoring:** Sentry (errors) + Prometheus + Grafana (metrics)
|
||||||
- **Logging:** structlog → JSON stdout → Loki + Grafana
|
- **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