forked from MapServer/MapServer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappveyor.yml
136 lines (121 loc) · 5.95 KB
/
appveyor.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
branches:
except:
- /(cherry-pick-)?backport-\d+-to-/
image: Visual Studio 2022
cache:
- '%LOCALAPPDATA%\pip\Cache'
- '%APPVEYOR_BUILD_FOLDER%\swigwin-4.3.0.zip'
environment:
global:
SWIG_VER: swigwin-4.3.0
TWINE_USERNAME: mapserver
TWINE_PASSWORD:
secure: mHoJHeXdXbBNoDf7MA4ZEg==
# VS 2022
VS_VERSION: Visual Studio 17 2022
matrix:
- platform: x64
Python_ROOT_DIR: c:/python39-x64
- platform: x64
Python_ROOT_DIR: c:/python310-x64
- platform: x64
Python_ROOT_DIR: c:/python311-x64
- platform: x64
Python_ROOT_DIR: c:/python312-x64
- platform: x64
Python_ROOT_DIR: c:/python313-x64
matrix:
fast_finish: true
shallow_clone: false
clone_depth: 5
init:
- net start MSSQL$SQL2019
# we can skip testing Python versions apart from for releases by updating the version below
- ps: |
if ($env:APPVEYOR_REPO_TAG -ne $TRUE) {
if ("c:/python37-x64" -contains $env:Python_ROOT_DIR -eq $TRUE) {
Write-Host "Skipping build, not a tagged release."
Exit-AppVeyorBuild
}
}
build_script:
- ps: Write-Host "Build tags - $env:APPVEYOR_REPO_TAG $env:APPVEYOR_REPO_TAG_NAME"
- rename C:\Python310 Python310_Ignore
- rename C:\Python311 Python311_Ignore
- set "BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER:\=/%"
- if "%platform%" == "x64" SET VS_FULL=%VS_VERSION%
- if "%platform%" == "x64" SET VS_ARCH=x64
- if "%platform%" == "x64" SET SDK=release-1930-x64
- if "%platform%" == "x64" call "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Auxiliary/Build/vcvars64.bat"
- echo "%VS_FULL%"
- if not exist %SWIG_VER%.zip appveyor DownloadFile https://github.com/geographika/python-mapscript/raw/main/%SWIG_VER%.zip
- set SDK_ZIP=%SDK%-dev.zip
- set SDK_URL=http://download.gisinternals.com/sdk/downloads/%SDK_ZIP%
- mkdir sdk
- 7z x %SWIG_VER%.zip -osdk > nul
- cd sdk
- appveyor DownloadFile "%SDK_URL%"
- 7z x "%SDK_ZIP%" > nul
- cd %BUILD_FOLDER%/sdk/%SWIG_VER%/
- set SDK_PREFIX=%BUILD_FOLDER%/sdk/%SDK%
- set SDK_INC=%BUILD_FOLDER%/sdk/%SDK%/include
- set SDK_LIB=%BUILD_FOLDER%/sdk/%SDK%/lib
- set SDK_BIN=%BUILD_FOLDER%/sdk/%SDK%/bin
- set SWIG_EXECUTABLE=%BUILD_FOLDER%/sdk/%SWIG_VER%/swig.exe
- set REGEX_DIR=%BUILD_FOLDER%/sdk/support/regex-0.12
# there is a mismatch between sqlite3 in Python 3.13 and the SDK - ensure the SDK DLL is used by overwriting the DLL in the Python installation
- ps: |
if ($env:Python_ROOT_DIR -eq "c:/python313-x64") {
$sourcePath = Join-Path $env:SDK_BIN "sqlite3.dll"
$targetPath = "c:/python313-x64/DLLs"
Copy-Item -Path $sourcePath -Destination $targetPath -Force
Write-Host "sqlite3.dll successfully copied to $targetPath"
}
- cd %BUILD_FOLDER%
- mkdir build
- cd build
- set PATH=%BUILD_FOLDER%/build/Release;%SDK_BIN%;%PATH%
- set "PROJECT_BINARY_DIR=%BUILD_FOLDER%/build"
- cmake -G "%VS_FULL%" -A %VS_ARCH% .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=%SDK_PREFIX% -DPNG_LIBRARY=%SDK_LIB%/libpng16_static.lib -DHARFBUZZ_INCLUDE_DIR=%SDK_INC%/harfbuzz -DICONV_DLL=%SDK_BIN%/iconv.dll -DFRIBIDI_INCLUDE_DIR=%SDK_INC%/fribidi -DMS_EXTERNAL_LIBS=%SDK_LIB%/harfbuzz.lib;%SDK_LIB%/uriparser.lib -DSVG_LIBRARY=%SDK_LIB%/libsvg.lib -DSVGCAIRO_LIBRARY=%SDK_LIB%/libsvg-cairo.lib -DREGEX_DIR=%REGEX_DIR% -DSWIG_EXECUTABLE=%SWIG_EXECUTABLE% -DPROTOBUFC_COMPILER=%SDK_BIN%/protoc.exe -DPROTOBUFC_LIBRARY=%SDK_LIB%/protobuf-c.lib -DPROTOBUFC_INCLUDE_DIR=%SDK_INC%/protobuf-c -DWITH_CURL=1 -DWITH_KML=1 -DWITH_SVGCAIRO=1 -DWITH_THREAD_SAFETY=1 -DWITH_SOS=1 -DWITH_CLIENT_WFS=1 -DWITH_CLIENT_WMS=1-DWITH_CSHARP=1 -DWITH_PROTOBUFC=1 -DWITH_POSTGIS=0 -DWITH_PERL=0 -DWITH_MSSQL2008=1 -DWITH_PYTHON=1 -DWITH_PHPNG=0 -DWITH_HARFBUZZ=1 -DWITH_PYMAPSCRIPT_ANNOTATIONS=1 -DPROJ_INCLUDE_DIR=%SDK_INC%/proj9 -DPROJ_LIBRARY=%SDK_LIB%/proj9.lib
- cmake --build . --config Release
- cd %BUILD_FOLDER%/build
# set the MapScript custom environment variable for python 3.8+
- set MAPSERVER_DLL_PATH=%BUILD_FOLDER%/build/Release;%SDK_BIN%
- set PROJ_DATA=%SDK_BIN%/proj9/SHARE
# ensure the GIF driver is available for tests
- set GDAL_DRIVER_PATH=%SDK_BIN%/gdal/plugins
# check the mapserver exe can run
- mapserv -v
- cmake --build . --target pythonmapscript-wheel --config Release
before_test:
- set PATH=%SDK_BIN%/gdal/apps;%PATH%;
- cd %BUILD_FOLDER%/msautotest
- "./mssql/create_mssql_db.bat"
- "%Python_ROOT_DIR%/python -m pip install -U -r requirements.txt"
- "%Python_ROOT_DIR%/python -m pip install --no-index --find-links=file://%BUILD_FOLDER%/build/src/mapscript/python/Release/dist mapscript"
test_script:
- cd %BUILD_FOLDER%/msautotest/mssql
- "%Python_ROOT_DIR%/python run_test.py"
- cd %BUILD_FOLDER%/msautotest/mspython
- "%Python_ROOT_DIR%/python run_all_tests.py"
after_test:
- cd %BUILD_FOLDER%
- 7z a mapserver.zip ./build/* > nul
# Uncomment to enable debugging on the server
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
artifacts:
- path: mapserver.zip
name: mapserver
type: zip
deploy_script:
- ps: |
if ($env:APPVEYOR_REPO_TAG -ne $TRUE -or ($env:APPVEYOR_REPO_TAG_NAME -cSplit "-").Count -ne 4) { return }
if ($env:Python_ROOT_DIR -eq "c:/python310-x64") {
Write-Host "Deploying Python source distribution to PyPI. Tag $env:APPVEYOR_REPO_TAG_NAME"
cd $env:APPVEYOR_BUILD_FOLDER\build\src\mapscript\python\Release
& "$env:Python_ROOT_DIR/python" setup.py sdist
}
Write-Host "Deploying Python Wheel to PyPI. Tag $env:APPVEYOR_REPO_TAG_NAME"
& "$env:Python_ROOT_DIR/python" -W ignore -m pip --disable-pip-version-check install twine
& "$env:Python_ROOT_DIR/python" -m twine upload --repository-url https://upload.pypi.org/legacy/ --skip-existing $env:APPVEYOR_BUILD_FOLDER\build\src\mapscript\python\Release\dist\*