Skip to content

Commit 7c0c198

Browse files
committed
chore(ci): add CI workflow and update .gitignore
1 parent 963a01c commit 7c0c198

File tree

2 files changed

+178
-119
lines changed

2 files changed

+178
-119
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# CI integration workflow: builds services with docker compose and checks basic health endpoints.
2+
# Runs on push and pull_request for main and feature branches.
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
- "feature/**"
9+
- "feat/**"
10+
pull_request:
11+
branches:
12+
- main
13+
- master
14+
15+
jobs:
16+
integration:
17+
name: Integration tests (docker-compose)
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 40
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Ensure docker-compose is available
28+
run: |
29+
docker version
30+
docker compose version
31+
32+
- name: Start docker-compose services
33+
run: |
34+
docker compose up --build -d
35+
env:
36+
COMPOSE_DOCKER_CLI_BUILD: 1
37+
38+
- name: Wait for sentiment endpoint (http://localhost:8080/analyze/hello%20world)
39+
run: |
40+
set -e
41+
url="http://localhost:8080/analyze/hello%20world"
42+
echo "Waiting for $url"
43+
n=0
44+
max=30
45+
until curl --silent --fail --show-error -o /tmp/sentiment_resp.txt "$url"; do
46+
n=$((n+1))
47+
echo "Sentiment not ready, retry $n/$max..."
48+
if [ $n -ge $max ]; then
49+
echo "Sentiment endpoint failed to respond after $max attempts"
50+
exit 1
51+
fi
52+
sleep 5
53+
done
54+
echo "Sentiment OK:"
55+
cat /tmp/sentiment_resp.txt
56+
57+
- name: Wait for Django proxy endpoint (http://localhost:8000/api/dealers/)
58+
run: |
59+
set -e
60+
url="http://localhost:8000/api/dealers/"
61+
echo "Waiting for $url"
62+
n=0
63+
max=30
64+
until curl --silent --fail --show-error -o /tmp/django_resp.txt "$url"; do
65+
n=$((n+1))
66+
echo "Django proxy not ready, retry $n/$max..."
67+
if [ $n -ge $max ]; then
68+
echo "Django proxy failed to respond after $max attempts"
69+
exit 1
70+
fi
71+
sleep 5
72+
done
73+
echo "Django proxy OK:"
74+
head -n 200 /tmp/django_resp.txt || true
75+
76+
- name: Run Django tests inside container (if available)
77+
run: |
78+
set -e
79+
echo "Attempting to run Django tests inside django container"
80+
docker compose exec -T django sh -c "if [ -f manage.py ]; then python manage.py test --verbosity=2 || true; else echo 'No manage.py found in container'; fi"
81+
82+
- name: Run Node (Express) tests inside container (if available)
83+
run: |
84+
set -e
85+
echo "Attempting to run Node tests inside express-service container"
86+
docker compose exec -T express-service sh -c "if [ -f package.json ] && grep -q '\"test\"' package.json; then npm test || true; else echo 'No tests defined or package.json missing'; fi"
87+
88+
- name: Run lightweight smoke checks
89+
run: |
90+
echo "Smoke checks passed; services reachable."
91+
92+
- name: Tear down docker compose (success)
93+
if: success()
94+
run: |
95+
docker compose logs --no-color > compose-success-logs.txt || true
96+
docker compose down -v || true
97+
98+
- name: Collect docker-compose logs (always)
99+
if: always()
100+
run: |
101+
set +e
102+
docker compose logs --no-color > compose-logs.txt || true
103+
echo "Logs collected to compose-logs.txt"
104+
105+
- name: Upload compose logs (always)
106+
if: always()
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: compose-logs
110+
path: compose-logs.txt
111+
112+
- name: Upload compose logs on failure
113+
if: failure()
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: compose-failure-logs
117+
path: compose-logs.txt

.gitignore

Lines changed: 61 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,71 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
1+
# Node / JS
2+
node_modules/
3+
**/node_modules/
84

9-
# Distribution / packaging
10-
.Python
5+
# Frontend build artifacts
116
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
pip-wheel-metadata/
24-
share/python-wheels/
25-
*.egg-info/
26-
.installed.cfg
27-
*.egg
28-
MANIFEST
29-
30-
# PyInstaller
31-
# Usually these files are written by a python script from a template
32-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33-
*.manifest
34-
*.spec
35-
36-
# Installer logs
37-
pip-log.txt
38-
pip-delete-this-directory.txt
39-
40-
# Unit test / coverage reports
41-
htmlcov/
42-
.tox/
43-
.nox/
44-
.coverage
45-
.coverage.*
46-
.cache
47-
nosetests.xml
48-
coverage.xml
49-
*.cover
50-
*.py,cover
51-
.hypothesis/
52-
.pytest_cache/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
target/
76-
77-
# Jupyter Notebook
78-
.ipynb_checkpoints
7+
**/build/
8+
frontend/build/
799

80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
10+
# Distribution / packages
11+
dist/
12+
*.tgz
10313

104-
# Environments
105-
.env
106-
.venv
14+
# Python / Django
15+
*.pyc
16+
__pycache__/
17+
*.pyo
18+
*.pyd
10719
env/
20+
.venv/
10821
venv/
109-
ENV/
11022
env.bak/
111-
venv.bak/
112-
113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
23+
ENV/
24+
*.sqlite3
25+
db.sqlite3
26+
*.db
11927

120-
# mkdocs documentation
121-
/site
28+
# Environment files
29+
.env
30+
.env.*
31+
*.env
32+
33+
# Docker
34+
docker-compose.override.yml
35+
**/docker-compose.override.yml
36+
.docker/
37+
**/.docker/
38+
docker-compose.*.yml
39+
docker-compose.local.yml
40+
41+
# Logs
42+
*.log
43+
logs/
44+
**/logs/
45+
46+
# IDEs and editors
47+
.vscode/
48+
.idea/
49+
*.sublime-project
50+
*.sublime-workspace
51+
52+
# OS
53+
.DS_Store
54+
Thumbs.db
55+
56+
# Temporary / cache
57+
npm-debug.log*
58+
yarn-debug.log*
59+
yarn-error.log*
60+
.pip-wheel-metadata/
61+
pip-log.txt
12262

123-
# mypy
124-
.mypy_cache/
125-
.dmypy.json
126-
dmypy.json
63+
# Misc
64+
coverage/
65+
coverage.*
66+
.cache/
67+
*.bak
68+
*.swp
12769

128-
# Pyre type checker
129-
.pyre/
70+
# Optional: local Docker images and artifacts
71+
*.tar

0 commit comments

Comments
 (0)