File tree Expand file tree Collapse file tree 2 files changed +26
-13
lines changed
Expand file tree Collapse file tree 2 files changed +26
-13
lines changed Original file line number Diff line number Diff line change 88
99jobs :
1010 build :
11-
1211 runs-on : ubuntu-latest
12+
13+ services :
14+ postgres :
15+ image : postgres:13
16+ env :
17+ POSTGRES_USER : postgres
18+ POSTGRES_PASSWORD : postgres
19+ POSTGRES_DB : github_actions
20+ ports :
21+ - 5432:5432
22+ options : >-
23+ --health-cmd pg_isready
24+ --health-interval 10s
25+ --health-timeout 5s
26+ --health-retries 5
27+
1328 strategy :
1429 max-parallel : 4
1530 matrix :
1631 python-version : [3.9, "3.10", "3.11"]
1732
1833 steps :
1934 - uses : actions/checkout@v4
35+
2036 - name : Set up Python ${{ matrix.python-version }}
2137 uses : actions/setup-python@v3
2238 with :
2339 python-version : ${{ matrix.python-version }}
40+
2441 - name : Install Dependencies
2542 run : |
2643 python -m pip install --upgrade pip
2744 cd backend
2845 pip install -r requirements.txt
46+
2947 - name : Run Tests
48+ env :
49+ DB_URL : postgres://postgres:postgres@localhost:5432/github_actions
50+ DJANGO_SETTINGS_MODULE : backend.settings
3051 run : |
3152 cd backend
3253 python manage.py test
Original file line number Diff line number Diff line change 9797# Database
9898# https://docs.djangoproject.com/en/5.2/ref/settings/#databases
9999
100- # DATABASES = {
101- # 'default': {
102- # 'ENGINE': 'django.db.backends.postgresql',
103- # 'NAME': os.getenv("DB_NAME"),
104- # "USER": os.getenv("DB_USER"),
105- # "PASSWORD": os.getenv("DB_PWD"),
106- # "HOST": os.getenv("DB_HOST"),
107- # "PORT": os.getenv("DB_PORT")
108- # }
109- # }
110-
111100# local db - uncomment when running locally
112101# DATABASES = {
113102# "default": {
119108# prod - db -- uncomment when pushing code
120109DATABASES = {
121110 'default' : dj_database_url .config (
122- default = os .environ .get ("DB_URL" ),
111+ default = os .environ .get ("DB_URL" ),
123112 conn_max_age = 600
124113 )
125114}
126115
116+ # The GitHub Actions workflow will use the same DB_URL environment variable
117+ # which will be set to: postgres://postgres:postgres@localhost:5432/github_actions
118+
127119# Password validation
128120# https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators
129121
You can’t perform that action at this time.
0 commit comments