Skip to content

Pre dev

Pre dev #7

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install Pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv
- name: Install dependencies
run: |
pipenv install --dev
- name: Set up Database
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_HOST: ${{ secrets.DB_HOST }}
DB_PORT: ${{ secrets.DB_PORT }}
DB_NAME: ${{ secrets.DB_NAME }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
SMS_USERNAME: ${{ secrets.SMS_USERNAME }}
SMS_API_KEY: ${{ secrets.SMS_API_KEY }}
DATABASE_URL: postgresql://${{ secrets.DB_USER }}:${{ secrets.DB_PASSWORD }}@${{ secrets.DB_HOST }}:${{ secrets.DB_PORT }}/{{ secrets.DB_NAME }}
run: |
pipenv run python manage.py migrate
pipenv run python manage.py collectstatic --noinput
- name: Run Tests
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/test_db
run: |
# Activate the pipenv environment
pipenv run python manage.py test --verbosity=2
- name: Upload Coverage Report
if: success()
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: htmlcov/
deploy:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Deploy to your environment
# This is a placeholder. Configure your deployment steps here.
run: echo "Deploying application..."