Skip to content

Commit

Permalink
add multimodule + ci files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacata committed Nov 29, 2022
1 parent 4562c2f commit 0154209
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[flake8]

# E501 line too long (83 > 79 characters)
# F821 undefined name '_'

exclude = .git
max-line-length = 88
per-file-ignores =
./r.geoserver.publish.py: E501, F821
./r.geoserver.style.py: E501, F821
./testsuite/test_r_geoserver_style.py: E501
./t.geoserver.publish.py: E501, F821
13 changes: 13 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM mundialis/grass-py3-pdal:latest-alpine

WORKDIR /src
COPY . /src
COPY .github/workflows/test.sh /src
RUN apk add gcc make python3-dev musl-dev linux-headers
RUN test -e requirements.txt && pip3 install -r requirements.txt || echo "No requirements.txt"

# # run tests with downloaded NC test loaction
# RUN grass -c epsg:3358 /grassdb/nc_spm_empty --exec bash test.sh NC

# run tests in empty location
RUN grass -c epsg:3358 /grassdb/nc_spm_empty --exec bash test.sh
25 changes: 25 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Python Flake8 Code Quality

on:
- push
- pull_request

jobs:
flake8:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install
run: |
python -m pip install --upgrade pip
pip install flake8==3.8.4
- name: Run Flake8
run: |
flake8 --config=.flake8 --count --statistics --show-source --jobs=$(nproc) .
27 changes: 27 additions & 0 deletions .github/workflows/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# fail on non-zero return code from a subprocess
set -e

# download NC test loaction if the test needs the data and run tests
if [ $1 == "NC" ]
then
g.extension g.download.location
g.download.location url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=/grassdb
g.mapset mapset=PERMANENT location=nc_spm_full_v2alpha2 -c
g.list all
fi

# run all tests in folder
FILENAME=$(basename "$(find . -name *.html -maxdepth 1)")
ADDON="${FILENAME%%.html}"

CURRENTDIR=$(pwd)
g.extension extension=${ADDON} url=. && \
for file in $(find . -type f -name test*.py) ; \
do \
echo ${file}
BASENAME=$(basename "${file}") ; \
DIR=$(dirname "${file}") ; \
cd ${CURRENTDIR}/${DIR} && python3 -m unittest ${BASENAME}
done
28 changes: 28 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Run tests for GRASS GIS addons
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# with:
# path: "."
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Test of GRASS GIS addon
id: docker_build
uses: docker/build-push-action@v2
with:
push: false
tags: addon-tests:alpine
context: .
file: .github/workflows/Dockerfile
no-cache: true
# pull: true
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MODULE_TOPDIR = ../..

PGM = r.geoserver

# note: to deactivate a module, just place a file "DEPRECATED" into the subdir
ALL_SUBDIRS := ${sort ${dir ${wildcard */.}}}
DEPRECATED_SUBDIRS := ${sort ${dir ${wildcard */DEPRECATED}}}
RM_SUBDIRS := bin/ docs/ etc/ scripts/
SUBDIRS_1 := $(filter-out $(DEPRECATED_SUBDIRS), $(ALL_SUBDIRS))
SUBDIRS := $(filter-out $(RM_SUBDIRS), $(SUBDIRS_1))

include $(MODULE_TOPDIR)/include/Make/Dir.make

default: parsubdirs htmldir

install: installsubdirs
$(INSTALL_DATA) $(PGM).html $(INST_DIR)/docs/html/
58 changes: 58 additions & 0 deletions r.geoserver.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>GRASS GIS manual: r.geoserver toolset</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="grassdocs.css" type="text/css">
</head>
<body bgcolor="white">
<div id="container">

<a href="https://grass.osgeo.org/grass-stable/manuals/index.html"><img src="grass_logo.png" alt="GRASS logo"></a>
<hr class="header">

<h2>NAME</h2>

<em><b>r.geoserver</b></em> - collection of GRASS GIS addons to publish and
style raster maps as well as space time raster data sets with
different coverage stores (Tiff, image mosaic,
<tt>geoserver-grass-datastore</tt>) and to create GeoServer layers for it.
All modules use the GeoServer REST API.

<h2>KEYWORDS</h2>

<a href="https://grass.osgeo.org/grass-stable/manuals/geoserver.html">geoserver</a>, <a href="https://grass.osgeo.org/grass-stable/manuals/WMS.html">WMS</a>

<!-- meta page description: Toolset for download and processing time series of Sentinel products -->
<h2>DESCRIPTION</h2>

The <em>r.geoserver</em> collection consists of currently three modules.
<p>

<dl>
<dt><a href="r.geoserver.publish.html">r.geoserver.publish</a></dt>
<dd>Publishes raster maps as well as STRDS with
<tt>geoserver-grass-datastore</tt> coverage store and creates a
GeoServer layer for it.
<dt><a href="r.geoserver.style">r.geoserver.style</a></dt>
<dd>Publishes a style based on GRASS GIS map and attaches to layer.
For STRDS the first map is taken to set the style for
all raster maps in the STRDS.
</dd>
<dt><a href="t.geoserver.publish">t.geoserver.publish</a></dt>
<dd>Publishes and styles each raster map of a STRDS to a geoserver.
Either each map inside STRDS is published individually as COG, or all are
combined to an image mosaic store. Data can either be shared via mount
point or uploaded.
</dd>
</dl>

<h2>REQUIREMENTS</h2>

<ul>
<li>A running <a href="https://geoserver.org/">GeoServer</a> instance</a></li>
</ul>

<h2>AUTHORS</h2>

Anika Weinmann, Carmen Tawalika and Guido Riembauer, <a href="https://www.mundialis.de/">mundialis</a>, Germany

0 comments on commit 0154209

Please sign in to comment.