Update utils.py #4
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: Deploy to Render | |
on: | |
push: | |
branches: | |
- master | |
- test | |
pull_request: | |
branches: | |
- master | |
- test | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | |
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | |
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd "pg_isready -U postgres" | |
--health-interval 10s | |
--health-tiemout 5s | |
--health-retries 5 | |
steps: | |
- name: Clear GitHub Actions cache | |
run: rm -rf /home/runner/work/_actions | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set up database environment variables | |
run: | | |
echo "DATABASE_URL=postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.PGHOST }}:5432/${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV | |
- name: Run migrations | |
env: | |
DATABASE_URL: ${{ env.DATABASE_URL }} | |
run: python manage.py migrate | |
- name: Run tests | |
env: | |
DATABASE_URL: ${{ env.DATABASE_URL }} | |
run: python manage.py test | |
- name: Deploy to Render | |
run: | | |
curl -X POST '${{ secrets.RENDER_DEPLOY_URL }}' | |
- name: Test deployment | |
run: | | |
curl -I https://glace-api-vhkd.onrender.com |