|
| 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 |
0 commit comments