Files
calminer/.gitea/workflows/test.yml
zwitschi 723f6a62b8
Some checks failed
Run Tests / e2e tests (push) Successful in 1m33s
Run Tests / lint tests (push) Failing after 2s
Run Tests / unit tests (push) Failing after 2s
feat: Enhance CI workflows with health checks and update PostgreSQL image version
2025-10-27 21:12:46 +01:00

80 lines
2.3 KiB
YAML

name: Run Tests
on: [push]
jobs:
tests:
name: ${{ matrix.target }} tests
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright/python:v1.55.0-jammy
env:
DATABASE_DRIVER: postgresql
DATABASE_HOST: postgres
DATABASE_PORT: '5432'
DATABASE_NAME: calminer_ci
DATABASE_USER: calminer
DATABASE_PASSWORD: secret
DATABASE_SCHEMA: public
DATABASE_SUPERUSER: calminer
DATABASE_SUPERUSER_PASSWORD: secret
DATABASE_SUPERUSER_DB: calminer_ci
DATABASE_URL: postgresql+psycopg2://calminer:secret@postgres:5432/calminer_ci
strategy:
fail-fast: false
matrix:
target: [unit, e2e, lint]
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: calminer_ci
POSTGRES_USER: calminer
POSTGRES_PASSWORD: secret
options: >-
--health-cmd "pg_isready -U calminer -d calminer_ci"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Install Node.js runtime
if: ${{ matrix.target == 'e2e' }}
shell: bash
run: |
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
- name: Checkout code
uses: actions/checkout@v4
- name: Export PYTHONPATH
shell: bash
run: |
set -euo pipefail
echo "PYTHONPATH=/workspace/allucanget/calminer" >> "$GITHUB_ENV"
# - name: Cache pip dependencies
# uses: actions/cache@v4
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements-test.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
- name: Prepare Python environment
uses: ./.gitea/actions/setup-python-env
with:
install-playwright: ${{ matrix.target == 'e2e' }}
use-system-python: 'true'
run-db-setup: ${{ matrix.target != 'lint' }}
- name: Run tests
run: |
if [ "${{ matrix.target }}" = "unit" ]; then
pytest tests/unit
elif [ "${{ matrix.target }}" = "lint" ]; then
ruff check .
else
pytest tests/e2e
fi