File tree Expand file tree Collapse file tree 7 files changed +490
-16
lines changed
Expand file tree Collapse file tree 7 files changed +490
-16
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ POSTGIS_VERSION=3
88
99# Paths.
1010SOURCES_PATH=/application
11+ GEOSOP_PATH=/usr/local/bin/geosop
1112
1213# Postgres credentials.
1314POSTGRES_HOST=postgres
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ services:
1717 - MYSQL_PORT
1818 - MYSQL_USER
1919 - MYSQL_PASSWORD
20+ - GEOSOP_PATH
2021 working_dir : ${SOURCES_PATH}
2122 cap_drop :
2223 - ALL
Original file line number Diff line number Diff line change 11ARG PHP_VERSION
22FROM php:${PHP_VERSION}-cli
33
4- RUN apt update && apt install --yes git libpq-dev libgeos-dev libsqlite3-mod-spatialite
4+ SHELL ["/bin/sh" , "-e" , "-c" ]
5+
6+ RUN apt update && apt install --yes git cmake libpq-dev libgeos-dev libsqlite3-mod-spatialite
57RUN docker-php-ext-install pdo pdo_pgsql pdo_mysql
68
9+ # SQLite3 configuration
710RUN echo "[sqlite3]\n sqlite3.extension_dir = /usr/lib/x86_64-linux-gnu" > /usr/local/etc/php/conf.d/sqlite3.ini
811
12+ # GEOS PHP extension
913RUN <<EOF
1014git clone https://git.osgeo.org/gitea/geos/php-geos.git
1115cd php-geos
@@ -14,8 +18,23 @@ cd php-geos
1418make
1519mv modules/geos.so $(php -r "echo ini_get('extension_dir');" )
1620echo "extension=geos.so" > /usr/local/etc/php/conf.d/geos.ini
21+ cd ..
22+ rm -rf php-geos
23+ EOF
24+
25+ # geosop CLI
26+ RUN <<EOF
27+ git clone --depth 1 --branch 3.13.1 https://github.com/libgeos/geos.git
28+ mkdir geos/build
29+ cd geos/build
30+ cmake .. -DBUILD_SHARED_LIBS=OFF -DCMAKE_EXE_LINKER_FLAGS="-static -static-libstdc++ -static-libgcc"
31+ cmake --build . -- -j$(nproc)
32+ make install
33+ cd ../..
34+ rm -rf geos
1735EOF
1836
37+ # Composer
1938COPY --from=composer /usr/bin/composer /usr/bin/composer
2039
2140CMD sleep infinity
Original file line number Diff line number Diff line change @@ -269,3 +269,49 @@ jobs:
269269 run : vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
270270 env :
271271 COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
272+
273+ phpunit-geosop :
274+ name : PHPUnit geosop
275+ runs-on : ubuntu-22.04
276+
277+ strategy :
278+ matrix :
279+ php-version :
280+ - " 8.1"
281+
282+ steps :
283+ - name : Checkout
284+ uses : actions/checkout@v4
285+
286+ - name : Setup PHP
287+ uses : shivammathur/setup-php@v2
288+ with :
289+ php-version : ${{ matrix.php-version }}
290+ extensions : geos
291+ coverage : xdebug
292+
293+ - name : Install composer dependencies
294+ uses : ramsey/composer-install@v3
295+
296+ - name : Install geosop
297+ run : |
298+ sudo apt update
299+ sudo apt install geos-bin
300+
301+ - name : Test geosop
302+ run : |
303+ geosop
304+ geosop -a "MULTILINESTRING ((1 1, 2 2))" length
305+
306+ - name : Run PHPUnit with coverage
307+ run : |
308+ mkdir -p mkdir -p build/logs
309+ vendor/bin/phpunit --coverage-clover build/logs/clover.xml
310+ env :
311+ ENGINE : geosop
312+ GEOSOP_PATH : /usr/bin/geosop
313+
314+ - name : Upload coverage report to Coveralls
315+ run : vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
316+ env :
317+ COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 11<?php
22
3+ use Brick \Geo \Engine \GeosOpEngine ;
34use Brick \Geo \Engine \PDOEngine ;
45use Brick \Geo \Engine \SQLite3Engine ;
56use Brick \Geo \Engine \GEOSEngine ;
@@ -127,6 +128,13 @@ function getRequiredEnv(string $name): string
127128 $ engine = new GEOSEngine ();
128129 break ;
129130
131+ case 'geosop ' :
132+ echo 'Using GeosOpEngine ' , PHP_EOL ;
133+
134+ $ geosopPath = getRequiredEnv ('GEOSOP_PATH ' );
135+ $ engine = new GeosOpEngine ($ geosopPath );
136+ break ;
137+
130138 default :
131139 echo 'Unknown engine: ' , $ engine , PHP_EOL ;
132140 exit (1 );
You can’t perform that action at this time.
0 commit comments