-
Notifications
You must be signed in to change notification settings - Fork 5
138 lines (115 loc) · 4.48 KB
/
test_pepys.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
name: Test Pepys
on:
push:
branches:
- master
pull_request:
jobs:
test-linux:
name: Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install apt dependencies
shell: bash -l {0}
run: |
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
sudo apt update
# workaround for pg14 being present in GitHub base image of Ubuntu
sudo apt remove postgresql-14 postgresql-client
sudo apt install -y postgresql-13-postgis-3 sqlite3 libgdal-dev libproj-dev libproj-dev libsqlite3-dev spatialite-bin libsqlite3-mod-spatialite
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pip dependencies
shell: bash -l {0}
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Install pytest GH Actions plugin
shell: bash -l {0}
run: pip install pytest-github-actions-annotate-failures
- name: Run tests (non GUI)
shell: bash -l {0}
env:
PEPYS_SPATIALITE_PATH: /usr/lib/x86_64-linux-gnu/mod_spatialite.so
SQLALCHEMY_WARN_20: 1
run: |
coverage3 run -m pytest -v --color=yes --ignore=tests/gui_tests tests/ -Werror
- name: Run tests (GUI)
shell: bash -l {0}
env:
PEPYS_SPATIALITE_PATH: /usr/lib/x86_64-linux-gnu/mod_spatialite.so
SQLALCHEMY_WARN_20: 1
run: |
coverage3 run -a -m pytest -v --color=yes -s tests/gui_tests -Werror
- name: Run black
shell: bash -l {0}
run: |
black --check --diff importers pepys_import pepys_admin pepys_timeline tests
- name: Run isort
shell: bash -l {0}
run: |
isort --check-only --diff importers pepys_import pepys_admin pepys_timeline tests
- name: Get coverage report
shell: bash -l {0}
run: |
coverage3 report
coverage3 xml
- uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
test-windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
# - name: Install Postgres 12
# uses: crazy-max/ghaction-chocolatey@v1
# with:
# args: install postgresql12
# - name: Stop Postgres service
# shell: powershell
# run: |
# Stop-Service postgresql-x64-12
- name: Run setup Powershell script
shell: cmd
run: powershell.exe -executionpolicy remotesigned -File .\.github\workflows\setup_windows.ps1
- name: Set up environment variables
shell: bash -l {0}
run: |
echo "C:\Program Files\PostgreSQL\12\bin" >> $GITHUB_PATH
echo ".\lib\spatialite-loadable-modules-5.0.0-win-amd64" >> $GITHUB_PATH
echo "PYTHONPATH=.\lib\sqlite-python" >> $GITHUB_ENV
- name: Install pip dependencies
shell: cmd
run: |
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Install pytest GH Actions plugin
shell: bash -l {0}
run: pip install pytest-github-actions-annotate-failures
# This actions runs all tests under a different user so that Postgres doesn't complain
# It has various issues - it seems to cause other tests to fail, seems to be slow to produce output on the online GH Actions
# console, and seems to run into MemoryErrors. At the moment it isn't worth debugging these as running the Postgres tests
# on Windows isn't that important to us.
#
# To try this again:
# 1. Uncomment this section below, plus the two sections above which install and setup Postgres
# 2. Uncomment the commented section in setup_windows.ps1 which installs PostGIS
#
# - name: Run tests (with Postgres)
# shell: cmd
# run: powershell.exe -executionpolicy remotesigned -File .\.github\workflows\windows_run_tests.ps1
- name: Run tests (no Postgres)
shell: cmd
run: python.exe -m pytest -v --color=yes tests -m "not postgres" -Werror
env:
SQLALCHEMY_WARN_20: 1