-
Notifications
You must be signed in to change notification settings - Fork 9
71 lines (56 loc) · 1.88 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Run tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install Pipenv
uses: dschep/install-pipenv-action@v1
- name: Cache Pipenv Virtualenv
uses: actions/cache@v1
id: pipenv-cache
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-v2-
- name: Install Dependencies
run: pipenv install --deploy --dev
if: steps.pipenv-cache.outputs.cache-hit != 'true'
- name: Lint and format checks
run: |
pipenv run ruff check .
- name: Set environment variables
run: |
cp .env.ci .env
- name: Running Django migrations check to ensure that there are no migrations left to create
env:
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/test?sslmode=disable'
run: |
pipenv run python manage.py makemigrations --check --dry-run
- name: Run tests
env:
DATABASE_URL: 'postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/test?sslmode=disable'
run: |
pipenv run python manage.py migrate --noinput
pipenv run py.test