forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docker: implement multi-stage-builds for ubuntu (OSGeo#3170)
* test grass.script.setup * test script for docker images * black * add test instructions * multi-stage-build similar to alpine * Apply suggestions from code review Co-authored-by: Carmen Tawalika <mmacata@users.noreply.github.com> * add test for GDAL-plugin * copy GDAL-plugin and set path * Update docker/ubuntu/Dockerfile Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com> * ignore dist.* in docker builds * address review comments * separate datum grid (proj >= 7) stage * use network grids * GUI build argument * GUI build argument --------- Co-authored-by: ninsbl <stbl@nve.no> Co-authored-by: Carmen Tawalika <mmacata@users.noreply.github.com> Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
378 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# to be used in Dockerfile | ||
|
||
# Display environment | ||
printf "\n############\nPrinting defined environment variables:\n############\n" | ||
printenv | ||
|
||
# run simple LAZ test | ||
cp docker/testdata/simple.laz /tmp/ | ||
cp docker/testdata/test_grass_session.py /tmp/ | ||
cp docker/testdata/test_grass_python.py /tmp/ | ||
cp -r demolocation /tmp/ | ||
|
||
# Test gdal-grass-plugin | ||
printf "\n############\nTesting the gdal_grass plugin:\n############\n" | ||
gdalinfo --formats | grep "GRASS -raster-" | ||
|
||
# Test grass-session | ||
printf "\n############\nTesting grass_session:\n############\n" | ||
/usr/bin/python3 /tmp/test_grass_session.py | ||
|
||
# Test grass-setup | ||
printf "\n############\nTesting grass script setup:\n############\n" | ||
export DEMOLOCATION=/tmp/demolocation/PERMANENT | ||
/usr/bin/python3 /tmp/test_grass_python.py | ||
|
||
# Test PDAL | ||
printf "\n############\nTesting PDAL with laz:\n############\n" | ||
grass --tmp-location EPSG:25832 --exec r.in.pdal input="/tmp/simple.laz" output="count_1" method="n" resolution=1 -g | ||
|
||
# Test GRASS GIS Python-addon installation | ||
# add dependency | ||
printf "\n############\nTesting GRASS GIS Python-addon installation:\n############\n" | ||
/usr/bin/python3 -m pip install --no-cache-dir scikit-learn | ||
|
||
grass --tmp-location XY --exec g.extension extension=r.learn.ml2 operation=add && \ | ||
grass --tmp-location XY --exec g.extension extension=r.learn.ml2 operation=remove -f | ||
|
||
# cleanup dependency | ||
/usr/bin/python3 -m pip uninstall -y scikit-learn | ||
|
||
# Test GRASS GIS C-addon installation: raster and vector | ||
printf "\n############\nTesting GRASS GIS C-addon installation:\n############\n" | ||
grass --tmp-location XY --exec g.extension extension=r.gwr operation=add && \ | ||
grass --tmp-location XY --exec g.extension extension=r.gwr operation=remove -f | ||
grass --tmp-location XY --exec g.extension extension=v.centerpoint operation=add && \ | ||
grass --tmp-location XY --exec g.extension extension=v.centerpoint operation=remove -f | ||
|
||
# show GRASS GIS, PROJ, GDAL etc versions | ||
printf "\n############\nPrinting GRASS, PDAL and Python versions:\n############\n" | ||
grass --tmp-location EPSG:4326 --exec g.version -rge && \ | ||
pdal --version && \ | ||
python3 --version | ||
|
||
# Test presence of central python packages | ||
printf "\n############\nPrinting versions of central python packages:\n############\n" | ||
python3 -c "import psycopg2;import numpy as np;print(psycopg2.__version__);print(np.__version__)" | ||
|
||
# Run testsuite | ||
if [ $TESTSUITE ] ; then | ||
printf "\n############\nRunning the testsuite:\n############\n" | ||
bash /grassdb/.github/workflows/test_thorough.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Import GRASS Python bindings | ||
import os | ||
import grass.script as gs | ||
|
||
# hint: do not use ~ as an alias for HOME | ||
with gs.setup.init( | ||
# run in PERMANENT mapset of demolocation in GRASS GIS source | ||
os.environ["DEMOLOCATION"] # "/grassdata/demolocation/PERMANENT", | ||
): | ||
print("grass-setup: tests for PROJ, GDAL, PDAL, GRASS GIS") | ||
print(gs.parse_command("g.gisenv", flags="s")) | ||
|
||
# simple test: just scan the LAZ file | ||
gs.run_command( | ||
"r.in.pdal", | ||
input="/tmp/simple.laz", | ||
output="count_1", | ||
method="n", | ||
flags="g", | ||
resolution=1, | ||
overwrite=True, | ||
) |
Oops, something went wrong.