update actions/checkout version #7
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 ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
env: | |
SECRET_KEY: ${{ secrets.DJANGO_TEST_SECRET }} | |
run: | | |
cd backend | |
python manage.py test --settings=rabbit_rescue_REST.settings_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 | |
env: | |
VITE_STRIPE_LINK: ${{ secrets.VITE_STRIPE_LINK }} | |
run: | | |
cd frontend | |
npm run test | |
deploy: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 |