-
Notifications
You must be signed in to change notification settings - Fork 74
98 lines (80 loc) · 2.46 KB
/
main.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: LegalDB CI
on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
job_lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://devcenter.heroku.com/articles/getting-started-with-python
# Match version to Heroku app
# Keep in sync with Dockerfile and Pipfile
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pipenv
run: |
pip install --upgrade pip
pip install pipenv
- name: Install dependencies
# Install _only_ [dev-packages]
run: pipenv sync --categories dev-packages --system
- name: Run Black check
run: black --check .
- name: Run Flake8 check
run: |
mkdir test-reports
flake8 . --output-file test-reports/flake8
- name: Upload flake test results
uses: actions/upload-artifact@v4
with:
name: flake8-report
path: test-reports/flake8
# Use failure() to upload only if failure occurs
if: ${{ failure() }}
job_test:
runs-on: ubuntu-latest
services:
postgres:
# https://hub.docker.com/_/postgres
# https://devcenter.heroku.com/articles/heroku-postgres-version-support
# Match version to Heroku app. Keep in sync with docker-compose.yml
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v4
# https://devcenter.heroku.com/articles/python-support
# Match version to Heroku app
# Keep in sync with Dockerfile and Pipfile
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pipenv
run: |
pip install --upgrade pip
pip install pipenv
- name: Install dependencies
run: pipenv sync --dev --system
- name: Compile assets
run: |
python manage.py collectstatic --no-input
python manage.py compress --force
- name: Run tests
run: pipenv run python manage.py test