Skip to content

Commit 483aaf8

Browse files
authored
Switch from Travis and AppVeyor to GitHub actions (#274)
1 parent 9369800 commit 483aaf8

File tree

12 files changed

+349
-26
lines changed

12 files changed

+349
-26
lines changed

.github/workflows/build-linux.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build MapCache on Linux
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
6+
build-matrix:
7+
strategy:
8+
matrix:
9+
os: [ ubuntu-18.04, ubuntu-20.04 ]
10+
option: [ minimal, default, maximal ]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Install dependencies
17+
run: |
18+
if [[ 'minimal,default,maximal' =~ ${{ matrix.option }} ]]
19+
then
20+
sudo apt-get update -y
21+
sudo apt-get upgrade -y
22+
sudo apt-get install -y libcurl4-openssl-dev apache2-dev
23+
fi
24+
if [[ 'default,maximal' =~ ${{ matrix.option }} ]]
25+
then
26+
sudo apt-get install -y libgdal-dev libfcgi-dev libpixman-1-dev
27+
sudo apt-get install -y gdal-bin libxml2-utils
28+
fi
29+
if [[ 'maximal' =~ ${{ matrix.option }} ]]
30+
then
31+
sudo apt-get install -y libhiredis-dev libdb-dev libmapserver-dev
32+
fi
33+
34+
- name: Build MapCache
35+
run: |
36+
if [[ 'minimal' == ${{ matrix.option }} ]]
37+
then
38+
options="-DWITH_SQLITE=OFF \
39+
-DWITH_PIXMAN=OFF \
40+
-DWITH_GDAL=OFF \
41+
-DWITH_APACHE=OFF \
42+
-DWITH_CGI=OFF \
43+
-DWITH_OGR=OFF \
44+
-DWITH_GEOS=OFF \
45+
-DWITH_MAPCACHE_DETAIL=OFF"
46+
elif [[ 'default' == ${{ matrix.option }} ]]
47+
then
48+
options=""
49+
elif [[ 'maximal' == ${{ matrix.option }} ]]
50+
then
51+
options="-DWITH_POSTGRESQL=ON \
52+
-DWITH_BERKELEY_DB=ON \
53+
-DWITH_MEMCACHE=ON \
54+
-DWITH_REDIS=ON \
55+
-DWITH_TIFF=ON \
56+
-DWITH_TIFF_WRITE_SUPPORT=ON \
57+
-DWITH_GEOTIFF=ON \
58+
-DWITH_PCRE=ON \
59+
-DWITH_MAPSERVER=ON \
60+
-DWITH_RIAK=OFF"
61+
fi
62+
mkdir build
63+
cd build
64+
cmake ${options} ${{ github.workspace }}
65+
make
66+
sudo make install
67+
sudo ldconfig
68+
69+
- name: Run tests
70+
run: |
71+
if [[ 'ubuntu-20.04' == ${{ matrix.os }} ]] \
72+
&& [[ 'default' == ${{ matrix.option }} ]]
73+
then
74+
cd ${{ github.workspace }}/tests
75+
./setup.sh
76+
./run.sh
77+
else
78+
echo No test performed on this target
79+
fi
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build MapCache on Windows
2+
on: [ push, pull_request ]
3+
4+
jobs:
5+
6+
build-matrix:
7+
strategy:
8+
matrix:
9+
os: [ windows-2019 ]
10+
option: [ default ]
11+
runs-on: ${{matrix.os}}
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
16+
- name: Install dependencies
17+
run: |
18+
Set-Location -Path "${{github.workspace}}"
19+
New-Item -Path . -Name "sdk" -ItemType "directory"
20+
Set-Location -Path "sdk"
21+
curl -O https://download.gisinternals.com/sdk/downloads/release-1928-x64-dev.zip
22+
unzip -qq release-1928-x64-dev.zip
23+
$sdkprefix = "${{github.workspace}}\sdk\release-1928-x64"
24+
Set-Location -Path "$sdkprefix\lib"
25+
Copy-Item -Path "libfcgi.lib" -Destination "fcgi.lib"
26+
Copy-Item -Path "apr-1.lib" -Destination "apr-1-1.lib"
27+
Copy-Item -Path "libapr-1.lib" -Destination "apr-1.lib"
28+
Copy-Item -Path "aprutil-1.lib" -Destination "aprutil-1-1.lib"
29+
Copy-Item -Path "libaprutil-1.lib" -Destination "aprutil-1.lib"
30+
31+
- name: Build MapCache
32+
run: |
33+
$sdkprefix = "${{github.workspace}}\sdk\release-1928-x64"
34+
Set-Location -Path "${{github.workspace}}"
35+
New-Item -Path . -Name "build" -ItemType "directory"
36+
Set-Location -Path "build"
37+
cmake -DCMAKE_PREFIX_PATH="$sdkprefix" -DWITH_APACHE=OFF -DWITH_FCGI=ON -DWITH_PCRE=ON -DWITH_TIFF=OFF "${{github.workspace}}"
38+
cmake --build . --config Release
39+
Copy-Item -Destination "$sdkprefix\bin" -Path "Release\mapcache.dll", "cgi\Release\mapcache.fcgi.exe", "util\Release\mapcache_seed.exe", "contrib\mapcache_detail\Release\mapcache_detail.exe"
40+
Set-Location -Path "$sdkprefix\bin"
41+
Compress-Archive -DestinationPath "${{github.workspace}}\mapcache.zip" -Path "${{github.workspace}}\mapcache.xml", "mapcache.dll", "mapcache.fcgi.exe", "mapcache_seed.exe", "mapcache_detail.exe"
42+
43+
- name: Upload binary artifacts
44+
uses: actions/upload-artifact@v2
45+
with:
46+
name: binaries
47+
path: mapcache.zip
48+
retention-days: 15
49+
50+
- name: Setup tests
51+
run: |
52+
$sdkprefix = "${{github.workspace}}\sdk\release-1928-x64"
53+
Set-Location -Path "${{github.workspace}}\build"
54+
Copy-Item -Path "..\tests\data\world.tif" -Destination .
55+
New-Item -Path "mapcache.xml"
56+
Set-Content -Path "mapcache.xml" -Value @"
57+
<?xml version=`"1.0`" encoding=`"UTF-8`"?>
58+
<mapcache>
59+
<source name=`"global-tif`" type=`"gdal`">
60+
<data>${{github.workspace}}\build\world.tif</data>
61+
</source>
62+
<cache name=`"disk`" type=`"disk`">
63+
<base>${{github.workspace}}\build</base>
64+
</cache>
65+
<tileset name=`"global`">
66+
<cache>disk</cache>
67+
<source>global-tif</source>
68+
<grid maxzoom=`"17`">GoogleMapsCompatible</grid>
69+
<format>JPEG</format>
70+
<metatile>1 1</metatile>
71+
</tileset>
72+
<locker type=`"disk`">
73+
<directory>${{github.workspace}}\build</directory>
74+
</locker>
75+
<service type=`"wms`" enabled=`"true`"/>
76+
<service type=`"wmts`" enabled=`"true`"/>
77+
<log_level>debug</log_level>
78+
</mapcache>
79+
"@
80+
81+
- name: Run tests
82+
run: |
83+
$sdkprefix = "${{github.workspace}}\sdk\release-1928-x64"
84+
Set-Location -Path "$sdkprefix\bin"
85+
$env:GDAL_DATA = "$sdkprefix\bin\gdal-data"
86+
$env:PROJ_LIB = "$sdkprefix\bin\proj7\share"
87+
.\mapcache_seed.exe -c "${{github.workspace}}\build\mapcache.xml" -t global --force -z 0,1
88+
Copy-Item -Path "${{github.workspace}}\build\global\GoogleMapsCompatible\00\000\000\000\000\000\000.jpg" -Destination "${{github.workspace}}\seed.jpg"
89+
$match = (.\gdal\apps\gdalinfo.exe -checksum "${{github.workspace}}\seed.jpg" | Select-String -CaseSensitive -Pattern "Checksum=21336" -Quiet)
90+
if ( $match ) {
91+
"Success"
92+
} else {
93+
"Failure: Did not get expected checksum"
94+
exit 1
95+
}
96+
$env:MAPCACHE_CONFIG_FILE = "${{github.workspace}}\build\mapcache.xml"
97+
$env:REQUEST_METHOD = "GET"
98+
$env:PATH_INFO = "/wmts/1.0.0/global/default/GoogleMapsCompatible/0/0/0.jpg"
99+
$env:QUERY_STRING = ""
100+
Start-Process -FilePath ".\mapcache.fcgi.exe" -RedirectStandardOutput "${{github.workspace}}\fcgi.jpg" -NoNewWindow -Wait
101+
perl.exe -0777 -pi -e 'binmode ARGV;binmode ARGVOUT;s/[A-Z][-:; ,\/=A-Za-z0-9]*\r\n//g;s/\r\n//' "${{github.workspace}}\fcgi.jpg"
102+
$match = (.\gdal\apps\gdalinfo.exe -checksum "${{github.workspace}}\fcgi.jpg" | Select-String -CaseSensitive -Pattern "Checksum=21336" -Quiet)
103+
if ( $match ) {
104+
"Success"
105+
} else {
106+
"Failure: Did not get expected checksum"
107+
exit 1
108+
}
109+
110+
- name: Upload test artifacts
111+
uses: actions/upload-artifact@v2
112+
with:
113+
name: test-results
114+
path: |
115+
seed.jpg
116+
fcgi.jpg
117+
retention-days: 2

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ if(JPEG_FOUND)
112112
include_directories(${JPEG_INCLUDE_DIR})
113113
target_link_libraries(mapcache ${JPEG_LIBRARY})
114114
else(JPEG_FOUND)
115+
report_mandatory_not_found(JPEG)
115116
endif(JPEG_FOUND)
116117

117118
find_package(CURL)

Vagrantfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,16 @@ require 'socket'
77
VAGRANTFILE_API_VERSION = "2"
88

99
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
10-
config.vm.box = "precise64"
11-
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
1210

11+
config.vm.box = "ubuntu/focal64"
1312
config.vm.hostname = "mapcache-vagrant"
14-
1513
config.vm.network :forwarded_port, guest: 80, host: 8080
16-
1714
config.vm.provider "virtualbox" do |v|
18-
v.customize ["modifyvm", :id, "--memory", 1024, "--cpus", 2]
19-
v.customize ["modifyvm", :id, "--ioapic", "on", "--largepages", "off", "--vtxvpid", "off"]
20-
v.name = "mapcache-vagrant"
21-
end
15+
v.customize ["modifyvm", :id, "--memory", 1024, "--cpus", 2]
16+
v.customize ["modifyvm", :id, "--ioapic", "on", "--largepages", "off", "--vtxvpid", "off"]
17+
v.name = "mapcache-vagrant"
18+
end
2219

23-
config.vm.provision "shell", path: "scripts/vagrant/virtualbox-fix.sh"
2420
config.vm.provision "shell", path: "scripts/vagrant/packages.sh"
2521
config.vm.provision "shell", path: "scripts/vagrant/mapcache.sh"
2622

lib/source_mapserver.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static mapcache_pooled_connection* _mapserver_get_connection(mapcache_context *c
9999
* \private \memberof mapcache_source_mapserver
100100
* \sa mapcache_source::render_map()
101101
*/
102-
void _mapcache_source_mapserver_render_map(mapcache_context *ctx, mapcache_map *map)
102+
void _mapcache_source_mapserver_render_map(mapcache_context *ctx, mapcache_source *psource, mapcache_map *map)
103103
{
104104
errorObj *errors = NULL;
105105
mapcache_pooled_connection *pc;
@@ -199,7 +199,7 @@ void _mapcache_source_mapserver_query(mapcache_context *ctx, mapcache_source *ps
199199
* \private \memberof mapcache_source_mapserver
200200
* \sa mapcache_source::configuration_parse()
201201
*/
202-
void _mapcache_source_mapserver_configuration_parse_xml(mapcache_context *ctx, ezxml_t node, mapcache_source *source)
202+
void _mapcache_source_mapserver_configuration_parse_xml(mapcache_context *ctx, ezxml_t node, mapcache_source * source, mapcache_cfg *config)
203203
{
204204
ezxml_t cur_node;
205205
mapcache_source_mapserver *src = (mapcache_source_mapserver*)source;
@@ -247,10 +247,10 @@ mapcache_source* mapcache_source_mapserver_create(mapcache_context *ctx)
247247
}
248248
mapcache_source_init(ctx, &(source->source));
249249
source->source.type = MAPCACHE_SOURCE_MAPSERVER;
250-
source->source.render_map = _mapcache_source_mapserver_render_map;
250+
source->source._render_map = _mapcache_source_mapserver_render_map;
251251
source->source.configuration_check = _mapcache_source_mapserver_configuration_check;
252252
source->source.configuration_parse_xml = _mapcache_source_mapserver_configuration_parse_xml;
253-
source->source.query_info = _mapcache_source_mapserver_query;
253+
source->source._query_info = _mapcache_source_mapserver_query;
254254
return (mapcache_source*)source;
255255
}
256256
#else

scripts/vagrant/mapcache.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ export NUMTHREADS
55

66
cd /vagrant
77

8-
mkdir build_vagrant
8+
mkdir -p build_vagrant
99
cd build_vagrant
10-
cmake -DWITH_MEMCACHE=1 ..
10+
cmake ..
1111

1212
make -j $NUMTHREADS
1313
make install
14+
15+
ldconfig

scripts/vagrant/packages.sh

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
#!/bin/sh
22

3-
sed -i 's#deb http://us.archive.ubuntu.com/ubuntu/#deb mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list
4-
53
export DEBIAN_FRONTEND=noninteractive
64

75
apt-get update
8-
apt-get install -y python-software-properties
9-
add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
10-
apt-get update
11-
apt-get -y upgrade
6+
apt-get install -y cmake apache2
7+
apt-get install -y libcurl4-openssl-dev apache2-dev
8+
apt-get install -y libgdal-dev libfcgi-dev libpixman-1-dev gdal-bin libxml2-utils
129

13-
# install packages we need
14-
apt-get install -q -y build-essential pkg-config cmake libgeos-dev rake vim \
15-
bison flex libgdal1-dev libproj-dev libpng12-dev libjpeg-dev libfcgi-dev \
16-
libcurl4-gnutls-dev apache2-prefork-dev libtiff4-dev libpixman-1-dev \
17-
libsqlite3-dev libmemcached-dev

tests/data/mapcache.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<IfModule mapcache_module>
2+
<Directory /tmp/mc>
3+
Require all granted
4+
</Directory>
5+
MapCacheAlias /mapcache "/tmp/mc/mapcache.xml"
6+
</IfModule>

tests/data/mapcache.load

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LoadModule mapcache_module /usr/lib/apache2/modules/mod_mapcache.so

tests/data/mapcache.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<mapcache>
3+
<source name="global-tif" type="gdal">
4+
<data>/tmp/mc/world.tif</data>
5+
</source>
6+
<cache name="disk" type="disk">
7+
<base>/tmp/mc</base>
8+
</cache>
9+
<tileset name="global">
10+
<cache>disk</cache>
11+
<source>global-tif</source>
12+
<grid maxzoom="17">GoogleMapsCompatible</grid>
13+
<format>JPEG</format>
14+
<metatile>1 1</metatile>
15+
</tileset>
16+
<service type="wmts" enabled="true"/>
17+
<service type="wms" enabled="true"/>
18+
<log_level>debug</log_level>
19+
</mapcache>

0 commit comments

Comments
 (0)