-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add GitHub Actions workflow for CI/CD
- Loading branch information
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
build-backend: | ||
name: Build and Test Backend | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mongo: | ||
image: mongo:latest | ||
ports: | ||
- 27017:27017 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
working-directory: ./backend | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run tests | ||
working-directory: ./backend | ||
run: | | ||
# Add your test command here | ||
pytest | ||
build-frontend: | ||
name: Build Frontend | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Install dependencies | ||
working-directory: ./frontend | ||
run: npm install | ||
|
||
- name: Build project | ||
working-directory: ./frontend | ||
run: npm run build | ||
|
||
deploy-frontend: | ||
name: Deploy Frontend to GitHub Pages | ||
runs-on: ubuntu-latest | ||
needs: build-frontend | ||
if: github.ref == 'refs/heads/main' | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: develop | ||
folder: frontend/dist |