Skip to content

Commit bc9d980

Browse files
Fix workflows: conditional deploy, DB init in tests, Node 24 compat
1 parent 477e3c3 commit bc9d980

4 files changed

Lines changed: 31 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- "docker-compose.yml"
1010
- ".github/workflows/deploy.yml"
1111

12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
14+
1215
jobs:
1316
deploy:
1417
runs-on: ubuntu-latest
@@ -20,12 +23,14 @@ jobs:
2023
uses: docker/setup-buildx-action@v3
2124

2225
- name: Login to DockerHub
26+
if: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
2327
uses: docker/login-action@v3
2428
with:
2529
username: ${{ secrets.DOCKER_USERNAME }}
2630
password: ${{ secrets.DOCKER_PASSWORD }}
2731

2832
- name: Build and push backend
33+
if: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
2934
uses: docker/build-push-action@v5
3035
with:
3136
context: ./backend
@@ -37,6 +42,7 @@ jobs:
3742
cache-to: type=gha,mode=max
3843

3944
- name: Build and push frontend
45+
if: ${{ secrets.DOCKER_USERNAME != '' && secrets.DOCKER_PASSWORD != '' }}
4046
uses: docker/build-push-action@v5
4147
with:
4248
context: ./frontend
@@ -48,6 +54,7 @@ jobs:
4854
cache-to: type=gha,mode=max
4955

5056
- name: Deploy to server
57+
if: ${{ secrets.DEPLOY_HOST != '' && secrets.DEPLOY_USER != '' && secrets.DEPLOY_KEY != '' }}
5158
uses: appleboy/ssh-action@v1.0.0
5259
with:
5360
host: ${{ secrets.DEPLOY_HOST }}

.github/workflows/etl-pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
- aggregate
1717
- cleanup
1818

19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
21+
1922
jobs:
2023
etl:
2124
runs-on: ubuntu-latest

.github/workflows/python-tests.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
paths:
1212
- "backend/**"
1313

14+
env:
15+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
16+
1417
jobs:
1518
test:
1619
runs-on: ubuntu-latest
@@ -56,6 +59,15 @@ jobs:
5659
pip install -r requirements.txt
5760
pip install pytest pytest-cov
5861
62+
- name: Initialize database tables
63+
working-directory: ./backend
64+
env:
65+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/bi_platform
66+
REDIS_HOST: localhost
67+
REDIS_PORT: 6379
68+
run: |
69+
python -c "from app.database import init_db; init_db(); print('Database tables created successfully')"
70+
5971
- name: Run tests
6072
working-directory: ./backend
6173
env:
@@ -66,6 +78,7 @@ jobs:
6678
pytest tests/ -v --cov=app --cov-report=xml --cov-report=term
6779
6880
- name: Upload coverage
81+
if: always()
6982
uses: codecov/codecov-action@v3
7083
with:
7184
file: ./backend/coverage.xml

backend/tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import sys
2+
import os
3+
4+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
5+
6+
from app.database import init_db
7+
8+
init_db()

0 commit comments

Comments
 (0)