Skip to content

fixed env

fixed env #11

Workflow file for this run

name: Django tests
on:
push:
branches: ['dev']
pull_request:
branches: ['master']
jobs:
container-job:
runs-on: ubuntu-latest
container: python:3.12-bookworm
services:
postgres:
image: postgres:16.3-alpine3.20
env:
POSTGRES_PASSWORD: hiren
POSTGRES_USER: hiren
POSTGRES_DB: diary
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install dependencies
run: pip install -r requirements.txt
- name: Set environment variables
run: |
echo "SECRET_KEY=xyz1234567890qwerty" >> $GITHUB_ENV
echo "DEBUG=False" >> $GITHUB_ENV
echo "ALLOWED_HOSTS=[localhost,127.0.0.1]" >> $GITHUB_ENV
echo "TIMEZONE=Asia/Dhaka" >> $GITHUB_ENV
echo "DB_NAME=diary" >> $GITHUB_ENV
echo "DB_PASSWORD=hiren" >> $GITHUB_ENV
echo "DB_USER=hiren" >> $GITHUB_ENV
echo "DB_HOST=postgres" >> $GITHUB_ENV
- name: Test with pytest
run: pytest -vv
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
DEBUG: ${{ env.DEBUG }}
ALLOWED_HOSTS: ${{ env.ALLOWED_HOSTS }}
TIMEZONE: ${{ env.TIMEZONE }}
DB_NAME: ${{ env.DB_NAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_USER: ${{ secrets.DB_USER }}
DB_HOST: ${{ env.DB_HOST }}