-
Notifications
You must be signed in to change notification settings - Fork 79
148 lines (135 loc) · 5.64 KB
/
python-test.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
name: Run tests
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
jobs:
test-ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-add-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev
python -m pip install --upgrade pip
python -m pip install GDAL==`gdal-config --version`
python -m pip install -r requirements_dev.txt
- name: Set up docker-compose
run: |
docker compose -f tests/docker-compose.yaml up -d
sleep 60 # Geoserver takes quite a long time to boot up and there is no healthcheck
- name: Test with pytest
uses: dariocurr/pytest-summary@main
with:
paths: tests/test_geoserver.py
env:
DB_HOST: postgis
- name: Upload test summary
uses: actions/upload-artifact@v4
with:
name: test-summary-linux
path: test-summary-linux.md
if: always()
#test-windows:
#
# runs-on: windows-latest
#
# steps:
# - uses: actions/checkout@v4
#
# - name: Set up Python 3.10
# uses: actions/setup-python@v3
# with:
# python-version: '3.10'
#
# - name: Set up PostGIS
# run: |
#
# # Install PostGIS (PostgreSQL comes on the GitHub Actions runner by default but lacks PostGIS control files and dependencies)
# netsh advfirewall firewall show rule name="Allow Localhost 5432"
# Invoke-WebRequest -Uri "http://download.osgeo.org/postgis/windows/pg14/postgis-bundle-pg14x64-setup-3.4.1-1.exe" -OutFile "postgis-installer.exe"
# Start-Process "postgis-installer.exe" -ArgumentList "/S /D=C:\Program Files\PostgreSQL\14" -Wait -NoNewWindow
# & "C:\Program Files\PostgreSQL\14\bin\pg_ctl.exe" -D "C:\Program Files\PostgreSQL\14\data" start
# & "C:\Program Files\PostgreSQL\14\bin\psql.exe" -U postgres -c "CREATE DATABASE geodb;"
# & "C:\Program Files\PostgreSQL\14\bin\psql.exe" -U postgres -c "CREATE USER geodb_user WITH ENCRYPTED PASSWORD 'geodb_pass';"
# & "C:\Program Files\PostgreSQL\14\bin\psql.exe" -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE geodb TO geodb_user;"
# & "C:\Program Files\PostgreSQL\14\bin\psql.exe" -U postgres -d geodb -c "CREATE EXTENSION postgis;"
#
# - name: Set up Tomcat/GeoServer
# run: |
#
# # Configure firewall to allow connectiosn to localhost port 8080 (might not be necessary)
# netsh advfirewall firewall add rule name="Allow Localhost 5432" dir=in action=allow protocol=TCP localport=5432
#
# # Download and install Apache Tomcat (need version 9 because the JRE on the GitHub Actions runner is incompatible with 10+)
# curl -L https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.88/bin/apache-tomcat-9.0.88-windows-x64.zip -o tomcat.zip
# Expand-Archive -Path tomcat.zip -DestinationPath "C:\"
# $directory = Get-ChildItem -Path "C:\" -Directory | Where-Object { $_.Name -like "*apache-tomcat*" } | Select-Object -First 1
# if ($directory) { Rename-Item -Path $directory.FullName -NewName "Tomcat" }
#
# # Download and install Geoserver, then move it to the Tomcat directory
# # Version-locked to 2.22.0 beacause of Java 8
# curl -L https://sourceforge.net/projects/geoserver/files/GeoServer/2.22.0/geoserver-2.22.0-war.zip/download -o geoserver.zip
# Expand-Archive -Path geoserver.zip -DestinationPath "C:\GeoServer"
# cp C:\GeoServer\geoserver.war C:\Tomcat\webapps\geoserver.war
#
# # Set env vars for Tomcat and run it (it takes a little while, so wait 30 seconds after)
# $env:CATALINA_BASE = "C:\Tomcat"
# $env:CATALINA_HOME = "C:\Tomcat"
# $env:CATALINA_TMPDIR = "C:\Tomcat\temp"
# C:\Tomcat\bin\startup.bat
# Start-Sleep -Seconds 30
#
# shell: pwsh
#
# - name: Install Miniconda
# run: |
# curl -O https://repo.anaconda.com/miniconda/Miniconda3-py39_4.10.3-Windows-x86_64.exe
# Start-Process -FilePath "Miniconda3-py39_4.10.3-Windows-x86_64.exe" -ArgumentList '/InstallationType=JustMe /RegisterPython=0 /S /D="%UserProfile%\Miniconda3"' -Wait -NoNewWindow
# & "$env:UserProfile\Miniconda3\Scripts\conda" init powershell
# shell: pwsh
#
# - name: Configure Conda environment
# run: |
# $env:PATH = "$env:UserProfile\Miniconda3;$env:UserProfile\Miniconda3\Scripts;$env:UserProfile\Miniconda3\Library\bin;$env:PATH"
# conda update conda -y
# conda create -n geospatial python=3.10 -y
# conda activate geospatial
# conda install -c conda-forge gdal>=3.4.1 -y
# python -m pip install --upgrade pip
# pip install -r requirements_dev.txt
# shell: pwsh
#
# #- name: Test with pytest
# # uses: dariocurr/pytest-summary@main
# # with:
# # paths: tests/test_geoserver.py
# # env:
# # DB_HOST: postgis
#
# - name: Test with pytest
# run: |
# conda activate geospatial
# pytest tests/test_geoserver.py
#
# - name: Upload test summary
# uses: actions/upload-artifact@v3
# with:
# name: test-summary-windows
# path: test-summary-windows.md
# if: always()