Skip to content

Commit

Permalink
Pipeline updated
Browse files Browse the repository at this point in the history
  • Loading branch information
unizhu committed Aug 11, 2024
1 parent fe12047 commit 4937f7c
Showing 1 changed file with 50 additions and 49 deletions.
99 changes: 50 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,68 @@
name: CI
name: CI/CD Pipeline

on:
push:
branches: [main]
branches:
- main
pull_request:
branches: [main]
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
strategy:
matrix:
node-version: ['20']
python-version: ['3.12']

# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Change to frontend directory
run: cd frontend

- name: Install Node.js dependencies
run: npm install
# Node.js steps
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10' # Adjust the version according to your needs
- name: Install Node.js dependencies
working-directory: frontend
run: npm install

- name: Install Python dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
- name: Build frontend
working-directory: frontend
run: npm run build

- name: Lint Python
run: |
source venv/bin/activate
flake8 .
# Python steps
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Run backend service
- name: Start Backend Service
run: |
source venv/bin/activate
python app.py &
env:
FLASK_ENV: testing
- name: Install Python dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
# Run tests
- name: Run tests
run: npm test
- name: Lint Python
run: |
source venv/bin/activate
flake8 .
# Build project
- name: Build project
run: npm run build
- name: Run Python tests
run: |
source venv/bin/activate
pytest
# Upload production build
- name: Upload production build
uses: actions/upload-artifact@v3
with:
name: build
path: |
frontend/build
# 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 &

0 comments on commit 4937f7c

Please sign in to comment.