Skip to content

Para que funcione en local, luego cambio manualmente el container #113

Para que funcione en local, luego cambio manualmente el container

Para que funcione en local, luego cambio manualmente el container #113

Workflow file for this run

name: General CI
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
jobs:
setup-and-cache:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./server
env:
UV_CACHE_DIR: /tmp/.uv-cache
outputs:
cache-key: ${{ steps.get-cache-key.outputs.key }}
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.3.2/install.sh | sh
- name: Set up python
uses: actions/setup-python@v5
with:
python-version-file: "./server/pyproject.toml"
- id: get-cache-key
run: echo "key=uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}" >> $GITHUB_OUTPUT
- name: Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: ${{ steps.get-cache-key.outputs.key }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install dependencies
run: uv sync --all-extras --dev
format:
needs: setup-and-cache
runs-on: ubuntu-latest
strategy:
fail-fast: false
defaults:
run:
working-directory: ./server
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.3.2/install.sh | sh
- name: Restore Cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: ${{ needs.setup-and-cache.outputs.cache-key }}
- name: Run formatter
run: uv run ruff format
test:
needs: setup-and-cache
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17-bookworm
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: tpi
ports:
- 5432:5432
strategy:
fail-fast: false
defaults:
run:
working-directory: ./server
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.3.2/install.sh | sh
- name: Restore Cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: ${{ needs.setup-and-cache.outputs.cache-key }}
- name: Run tests
run: cd ./src && DJANGO_ENV="testing" uv run ./manage.py test ./ --verbosity=3
lint:
needs: setup-and-cache
runs-on: ubuntu-latest
strategy:
fail-fast: false
defaults:
run:
working-directory: ./server
env:
UV_CACHE_DIR: /tmp/.uv-cache
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/0.3.2/install.sh | sh
- name: Restore Cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: ${{ needs.setup-and-cache.outputs.cache-key }}
- name: Run linter
run: uv run ruff check