Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More request customization #153

Merged
merged 14 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
pip install GDAL==`gdal-config --version`
python -m pip install --upgrade pip
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()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FunctionsToImplement.py
record.txt
package_test.py
test.py
.idea/

# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python
Expand Down
Loading
Loading