update README #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ['20'] | |
python-version: ['3.12'] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Node.js steps | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install Node.js dependencies | |
working-directory: frontend | |
run: npm install | |
- name: Build frontend | |
working-directory: frontend | |
run: npm run build | |
# Python steps | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Python dependencies | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
pip install -r requirements.txt | |
pip install -r dev-requirements.txt | |
# - name: Lint Python | |
# run: | | |
# source venv/bin/activate | |
# flake8 . | |
- name: Run Python tests | |
run: | | |
source venv/bin/activate | |
pytest test_app.py | |
# Deploy | |
- name: Deploy backend and frontend | |
run: | | |
# Ensure backend is running on port 8082 | |
nohup python app.py & | |
# Frontend files are already built in the 'frontend/build' directory | |
# You can serve them using a tool like 'serve' or move them to a web server | |
npm install -g serve | |
serve -s frontend/build -l 3000 & |