Skip to content

Commit 4cbda5f

Browse files
committed
test ci 29 проверка деплоя
1 parent 6535a31 commit 4cbda5f

1 file changed

Lines changed: 61 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,36 +115,75 @@ name: Django CI/CD Pipeline
115115
on: [push, pull_request]
116116

117117
jobs:
118-
test:
118+
lint:
119119
runs-on: ubuntu-latest
120120

121121
steps:
122-
- name: Check out code
123-
uses: actions/checkout@v3
122+
- name: Check out code
123+
uses: actions/checkout@v3
124124

125-
- name: Set up Python
126-
uses: actions/setup-python@v4
127-
with:
128-
python-version: '3.10'
125+
- name: Set up Python
126+
uses: actions/setup-python@v4
127+
with:
128+
python-version: '3.10'
129129

130-
- name: Cache pip
131-
uses: actions/cache@v3
132-
with:
133-
path: ~/.cache/pip
134-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
135-
restore-keys: |
136-
${{ runner.os }}-pip-
130+
- name: Install flake8
131+
run: |
132+
python -m pip install --upgrade pip
133+
pip install flake8
137134
138-
- name: Install dependencies
139-
run: |
140-
python -m pip install --upgrade pip
141-
pip install -r requirements.txt
135+
- name: Run Flake8
136+
run: flake8 .
137+
138+
test:
139+
runs-on: ubuntu-latest
140+
needs: lint
141+
142+
services:
143+
postgres:
144+
image: postgres:16
145+
env:
146+
POSTGRES_DB: testdb
147+
POSTGRES_USER: postgres
148+
POSTGRES_PASSWORD: postgres
149+
options: >-
150+
--health-cmd pg_isready
151+
--health-interval 10s
152+
--health-timeout 5s
153+
--health-retries 5
154+
ports:
155+
- 5432:5432
156+
157+
steps:
158+
- name: Check out code
159+
uses: actions/checkout@v3
160+
161+
- name: Set up Python
162+
uses: actions/setup-python@v4
163+
with:
164+
python-version: '3.10'
165+
166+
- name: Cache pip
167+
uses: actions/cache@v3
168+
with:
169+
path: ~/.cache/pip
170+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
171+
restore-keys: ${{ runner.os }}-pip-
172+
173+
- name: Install dependencies
174+
run: |
175+
python -m pip install --upgrade pip
176+
pip install -r requirements.txt
142177
143-
- name: Run migrations
144-
run: python manage.py migrate
178+
- name: Run migrations
179+
env:
180+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
181+
run: python manage.py migrate
145182

146-
- name: Run tests
147-
run: python manage.py test
183+
- name: Run tests
184+
env:
185+
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/testdb
186+
run: python manage.py test
148187

149188
deploy:
150189
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)