Skip to content

Commit

Permalink
add CI/CD Github Actions Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
szilvia-csernus committed Apr 9, 2024
1 parent 60ce946 commit dbd9804
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI/CD Pipeline

on:
push:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install backend dependencies
run: |
cd backend
pip install -r requirements.txt
- name: Run backend tests
run: |
cd backend
python manage.py test
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install frontend dependencies
run: |
cd frontend
npm install
- name: Run frontend tests
run: |
cd frontend
npm run test
deploy:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Deploy to Heroku (backend)
uses: akhileshns/heroku-deploy@v3.13.15 # This action deploys to Heroku
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_BACKEND_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}
appdir: "backend"
dontautocreate: true

- name: Deploy to Heroku (frontend)
uses: akhileshns/heroku-deploy@v3.13.15 # This action deploys to Heroku
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_FRONTEND_NAME}}
heroku_email: ${{secrets.HEROKU_EMAIL}}
appdir: "frontend"
dontautocreate: true

0 comments on commit dbd9804

Please sign in to comment.