forked from ifgi/optimetaPortal
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (132 loc) · 4.52 KB
/
ci.yml
File metadata and controls
159 lines (132 loc) · 4.52 KB
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
151
152
153
154
155
156
157
158
159
name: Django CI Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
pull-requests: write # allow posting comments on PRs by actions
jobs:
unittests:
runs-on: ubuntu-24.04
strategy:
max-parallel: 4
matrix:
python-version: [
3.11,
#3.13
]
services:
db:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: optimap
POSTGRES_PASSWORD: optimap
POSTGRES_DB: optimap
ports:
- 5432:5432
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL from UbuntuGIS
run: |
sudo apt-get update
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get install -y -qq gdal-bin libgdal-dev
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install gdal=="$(gdal-config --version).*"
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
- name: Run Django migrations
run: |
python manage.py migrate
- name: Load all testdata to see if it is up to date with the Django migrations
run: |
python manage.py loaddata fixtures/test_data_optimap.json
python manage.py loaddata fixtures/test_data_partners.json
- name: Run deploy checks
run: |
python -Wa manage.py check --deploy
- name: Run Tests
run: |
coverage run --source='publications' --omit='*/migrations/**' manage.py test tests
- name: Check coverage and save it to files
run: |
coverage html
coverage xml
coverage report --show-missing --fail-under=50
#- name: Post code coverage
# uses: orgoro/coverage@v3.2
# with:
# coverageFile: coverage.xml
# token: ${{ secrets.GITHUB_TOKEN }}
uitests:
# disable until UI tests are fixed, see https://github.com/GeoinformationSystems/optimap/issues/142
if: false
runs-on: ubuntu-24.04
strategy:
max-parallel: 4
matrix:
python-version: [
3.11,
#3.13
]
services:
db:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: optimap
POSTGRES_PASSWORD: optimap
POSTGRES_DB: optimap
ports:
- 5432:5432
options: --mount type=tmpfs,destination=/var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
# Based on https://github.com/MarketingPipeline/Python-Selenium-Action/blob/main/.github/workflows/Selenium-Action_Template.yaml and put python packages in requirements-dev.txt
- name: Removing previous chrome instances on runner
run: sudo apt purge google-chrome-stable
- name: Install xvfb
run: |
sudo apt install -y xvfb firefox
# See https://github.com/SeleniumHQ/selenium/issues/15327
- name: Install deps for chrome
run: |
sudo apt install libgtk-3-dev libnotify-dev libnss3 libxss1 libasound2t64
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL from UbuntuGIS
run: |
sudo apt-get update
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get install -y -qq gdal-bin libgdal-dev
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install gdal=="$(gdal-config --version).*"
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
- name: Run Django migrations
run: |
python manage.py migrate
- name: Run UI Tests
run: |
python -Wa manage.py runserver > server.log 2>&1 & python -Wa manage.py test tests-ui
- name: Print Server Logs
run: |
cat server.log
- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots for Python ${{ matrix.python-version }}
path: |
${{ github.workspace }}/tests-ui/screenshots/