-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (81 loc) · 2.5 KB
/
tests.yml
File metadata and controls
101 lines (81 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Tests
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync --extra dev
- name: Run all tests with coverage
run: uv run pytest -v --cov=app --cov-report=xml --cov-report=term
docker-integration:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Create test environment file
run: |
cat > .env.ci <<EOF
OPENROUTER_API_KEY=test-key
OPENROUTER_APP_TITLE=TaskCraft_CI
OPENROUTER_APP_REFERER=TaskCraft_CI
OPENROUTER_MODEL=anthropic/claude-3.5-haiku
POSTGRES_USER=test
POSTGRES_PASSWORD=test
POSTGRES_DB=myapp_test
POSTGRES_HOST=db
POSTGRES_PORT=5432
DEBUG=true
LOG_LEVEL=DEBUG
EOF
- name: Build and start services
run: docker compose -f docker-compose.dev.yml --env-file .env.ci up -d --build
- name: Wait for services to be ready
run: |
echo "Waiting for services to start..."
timeout 60 bash -c 'until curl -f http://localhost:8000/api/health > /dev/null 2>&1; do sleep 2; done'
echo "Services are ready!"
- name: Sanity check API endpoints
run: |
echo "Testing health endpoint..."
curl -f http://localhost:8000/api/health
- name: Show logs on failure
if: failure()
run: docker compose -f docker-compose.dev.yml --env-file .env.ci logs
- name: Tear down services
if: always()
run: docker compose -f docker-compose.dev.yml --env-file .env.ci down -v
frontend-build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: frontend
- name: Build frontend
run: npm run build
working-directory: frontend