Skip to content

4 - Test Django with Actions Secret Database URL #1

4 - Test Django with Actions Secret Database URL

4 - Test Django with Actions Secret Database URL #1

name: 4 - Test Django with Actions Secret Database URL
on:
workflow_dispatch:
push:
branch:
- main
jobs:
test:
runs-on: ubuntu-latest
env:
DJANGO_DEBUG: 0
DATABASE_URL: ${{ secrets.NEON_DATABASE_URL }}
# DJANGO_SECRET_KEY: not-good
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Setup Django Secret Key
run: |
MY_GEN_KEY=$(openssl rand -base64 32)
echo "DJANGO_SECRET_KEY=$MY_GEN_KEY" >> $GITHUB_ENV
- name: Show DATABASE_URL
run: |
echo ${{ env.DATABASE_URL }}
echo $DATABASE_URL
- name: Install Requirements
run: |
python -m pip install pip --upgrade
python -m pip install -r requirements.txt
- name: Django Tests
working-directory: ./src
run: |
python manage.py test