-
Notifications
You must be signed in to change notification settings - Fork 4
150 lines (150 loc) · 4.35 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Tests
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 0 * * *"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install tox
run: |
pip install --upgrade pip
pip install tox
- name: Run linting
run: |
tox -e lint
check-migrations-graph:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: django
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
minio:
# This image does not require any command arguments (which GitHub Actions don't support)
image: bitnami/minio:2022.3.5-debian-10-r3
env:
MINIO_ROOT_USER: minioAccessKey
MINIO_ROOT_PASSWORD: minioSecretKey
ports:
- 9000:9000
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install tox
run: |
pip install --upgrade pip
pip install tox
- name: Install graphviz
run: |
sudo apt update
sudo apt-get install --no-install-recommends --yes graphviz libgraphviz-dev
- name: Run check migrations and graph models
run: |
tox -e check-migrations
tox -e graph-models
env:
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey
DJANGO_STORAGE_BUCKET_NAME: django-storage
- name: Upload model graphs
uses: actions/upload-artifact@v2
with:
name: graphs
path: .tox/graphs/*.png
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: django
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
minio:
# This image does not require any command arguments (which GitHub Actions don't support)
image: bitnami/minio:2022.3.5-debian-10-r3
env:
MINIO_ROOT_USER: minioAccessKey
MINIO_ROOT_PASSWORD: minioSecretKey
ports:
- 9000:9000
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install tox
run: |
pip install --upgrade pip
pip install tox
- name: Run tests
run: |
tox -e test
env:
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey
DJANGO_MINIO_STORAGE_SECRET_KEY: minioSecretKey
DJANGO_STORAGE_BUCKET_NAME: django-storage
- name: Stash coverage
uses: actions/upload-artifact@v2
with:
name: .coverage
path: project/coverage.xml
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: project/coverage.xml
verbose: true
test-demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install -e .[colormaps] -r demo/requirements.txt
- name: Run tests
working-directory: demo
run: |
rm -rf ./data && mkdir ./data
python manage.py migrate
pytest --cov=django_large_image -v .
coverage xml -o coverage.xml
env:
DJANGO_SETTINGS_MODULE: myimages.settings
DJANGO_DEBUG: true
- name: Stash coverage
uses: actions/upload-artifact@v2
with:
name: .coverage
path: demo/coverage.xml
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: demo/coverage.xml
verbose: true