Fix bugs. #180
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
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: [master] | |
push: | |
branches: [master] | |
jobs: | |
health-checkup-job: #Check the healthy by running tests | |
runs-on: ubuntu-latest | |
services: | |
postgres_main: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: boostan | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python 3.10.6 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.10.6 | |
- name: Install requirements | |
env: | |
DJANGO_SECRET_KEY: "secretsecretsecretsecret123456" | |
DJANGO_SETTINGS_MODULE: "config.settings.production" | |
DJANGO_ALLOWED_HOSTS: "*" | |
DJANGO_ADMIN_URL: "admin/" | |
DATABASE_URL: "postgres://postgres:[email protected]:5432/$POSTGRES_DB" | |
BOOSTAN_USERNAME: ${{secrets.BOOSTAN_USERNAME}} | |
BOOSTAN_PASSWORD: ${{secrets.BOOSTAN_PASSWORD}} | |
run: | | |
pip install -r requirements.txt && pip install -r requirements/local.txt | |
- name: Collect statics | |
run: | | |
python manage.py collectstatic --noinput | |
- name: Make migrations | |
run: | | |
python manage.py makemigrations | |
- name: Migrate | |
run: | | |
python manage.py migrate | |
- name: Run Tests | |
run: | | |
python manage.py test api | |
#Before deploy job you would usually have the build job in case you are using docker images | |
deploy-job: | |
runs-on: ubuntu-latest | |
needs: [health-checkup-job] | |
steps: | |
- name: Init heroku | |
uses: actions/checkout@v3 | |
- name: Deploying to heroku | |
uses: akhileshns/[email protected] | |
with: | |
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | |
heroku_app_name: ${{secrets.HEROKU_APP_NAME}} | |
heroku_email: ${{secrets.HEROKU_EMAIL}} |