mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 23:31:31 +02:00
build.yml pushes yogeshojha/rengine-api and rengine-worker from the development target on every master push and every release. That target deliberately does not carry stages/, reports/, interest/, mcp/, channels/, connectors/ or toolbox/ — compose mounts them from the host — so the published api image holds app/ nothing and `import app.main` answers ModuleNotFoundError. Both Dockerfiles said a prod stage must copy them; neither had one. Both now do, and the two build workflows target it. Verified by building each and importing inside: the api loads app.main with production settings, the worker loads its celery app and all 27 stages. The ruff package list in the test workflow is written once. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DafWxfoWZXVDgr9KroJBDZ
117 lines
2.8 KiB
YAML
117 lines
2.8 KiB
YAML
name: 🧪 Tests
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- release/*
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
- release/*
|
|
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
name: 🧹 Lint
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
PACKAGES: api shared reports worker stages tools toolbox interest mcp channels connectors tests
|
|
RUFF: ruff@0.14.14
|
|
steps:
|
|
- name: 📥 Checkout the git repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🐍 Install uv
|
|
uses: astral-sh/setup-uv@v5
|
|
|
|
- name: 🧹 ruff check
|
|
run: uvx $RUFF check $PACKAGES
|
|
|
|
- name: 🎨 ruff format
|
|
run: uvx $RUFF format --check $PACKAGES
|
|
|
|
frontend:
|
|
name: 🎨 Frontend checks
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: frontend
|
|
steps:
|
|
- name: 📥 Checkout the git repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🟢 Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: 📦 Install
|
|
run: npm ci
|
|
|
|
- name: 🧹 Lint
|
|
run: npm run lint
|
|
|
|
- name: 🔎 Type check
|
|
run: npm run check
|
|
|
|
- name: 🧪 Unit tests
|
|
run: npm run test
|
|
|
|
pytest:
|
|
name: 🐍 Python tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: 📥 Checkout the git repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 🔑 Write a throwaway environment
|
|
run: |
|
|
cat > .env <<'ENV'
|
|
DEBUG=true
|
|
POSTGRES_USER=rengine
|
|
POSTGRES_PASSWORD=rengine
|
|
POSTGRES_DB=rengine
|
|
POSTGRES_HOST=db
|
|
POSTGRES_PORT=5432
|
|
POSTGRES_SHARED_BUFFERS=256MB
|
|
POSTGRES_EFFECTIVE_CACHE_SIZE=1GB
|
|
POSTGRES_WORK_MEM=16MB
|
|
POSTGRES_MAINTENANCE_WORK_MEM=128MB
|
|
REDIS_HOST=redis
|
|
REDIS_PORT=6379
|
|
SECRET_KEY=ci-only-not-a-secret-0000000000000000
|
|
ADMIN_EMAIL=admin@rengine.local
|
|
ADMIN_USERNAME=rengine
|
|
ADMIN_PASSWORD=ci-only-not-a-secret
|
|
ENV
|
|
|
|
- name: 🏗️ Build the api image
|
|
run: docker compose build api
|
|
|
|
- name: 🐘 Start postgres and redis
|
|
run: |
|
|
docker compose up -d db redis
|
|
for _ in $(seq 1 60); do
|
|
docker compose exec -T db pg_isready -U rengine && break
|
|
sleep 2
|
|
done
|
|
|
|
- name: 🧪 pytest
|
|
run: >
|
|
docker compose run --rm --no-deps api
|
|
sh -lc 'cd /app && /app/.venv/bin/python -m pytest tests -q --tb=short'
|
|
|
|
- name: 📜 Service logs on failure
|
|
if: failure()
|
|
run: docker compose logs --tail 200 db api
|
|
|
|
- name: 🧹 Tear down
|
|
if: always()
|
|
run: docker compose down -v
|