forked from City-of-Helsinki/parkkihubi
-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (77 loc) · 2.43 KB
/
main.yaml
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
name: "Tests and Checks"
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
workflow_dispatch:
jobs:
tests:
strategy:
matrix:
python: ["3.10"] #3.10
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004
# container: "python:${{matrix.python}}-slim-buster"
steps:
- uses: actions/checkout@v3
- name: Update apt-get sources
run: sudo apt-get update
- name: Install PostgreSQL, PostGIS and GDAL
run: >
sudo apt-get install -y
gdal-bin
python3-gdal
postgis
postgresql
postgresql-client
postgresql-postgis
libpq-dev
build-essential
- name: Start PostgreSQL server
run: sudo /etc/init.d/postgresql start
- name: Allow runner to create PostgreSQL databases
run: sudo su - postgres -c "createuser --createdb runner"
- name: Create PostGIS extension
run: >
sudo su - postgres
-c "psql template1 -c 'create extension postgis'"
- name: Install Tox and tox-gh-actions
run: pip install tox tox-gh-actions
- name: Test with Tox
run: tox
- name: Upload coverage data to codecov.io
uses: codecov/codecov-action@v3
test-dockerization:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup Docker
uses: docker/setup-buildx-action@v1
- name: Build Docker image of the app
run: docker compose build
- name: Copy default configuration as active
run: cp -n local_settings.py.tpl_dev local_settings.py
- name: Start the services with docker compose up
run: docker compose up -d
- name: Run pytest in the app container
run: USE_DOCKER=1 ./run-pytest -vvv
checks:
strategy:
matrix:
toxenv: [style, requirements, sanitizer]
runs-on: ubuntu-22.04 #ubuntu:jammy-20231004
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/[email protected]
with:
python-version: "3.10" #3.10
- name: Install GDAL
run: sudo apt-get update && sudo apt-get install -y gdal-bin
if: ${{ matrix.toxenv == 'sanitizer' }}
- name: Install Tox and tox-gh-actions
run: pip install tox tox-gh-actions
- name: Run the check with Tox
run: tox
env:
TOXENV: ${{matrix.toxenv}}