Files
pokedexter/.gitea/workflows/ci.yml
T
glennigen 07a6781c5e
CI/CD / test (push) Failing after 3m12s
CI/CD / build (push) Has been skipped
CI/CD: Gitea Actions workflow med tests
2026-07-11 02:10:27 +02:00

73 lines
1.9 KiB
YAML

name: CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: pokedexter
POSTGRES_USER: pokedexter
POSTGRES_PASSWORD: pokedexter_secret
options: >-
--health-cmd "pg_isready -U pokedexter"
--health-interval 5s
--health-timeout 3s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r backend/requirements.txt
- name: Run tests
env:
DATABASE_URL: "postgresql+asyncpg://pokedexter:pokedexter_secret@postgres/pokedexter"
run: |
cd backend
pytest -v --cov=app --cov-report=term --cov-report=xml
- name: Upload coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage
path: backend/coverage.xml
build:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build backend image
run: |
docker build -t pokedexter-backend:${{ github.sha }} -t pokedexter-backend:latest -f Dockerfile_backend .
- name: Build nginx image
run: |
docker build -t pokedexter-nginx:${{ github.sha }} -t pokedexter-nginx:latest -f Dockerfile_nginx .
- name: Log build info
run: |
echo "Backend image: pokedexter-backend:${{ github.sha }}"
echo "Nginx image: pokedexter-nginx:${{ github.sha }}"