Skip to content

Commit ffab2ec

Browse files
authored
Revert "full rewrite"
1 parent 0f5b731 commit ffab2ec

File tree

109 files changed

+20162
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+20162
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
2+
name: Build and deploy docs
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build job
26+
build:
27+
runs-on: ubuntu-latest
28+
env:
29+
PUBLISH_DIR: ./_build
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v5
35+
- name: Install dependencies
36+
run: |
37+
pip install sphinx sphinx-book-theme
38+
39+
- name: Sphinx build
40+
run: |
41+
sphinx-build docs _build
42+
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: ${{ env.PUBLISH_DIR }}
47+
48+
# Deployment job
49+
deploy:
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
runs-on: ubuntu-latest
54+
needs: build
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

.github/workflows/ci.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: CI - Build and Test Application
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [20.x]
19+
python-version: ['3.10', '3.11']
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: 'npm'
30+
31+
- name: Set up Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Cache Python dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: ~/.cache/pip
40+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
41+
restore-keys: |
42+
${{ runner.os }}-pip-
43+
44+
- name: Install Python dependencies
45+
run: |
46+
python -m pip install --upgrade pip
47+
pip install .[dev]
48+
pip install -r requirements.txt
49+
50+
- name: Install Node.js dependencies
51+
run: npm ci
52+
53+
- name: Lint frontend code
54+
run: npm run lint
55+
continue-on-error: true
56+
57+
- name: Build frontend
58+
run: npm run build
59+
60+
- name: Run Python tests
61+
run: |
62+
python -m pytest test/ -v
63+
64+
- name: Start backend server and health check
65+
run: |
66+
# Start the backend server in the background
67+
python -m src.backend &
68+
BACKEND_PID=$!
69+
70+
# Wait for the server to start
71+
echo "Waiting for backend server to start..."
72+
sleep 10
73+
74+
# Health check - test if the server is responding
75+
max_attempts=30
76+
attempt=1
77+
78+
while [ $attempt -le $max_attempts ]; do
79+
if curl -f http://localhost:8000/health 2>/dev/null; then
80+
echo "Backend server is healthy!"
81+
break
82+
elif curl -f http://localhost:8000/ 2>/dev/null; then
83+
echo "Backend server is responding!"
84+
break
85+
else
86+
echo "Attempt $attempt/$max_attempts: Backend not ready yet..."
87+
sleep 2
88+
attempt=$((attempt + 1))
89+
fi
90+
done
91+
92+
if [ $attempt -gt $max_attempts ]; then
93+
echo "Backend server failed to start properly"
94+
kill $BACKEND_PID 2>/dev/null || true
95+
exit 1
96+
fi
97+
98+
# Test basic API endpoints if they exist
99+
echo "Testing backend endpoints..."
100+
101+
# Clean up
102+
kill $BACKEND_PID 2>/dev/null || true
103+
echo "Backend server test completed successfully!"
104+
105+
- name: Test frontend build serves correctly
106+
run: |
107+
# Start the preview server in the background
108+
npm run preview &
109+
FRONTEND_PID=$!
110+
111+
# Wait for the server to start
112+
echo "Waiting for frontend server to start..."
113+
sleep 5
114+
115+
# Health check for frontend
116+
max_attempts=15
117+
attempt=1
118+
119+
while [ $attempt -le $max_attempts ]; do
120+
if curl -f http://localhost:4173/ 2>/dev/null; then
121+
echo "Frontend server is serving correctly!"
122+
break
123+
else
124+
echo "Attempt $attempt/$max_attempts: Frontend not ready yet..."
125+
sleep 2
126+
attempt=$((attempt + 1))
127+
fi
128+
done
129+
130+
if [ $attempt -gt $max_attempts ]; then
131+
echo "Frontend server failed to start properly"
132+
kill $FRONTEND_PID 2>/dev/null || true
133+
exit 1
134+
fi
135+
136+
# Clean up
137+
kill $FRONTEND_PID 2>/dev/null || true
138+
echo "Frontend server test completed successfully!"
139+
140+
integration-test:
141+
runs-on: ubuntu-latest
142+
needs: test
143+
144+
steps:
145+
- name: Checkout code
146+
uses: actions/checkout@v4
147+
148+
- name: Set up Node.js
149+
uses: actions/setup-node@v4
150+
with:
151+
node-version: '20.x'
152+
cache: 'npm'
153+
154+
- name: Set up Python
155+
uses: actions/setup-python@v4
156+
with:
157+
python-version: '3.11'
158+
159+
- name: Install dependencies
160+
run: |
161+
python -m pip install --upgrade pip
162+
pip install .[dev]
163+
pip install -r requirements.txt
164+
npm ci
165+
166+
- name: Build frontend
167+
run: npm run build
168+
169+
- name: Test full application stack
170+
run: |
171+
# Start both frontend and backend
172+
echo "Starting full application stack..."
173+
174+
# Start backend
175+
python -m src.backend &
176+
BACKEND_PID=$!
177+
178+
# Start frontend preview
179+
npm run preview &
180+
FRONTEND_PID=$!
181+
182+
# Wait for both services
183+
sleep 15
184+
185+
# Test both services are running
186+
echo "Testing backend..."
187+
if ! curl -f http://localhost:8000/ 2>/dev/null; then
188+
echo "Backend failed to start"
189+
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true
190+
exit 1
191+
fi
192+
193+
echo "Testing frontend..."
194+
if ! curl -f http://localhost:4173/ 2>/dev/null; then
195+
echo "Frontend failed to start"
196+
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true
197+
exit 1
198+
fi
199+
200+
echo "Both services are running successfully!"
201+
202+
# Clean up
203+
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true
204+
205+
echo "Integration test completed successfully!"

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
*.pyc
26+
venv/
27+
build
28+
docs/_build
29+
30+
# python
31+
__pycache__
32+
*.py[cod]
33+
*.pyo
34+
*.pyd
35+
.Python
36+
*.egg
37+
*.egg-info
38+
*_version.py

0 commit comments

Comments
 (0)