forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
714 lines (691 loc) · 37.3 KB
/
cmake_builds.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
# build GDAL library and to run test with CMake
name: Build and test with CMake
on:
push:
paths-ignore:
- 'doc/**'
- 'docker/**'
branches-ignore:
- 'backport**'
- 'dependabot**'
pull_request:
paths-ignore:
- 'doc/**'
- 'docker/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
env:
CMAKE_UNITY_BUILD: OFF
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
build-linux-ubuntu-focal:
runs-on: ubuntu-20.04
env:
CMAKE_OPTIONS: -DPython_LOOKUP_VERSION=3.8 -DUSE_CCACHE=ON -DSWIG_REGENERATE_PYTHON=ON
cache-name: cmake-ubuntu-focal
steps:
- name: Checkout GDAL
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Setup cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}
${{ runner.os }}-${{ env.cache-name }}
- name: Install dependency
run: |
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y -q bison libaec-dev libjpeg-dev libgif-dev liblzma-dev libzstd-dev libgeos-dev git \
libcurl4-gnutls-dev libproj-dev libxml2-dev libxerces-c-dev libnetcdf-dev netcdf-bin \
libpoppler-dev libpoppler-private-dev gpsbabel libhdf4-alt-dev libhdf5-serial-dev libpodofo-dev poppler-utils \
libfreexl-dev unixodbc-dev libwebp-dev libepsilon-dev liblcms2-2 libcrypto++-dev libkml-dev \
libmysqlclient-dev libarmadillo-dev wget libfyba-dev libjsoncpp-dev libexpat1-dev \
libclc-dev ocl-icd-opencl-dev libsqlite3-dev sqlite3-pcre libpcre3-dev libspatialite-dev libsfcgal-dev fossil libcairo2-dev libjson-c-dev libdeflate-dev liblz4-dev libblosc-dev libarchive-dev \
libqhull-dev libcfitsio-dev libogdi-dev libopenjp2-7-dev libheif-dev \
python3-dev libpython3-dev libpython3.8-dev python3.8-dev python3-numpy python3-lxml pyflakes python3-setuptools python3-pip python3-venv \
python3-pytest swig doxygen texlive-latex-base make cppcheck ccache g++ \
libpq-dev libpqtypes-dev postgresql-12 postgresql-12-postgis-3 postgresql-client-12 postgresql-12-postgis-3-scripts
# MSSQL: client side
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev
# HANA: client side
# Install hdbsql tool
curl -v -j -k -s -L -H "Cookie: eula_3_2_agreed=tools.hana.ondemand.com/developer-license-3_2.txt" https://tools.hana.ondemand.com/additional/hanaclient-latest-linux-x64.tar.gz --output hanaclient-latest-linux-x64.tar.gz \
&& tar -xvf hanaclient-latest-linux-x64.tar.gz \
&& sudo mkdir /usr/sap \
&& sudo ./client/hdbinst -a client --sapmnt=/usr/sap \
&& rm -rf client \
&& rm hanaclient*
export PATH=/usr/sap/hdbclient:$PATH
# Download and compile odbc-cpp-wrapper
sudo apt-get install -y -q cmake
wget https://github.com/SAP/odbc-cpp-wrapper/archive/refs/tags/v1.1.tar.gz -O odbc-cpp-wrapper.tar.gz \
&& mkdir odbc-cpp-wrapper \
&& tar -xvf odbc-cpp-wrapper.tar.gz -C odbc-cpp-wrapper --strip-components=1 \
&& mkdir odbc-cpp-wrapper/build \
&& cd odbc-cpp-wrapper/build \
&& /usr/bin/cmake .. \
&& make -j 2 \
&& sudo make install \
&& cd ../.. \
&& rm -rf odbc-cpp-wrapper
sudo ldconfig
#
# Install Arrow C++
sudo apt-get install -y -V ca-certificates lsb-release wget
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt-get install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb
sudo apt-get update
sudo apt-get install -y -V libarrow-dev libparquet-dev libarrow-dataset-dev
#
# Workaround bug in ogdi packaging
sudo ln -s /usr/lib/ogdi/libvrf.so /usr/lib
#
python3 -m pip install -U pip wheel setuptools numpy importlib_metadata
python3 -m pip install -r $GITHUB_WORKSPACE/autotest/requirements.txt
- name: Build libjxl
run: |
# Build libjxl
# libjxl being still unstable, if the main branch fails to compile/test
# you can replace JXL_TREEISH=main by JXL_TREEISH=sha1_of_known_working_commit
JXL_TREEISH=main
git clone https://github.com/libjxl/libjxl.git --recursive \
&& cd libjxl \
&& git checkout ${JXL_TREEISH} \
&& mkdir build \
&& cd build \
&& sudo apt-get install -y --no-install-recommends libgflags-dev libbrotli-dev \
&& /usr/bin/cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJPEGXL_FORCE_SYSTEM_BROTLI:BOOL=ON -DJPEGXL_ENABLE_JPEGLI_LIBJPEG=OFF -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j$(nproc) \
&& sudo make -j$(nproc) install \
&& cd ../.. \
&& rm -rf libjxl
- name: Build libQB3
run: |
# Build libQB3
# Used by the MRF driver
git clone https://github.com/lucianpls/QB3.git \
&& mkdir QB3/QB3lib/build \
&& cd QB3/QB3lib/build \
&& /usr/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j$(nproc) \
&& sudo make -j$(nproc) install \
&& cd ../../.. \
&& rm -rf QB3
- name: Build libbasisu
run: |
# Used by the BASISU and KTX2 drivers
git clone -b cmake https://github.com/rouault/basis_universal.git \
&& mkdir basis_universal/build \
&& cd basis_universal/build \
&& /usr/bin/cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. \
&& make -j$(nproc) \
&& sudo make -j$(nproc) install \
&& cd ../..\
&& rm -rf basis_universal
- name: Install pdfium
run: |
wget -q https://github.com/rouault/pdfium_build_gdal_3_10/releases/download/pdfium_6677_v1/install-ubuntu2004-rev6677.tar.gz \
&& tar -xzf install-ubuntu2004-rev6677.tar.gz \
&& sudo chown -R root:root install \
&& sudo mv install/lib/* /usr/lib/ \
&& sudo mv install/include/* /usr/include/ \
&& sudo rm -rf install-ubuntu2004-rev6677.tar.gz install \
&& sudo apt-get update -y \
&& sudo apt-get install -y --fix-missing --no-install-recommends liblcms2-dev
- name: Configure ccache
run: |
echo CCACHE_BASEDIR=$PWD >> ${GITHUB_ENV}
echo CCACHE_DIR=$PWD/.ccache >> ${GITHUB_ENV}
echo CCACHE_MAXSIZE=250M >> ${GITHUB_ENV}
ccache -z
working-directory: ${{ github.workspace }}
- name: Configure
run: |
export PATH=$CMAKE_DIR:/usr/local/bin:/usr/bin:/bin # Avoid CMake config from brew etc.
mkdir -p $GITHUB_WORKSPACE/superbuild
cd $GITHUB_WORKSPACE/superbuild
printf "cmake_minimum_required(VERSION 3.16)\nproject(test)\nenable_testing()\nadd_subdirectory(gdal)" > CMakeLists.txt
ln -s .. gdal
mkdir build
cd build
cmake ${CMAKE_OPTIONS} -Werror=dev -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-gdal -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -DCMAKE_C_FLAGS=-Werror -DCMAKE_CXX_FLAGS=-Werror -DGDAL_USE_PUBLICDECOMPWT:BOOL=ON -DPUBLICDECOMPWT_URL=https://github.com/rouault/PublicDecompWT .. -DWERROR_DEV_FLAG="-Werror=dev"
- name: Build
run: |
cmake --build $GITHUB_WORKSPACE/superbuild/build -- -j$(nproc)
env:
GIT_LFS_SKIP_SMUDGE: 1 # for PublicDecompWT github repository clone
- name: Build fake ossfuzz fuzzers
run: |
cd $GITHUB_WORKSPACE/superbuild/build
g++ -c $GITHUB_WORKSPACE/fuzzers/fuzzingengine.cpp
ar r libFuzzingEngine.a fuzzingengine.o
CXX=g++ CXXFLAGS="${CXXFLAGS} -I$PWD/gdal/port -I$PWD/gdal/gcore -L$PWD" LIBGDAL="-L$PWD/gdal -lgdal" SRC=/tmp OUT=/tmp $GITHUB_WORKSPACE/fuzzers/build_google_oss_fuzzers.sh
OUT=/tmp $GITHUB_WORKSPACE/fuzzers/build_seed_corpus.sh
- name: test autotest/cpp/gdallimits
run: |
sudo apt-get install -y numactl
#
echo "Limits without restrictions:"
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/superbuild/build $GITHUB_WORKSPACE/superbuild/build/gdal/autotest/cpp/gdallimits
#
echo "Limits with ulimit -m 100000; numactl -C 0"
(ulimit -m 100000; LD_LIBRARY_PATH=$GITHUB_WORKSPACE/superbuild/build numactl -C 0 $GITHUB_WORKSPACE/superbuild/build/gdal/autotest/cpp/gdallimits) > out.txt
cat out.txt
grep "CPLGetNumCPUs = 1" out.txt >/dev/null
grep "CPLGetUsablePhysicalRAM = 97 MB" out.txt >/dev/null
- name: test (with command targets)
run: |
cmake --build $GITHUB_WORKSPACE/superbuild/build --target quicktest -- -j$(nproc)
- name: test (with ctest)
run: |
cd $GITHUB_WORKSPACE/superbuild/build
ctest -V
- name: install and uninstall
run: |
cmake --build $GITHUB_WORKSPACE/superbuild/build --target install -- -j$(nproc)
cmake --build $GITHUB_WORKSPACE/superbuild/build --target uninstall
find $GITHUB_WORKSPACE/install-gdal || /bin/true
- name: install
run: |
export PATH=$CMAKE_DIR:/usr/local/bin:/usr/bin:/bin # Avoid CMake config from brew etc.
touch $GITHUB_WORKSPACE/man/man1/gdalinfo.1
touch $GITHUB_WORKSPACE/man/man1/gdaladdo.1
(cd $GITHUB_WORKSPACE/superbuild/build; cmake ..)
cmake --build $GITHUB_WORKSPACE/superbuild/build --target install -- -j$(nproc)
test -f $GITHUB_WORKSPACE/install-gdal/share/man/man1/gdalinfo.1
test -f $GITHUB_WORKSPACE/install-gdal/share/man/man1/gdaladdo.1
export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib
$GITHUB_WORKSPACE/install-gdal/bin/gdalinfo --version
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/python3.8/site-packages python3 -c "from osgeo import gdal;print(gdal.VersionInfo(None))"
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/python3.8/site-packages python3 $GITHUB_WORKSPACE/scripts/check_doc.py
- name: CMake with rpath
run: |
export PATH=$CMAKE_DIR:/usr/local/bin:/usr/bin:/bin # Avoid CMake config from brew etc.
(cd $GITHUB_WORKSPACE/superbuild/build; cmake .. "-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-gdal-with-rpath" "-DCMAKE_INSTALL_RPATH=$GITHUB_WORKSPACE/install-gdal-with-rpath/lib")
cmake --build $GITHUB_WORKSPACE/superbuild/build --target install -- -j$(nproc)
# For some reason, during the install phase of above invocation, the Python bindings are rebuilt after the build phase, and without the rpath... Can't reproduce that locally
# PYTHONPATH=$GITHUB_WORKSPACE/install-gdal-with-rpath/lib/python3.8/site-packages python -c "from osgeo import gdal;print(gdal.VersionInfo(None))"
- name: Rerun using Mono
run: |
export PATH=$CMAKE_DIR:/usr/local/bin:/usr/bin:/bin # Avoid CMake config from brew etc.
cd $GITHUB_WORKSPACE/superbuild/build
rm -rf swig/csharp
cmake ${CMAKE_OPTIONS} -DCSHARP_MONO=ON -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-gdal -UCMAKE_INSTALL_RPATH -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -DCMAKE_C_FLAGS=-Werror -DCMAKE_CXX_FLAGS=-Werror ..
cmake --build $GITHUB_WORKSPACE/superbuild/build --target install -- -j$(nproc)
# Below fails with errors like 'System.InvalidProgramException: Invalid IL code in CreateData:Main (string[]): IL_00c4: callvirt 0x0a00000c'
# ctest -V -R "^csharp.*"
- name: Standalone Python bindings build from source
run: |
(cd $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python && python setup.py sdist)
mv $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python/dist/gdal-*.tar.gz gdal-python.tar.gz
mv $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python gdal-swig-python
python3 -m venv myvenv
source myvenv/bin/activate
# Set PATH so that gdal-config is found
PATH=$GITHUB_WORKSPACE/install-gdal/bin:$PATH pip install gdal-python.tar.gz[numpy]
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib python -c "from osgeo import gdal_array"
which gdal_edit
cp $GITHUB_WORKSPACE/autotest/gcore/data/byte.tif .
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib ldd myvenv/lib/python3.8/site-packages/osgeo/_gdal.cpython-38-x86_64-linux-gnu.so
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib gdal_edit byte.tif -mo FOO=BAR
rm -f myvenv/bin/gdal_edit
rm -f myvenv/bin/gdal_edit.py
- name: Standalone gdal-utils package from wheel
run: |
mv gdal-swig-python $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python
(cd $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python/gdal-utils && python setup.py bdist_wheel)
mv $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python/gdal-utils/dist/*.whl gdal_utils-X.Y.Z.T-py3-none-any.whl
rm -rf $GITHUB_WORKSPACE/superbuild/build/gdal/swig/python
python3 -m venv myvenv
source myvenv/bin/activate
# Set PATH so that gdal-config is found
PATH=$GITHUB_WORKSPACE/install-gdal/bin:$PATH pip install gdal_utils-X.Y.Z.T-py3-none-any.whl
which gdal_edit
cp $GITHUB_WORKSPACE/autotest/gcore/data/byte.tif .
LD_LIBRARY_PATH=$GITHUB_WORKSPACE/install-gdal/lib gdal_edit byte.tif -mo FOO=BAR
pip uninstall -y gdal-utils
- name: Test post-install usage (with pkg-config)
run: |
./autotest/postinstall/test_pkg-config.sh $GITHUB_WORKSPACE/install-gdal
- name: Test post-install usage (with gdal-config)
run: |
./autotest/postinstall/test_gdal-config.sh $GITHUB_WORKSPACE/install-gdal
- name: Test post-install usage (with CMake)
run: |
./autotest/postinstall/test_cmake.sh $GITHUB_WORKSPACE/install-gdal
- name: Rerun with static linkage
run: |
export PATH=$CMAKE_DIR:/usr/local/bin:/usr/bin:/bin # Avoid CMake config from brew etc.
cd $GITHUB_WORKSPACE/superbuild/build
rm -f CMakeCache.txt
cmake ${CMAKE_OPTIONS} .. \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DCSHARP_MONO=OFF \
-DGDAL_USE_HDF4=OFF \
-DGDAL_USE_HDF5=OFF \
-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-gdal-static
cmake --build $GITHUB_WORKSPACE/superbuild/build --target install -- -j$(nproc)
- name: Test post-install usage (static, with pkg-config)
run: |
./autotest/postinstall/test_pkg-config.sh $GITHUB_WORKSPACE/install-gdal-static --static
- name: Test post-install usage (static, with gdal-config)
run: |
./autotest/postinstall/test_gdal-config.sh $GITHUB_WORKSPACE/install-gdal-static --static
- name: Test post-install usage (static, with CMake)
run: |
./autotest/postinstall/test_cmake.sh $GITHUB_WORKSPACE/install-gdal-static --static
- name: ccache statistics
run: ccache -s
build-windows-msys2-mingw:
runs-on: windows-2022
env:
generator: MinGW Makefiles
cache-name: cmake-mingw64
defaults:
run:
shell: msys2 {0}
steps:
# To avoid git clone to mess with the line endings of GDAL autotest data
# files that look like text, but should be handled as binary content
- name: Set git core.autocrlf to false
shell: bash -l {0}
run: |
git config --global core.autocrlf false
- name: Checkout GDAL
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Install development packages
uses: msys2/setup-msys2@ddf331adaebd714795f1042345e6ca57bd66cea8 # v2.24.1
with:
msystem: MINGW64
update: true
# Disable mingw-w64-x86_64-crypto++ as it crashes at runtime on eedai_3 test. Likely a build issue with crypto++ itself
install: |
base-devel git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache
mingw-w64-x86_64-pcre mingw-w64-x86_64-xerces-c mingw-w64-x86_64-zstd mingw-w64-x86_64-libarchive
mingw-w64-x86_64-geos mingw-w64-x86_64-libspatialite mingw-w64-x86_64-proj
mingw-w64-x86_64-cgal mingw-w64-x86_64-libfreexl mingw-w64-x86_64-hdf5 mingw-w64-x86_64-netcdf mingw-w64-x86_64-poppler mingw-w64-x86_64-podofo mingw-w64-x86_64-postgresql
mingw-w64-x86_64-libgeotiff mingw-w64-x86_64-libpng mingw-w64-x86_64-libtiff mingw-w64-x86_64-openjpeg2
mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-numpy mingw-w64-x86_64-python-pytest mingw-w64-x86_64-python-setuptools mingw-w64-x86_64-python-lxml mingw-w64-x86_64-swig mingw-w64-x86_64-python-psutil mingw-w64-x86_64-blosc mingw-w64-x86_64-libavif
- name: Setup cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache
with:
path: ${{ github.workspace }}\.ccache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}
${{ runner.os }}-${{ env.cache-name }}
- name: Configure ccache
run: |
echo CCACHE_BASEDIR=$PWD >> ${GITHUB_ENV}
echo CCACHE_DIR=$PWD/.ccache >> ${GITHUB_ENV}
echo CCACHE_MAXSIZE=250M >> ${GITHUB_ENV}
ccache -z
working-directory: ${{ github.workspace }}
- name: populate JAVA_HOME
run: |
echo "JAVA_HOME=$JAVA_HOME_11_X64" >> ${GITHUB_ENV}
- name: Install python dependencies for autotest
run: |
# One of the dependencies of jsonschema 4.18 is rpds_py which requires a Rust compiler
python -m pip install "jsonschema<4.18"
python -m pip install -r autotest/requirements.txt
# Disable mySQL since C:/mysql/lib/mysqlclient.lib (unrelated to msys) is found, which causes linking issues
# Set explicitly CMAKE_C|CXX_COMPILER otherwise C:/ProgramData/chocolatey/bin/gcc.exe would be used
- name: Configure
run: |
cmake -S . -B build -G "${generator}" -Werror=dev \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_C_FLAGS=-Werror \
-DCMAKE_CXX_FLAGS=-Werror \
-DWERROR_DEV_FLAG=-Werror=dev \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH=/mingw64 \
-DCMAKE_INSTALL_PREFIX=$PWD/install-gdal \
"-DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD}" \
-DGDAL_USE_MYSQL:BOOL=OFF
working-directory: ${{ github.workspace }}
- name: Build
run: cmake --build build -j 3
working-directory: ${{ github.workspace }}
- name: test
run: cmake --build build --target quicktest
working-directory: ${{ github.workspace }}
- name: test (with ctest)
run: |
ctest --test-dir $GITHUB_WORKSPACE/build -C Release -V -j 3
env:
BUILD_NAME: mingw64
SKIP_OGR_GMLAS_HUGE_PROCESSING_TIME: YES
SKIP_OGR_GMLAS_HTTP_RELATED: YES
SKIP_TIFF_JPEG12: YES
SKIP_VSIRAR: YES
working-directory: ${{ github.workspace }}
- name: Install
run: cmake --build build --target install -j 3
working-directory: ${{ github.workspace }}
- name: Test post-install usage (with pkg-config)
run: ./autotest/postinstall/test_pkg-config.sh $PWD/install-gdal
working-directory: ${{ github.workspace }}
- name: ccache statistics
run: ccache -s
build-windows-conda:
runs-on: windows-2022
env:
architecture: x64
#generator: Visual Studio 17 2022
generator: Ninja
cache-name: cmake-msvc
steps:
# To avoid git clone to mess with the line endings of GDAL autotest data
# files that look like text, but should be handled as binary content
- name: Set git core.autocrlf to false
run: |
git config --global core.autocrlf false
- name: Checkout GDAL
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: populate JAVA_HOME
shell: pwsh
run: |
echo "JAVA_HOME=$env:JAVA_HOME_11_X64" >> %GITHUB_ENV%
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
activate-environment: gdalenv
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
auto-update-conda: true
use-only-tar-bz2: false
- name: Install dependency
shell: bash -l {0}
run: |
conda install --yes --quiet curl libiconv icu python=3.10 swig numpy pytest pytest-env pytest-benchmark filelock zlib lxml jsonschema setuptools
# FIXME: remove libnetcdf=4.9.2=nompi_h5902ca5_107 pinning as soon as https://github.com/conda-forge/libnetcdf-feedstock/issues/182 is resolved
conda install --yes --quiet proj geos hdf4 hdf5 kealib \
libnetcdf=4.9.2=nompi_h5902ca5_107 openjpeg poppler libtiff libpng xerces-c expat libxml2 kealib json-c \
cfitsio freexl geotiff libjpeg-turbo libpq libspatialite libwebp-base pcre pcre2 postgresql \
sqlite tiledb zstd cryptopp cgal doxygen librttopo libkml openssl xz \
openjdk ant qhull armadillo blas blas-devel libblas libcblas liblapack liblapacke blosc libarchive \
arrow-cpp pyarrow libaec libheif libavif cmake
- name: Check CMake version
shell: bash -l {0}
run: |
cmake --version
- name: Install pdfium
shell: bash -l {0}
run: |
curl -LOs https://github.com/rouault/pdfium_build_gdal_3_10/releases/download/pdfium_6677_v1/install-win10-vs2019-x64-rev6677.zip
unzip install-win10-vs2019-x64-rev6677.zip
mv install install-pdfium
- name: Remove conflicting libraries
shell: bash -l {0}
run: |
rm -rf C:/Strawberry || /bin/true
rm -rf "C:/Program Files/OpenSSL/lib" || /bin/true
- name: Configure
shell: bash -l {0}
# Disable MySQL because of "error LNK2038: mismatch detected for '_MSC_VER': value '1800' doesn't match value '1900' in ogrmysqldatasource.obj" and other errors
# Note that the leading space in CMAKE_C/CXX_FLAGS=" /WX" is due to using Bash on Windows that would
# otherwise interpret /bla has a file relative to the Bash root directory and would replace it by a path like c:\Program Files\git\WX
# BUILD_JAVA_BINDINGS=OFF because we get "Error occurred during initialization of VM. Corrupted ZIP library: C:\Miniconda\envs\gdalenv\Library\bin\zip.dll" when running java. Not reproducible on a standard VM
# Build PDF driver as plugin due to the PDFium build including libopenjp2 symbols which would conflict with external libopenjp2
run: |
mkdir -p $GITHUB_WORKSPACE/build
cmake -G "${generator}" -Werror=dev "-DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-gdal" "-DUSE_CCACHE=ON" "-DCMAKE_PREFIX_PATH=${CONDA}/envs/gdalenv" -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build" -DGDAL_ENABLE_PLUGINS:BOOL=ON -DGDAL_ENABLE_PLUGINS_NO_DEPS:BOOL=ON -DGDAL_USE_PUBLICDECOMPWT:BOOL=ON -DPUBLICDECOMPWT_URL=https://github.com/rouault/PublicDecompWT -DBUILD_JAVA_BINDINGS=OFF -DBUILD_CSHARP_BINDINGS=ON -DGDAL_USE_MYSQL:BOOL=OFF -DCMAKE_C_FLAGS=" /WX" -DCMAKE_CXX_FLAGS=" /WX" -DWERROR_DEV_FLAG="-Werror=dev" -DCMAKE_BUILD_TYPE=Release -DPDFIUM_ROOT=$GITHUB_WORKSPACE/install-pdfium -DGDAL_ENABLE_DRIVER_PDF_PLUGIN:BOOL=ON -DCMAKE_UNITY_BUILD=ON -DOGR_ENABLE_DRIVER_TAB_PLUGIN=OFF -DOGR_ENABLE_DRIVER_GEOJSON_PLUGIN=OFF
- name: Build
shell: bash -l {0}
run: cmake --build $GITHUB_WORKSPACE/build --config Release -j 2
env:
GIT_LFS_SKIP_SMUDGE: 1 # for PublicDecompWT github repository clone
- name: test
shell: bash -l {0}
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target quicktest
- name: test (with ctest)
shell: bash -l {0}
run: |
ctest --test-dir $GITHUB_WORKSPACE/build -C Release -V -j 3
env:
SKIP_OGR_GMLAS_HUGE_PROCESSING_TIME: YES
SKIP_OGR_GMLAS_HTTP_RELATED: YES
SKIP_GDAL_HTTP_SSL_VERIFYSTATUS: YES
BUILD_NAME: "build-windows-conda"
- name: Install
shell: bash -l {0}
run: |
cmake --build $GITHUB_WORKSPACE/build --config Release --target install
export PATH=$GITHUB_WORKSPACE/install-gdal/bin:$PATH
gdalinfo --version
python -VV
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/site-packages python -c "from osgeo import gdal;print(gdal.VersionInfo(None))"
export PATH=$GITHUB_WORKSPACE/install-gdal/Scripts:$PATH
PYTHONPATH=$GITHUB_WORKSPACE/install-gdal/lib/site-packages gdal_edit --version
- name: Check the build includes the expected drivers
shell: bash -l {0}
run: |
export PATH=$GITHUB_WORKSPACE/install-gdal/bin:$PATH
gdalinfo --formats > found_formats.txt
ogrinfo --formats >> found_formats.txt
cat found_formats.txt
cat $GITHUB_WORKSPACE/.github/workflows/windows_conda_expected_gdalinfo_formats.txt $GITHUB_WORKSPACE/.github/workflows/windows_conda_expected_ogrinfo_formats.txt > expected_formats.txt
dos2unix expected_formats.txt
dos2unix found_formats.txt
diff -u expected_formats.txt found_formats.txt
- name: Show gdal.pc
shell: bash -l {0}
run: cat $GITHUB_WORKSPACE/build/gdal.pc
- name: Test python setup.py install
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/build/swig/python
python setup.py install
build-windows-minimum:
runs-on: windows-2022
env:
architecture: x64
generator: Visual Studio 17 2022
GDAL_PYTHON_BINDINGS_WITHOUT_NUMPY: YES
steps:
# To avoid git clone to mess with the line endings of GDAL autotest data
# files that look like text, but should be handled as binary content
- name: Set git core.autocrlf to false
run: |
git config --global core.autocrlf false
- name: Checkout GDAL
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
activate-environment: gdalenv
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
auto-update-conda: true
use-only-tar-bz2: false
- name: Install dependency
shell: bash -l {0}
run: |
conda install --yes --quiet proj pytest pytest-env pytest-benchmark filelock lxml cmake setuptools
- name: Check CMake version
shell: bash -l {0}
run: |
cmake --version
- name: Configure
shell: bash -l {0}
run: |
mkdir -p $GITHUB_WORKSPACE/build
cmake -A ${architecture} -G "${generator}" "-DCMAKE_PREFIX_PATH=${CONDA}/envs/gdalenv" -Werror=dev "-DCMAKE_CXX_COMPILER_LAUNCHER=clcache" -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build" -DCMAKE_C_FLAGS=" /WX" -DCMAKE_CXX_FLAGS=" /WX" -DGDAL_USE_EXTERNAL_LIBS:BOOL=OFF -DWERROR_DEV_FLAG="-Werror=dev"
- name: Build
shell: bash -l {0}
run: cmake --build $GITHUB_WORKSPACE/build --config RelWithDebInfo -j 2
- name: Configure with even less dependencies
shell: bash -l {0}
run: |
rm -f build/CMakeCache.txt
cmake -A ${architecture} -G "${generator}" "-DCMAKE_PREFIX_PATH=${CONDA}/envs/gdalenv" -Werror=dev "-DCMAKE_CXX_COMPILER_LAUNCHER=clcache" -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build" -DCMAKE_C_FLAGS=" /WX" -DCMAKE_CXX_FLAGS=" /WX" -DGDAL_USE_EXTERNAL_LIBS:BOOL=OFF -DGDAL_USE_PNG_INTERNAL=OFF -DGDAL_USE_JPEG_INTERNAL=OFF -DGDAL_USE_JPEG12_INTERNAL=OFF -DGDAL_USE_GIF_INTERNAL=OFF -DGDAL_USE_LERC_INTERNAL=OFF -DGDAL_USE_LERCV1_INTERNAL=OFF -DGDAL_USE_QHULL_INTERNAL=OFF -DGDAL_USE_OPENCAD_INTERNAL=OFF -DWERROR_DEV_FLAG="-Werror=dev"
- name: Configure with even less dependencies, and disabling all optional drivers
shell: bash -l {0}
run: |
rm -f build/CMakeCache.txt
cmake -A ${architecture} -G "${generator}" "-DCMAKE_PREFIX_PATH=${CONDA}/envs/gdalenv" -Werror=dev "-DCMAKE_CXX_COMPILER_LAUNCHER=clcache" -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build" -DCMAKE_C_FLAGS=" /WX" -DCMAKE_CXX_FLAGS=" /WX" -DGDAL_USE_EXTERNAL_LIBS:BOOL=OFF -DGDAL_USE_PNG_INTERNAL=OFF -DGDAL_USE_JPEG_INTERNAL=OFF -DGDAL_USE_JPEG12_INTERNAL=OFF -DGDAL_USE_GIF_INTERNAL=OFF -DGDAL_USE_LERC_INTERNAL=OFF -DGDAL_USE_LERCV1_INTERNAL=OFF -DGDAL_USE_QHULL_INTERNAL=OFF -DGDAL_USE_OPENCAD_INTERNAL=OFF -DGDAL_BUILD_OPTIONAL_DRIVERS=OFF -DOGR_BUILD_OPTIONAL_DRIVERS=OFF -DGDAL_ENABLE_DRIVER_DERIVED=ON -DWERROR_DEV_FLAG="-Werror=dev"
- name: Build
shell: bash -l {0}
run: cmake --build $GITHUB_WORKSPACE/build --config RelWithDebInfo -j 2
- name: Re-enable shapefile driver (otherwise lots of python tests would fail)
shell: bash -l {0}
run: |
cmake -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build" -DOGR_ENABLE_DRIVER_SHAPE=ON -DOGR_ENABLE_DRIVER_SHAPE_PLUGIN=ON
- name: Build
shell: bash -l {0}
run: cmake --build $GITHUB_WORKSPACE/build --config RelWithDebInfo -j 2
# Works around https://github.com/actions/runner-images/issues/10055
- name: Remove conflicting libraries
shell: bash -l {0}
run: |
find "C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk" -name "msvcp140.dll" -exec rm {} \;
- name: test (with ctest)
shell: bash -l {0}
run: |
# gnm_test has suddenly started failing around June 16th 2024
# Related to image windows-latest 20240603.1.0 / actions/runner-images#10004
echo "def test_dummy(): pass" > $GITHUB_WORKSPACE/autotest/gnm/gnm_test.py
ctest --test-dir $GITHUB_WORKSPACE/build -C RelWithDebInfo -V -j 3
env:
SKIP_GDAL_HTTP_SSL_VERIFYSTATUS: YES
BUILD_NAME: "build-windows-minimum"
- name: Show gdal.pc
shell: bash -l {0}
run: cat $GITHUB_WORKSPACE/build/gdal.pc
build-mac:
# M1 MacOS runner: https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/
runs-on: macOS-14
env:
# Disable Arrow/Parquet because the VM provides libraries in /usr/local/lib/
# that cause Illegal instruction error when running tests. I suspect the
# Arrow/Parquet libraries to be built with AVX2 support but the VM worker
# doesn't support it.
# Disable use of libkml since boost headers cannot be found
# Disable ODBC since the postinstall checks don't manage to find sql.h
CMAKE_OPTIONS: -DCFITSIO_ROOT=/opt/homebrew/Cellar/cfitsio -DPoppler_ROOT=/opt/homebrew/Cellar/poppler -DPROJ_ROOT=/opt/homebrew/Cellar/proj -DSPATIALITE_ROOT=/opt/homebrew/Cellar/libspatialite -DPostgreSQL_ROOT=/opt/homebrew/Cellar/libpq -DEXPAT_ROOT=/opt/homebrew/Cellar/expat -DXercesC_ROOT=/opt/homebrew/Cellar/xerces-c -DSQLite3_ROOT=/opt/homebrew/Cellar/sqlite -DOpenSSL_ROOT=/opt/homebrew/Cellar/openssl -DPNG_ROOT=/opt/homebrew/Cellar/libpng -DJPEG_ROOT=/opt/homebrew/Cellar/jpeg-turbo -DEXPECTED_JPEG_LIB_VERSION=80 -DOpenJPEG_ROOT=/opt/homebrew/Cellar/openjpeg -DCURL_ROOT=/opt/homebrew/Cellar/curl -DGDAL_USE_LIBKML=OFF -DGDAL_USE_ODBC=OFF
cache-name: cmake-macos
steps:
- name: Setup xcode
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: 14.3
- name: Checkout GDAL
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Setup cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
id: cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}
${{ runner.os }}-${{ env.cache-name }}
- run: |
cmake --version
- name: Install dependency
run: |
rm -rf /opt/homebrew/lib/node_modules # conflicts with node@18 from brew
brew update
brew outdated
brew install --overwrite python@3.11 python@3.12
brew install postgresql || brew link postgresql
brew install pkg-config freexl libxml2 libspatialite geos proj libgeotiff openjpeg giflib libaec postgis poppler doxygen unixodbc jpeg-turbo aom jpeg-xl libheif libarchive libkml boost
brew install ccache swig
brew link --force sqlite
# gdal is automatically installed as a dependency for postgis
brew uninstall --ignore-dependencies gdal
# Workaround for https://github.com/Homebrew/homebrew-core/pull/170959#issuecomment-2379606442
sed -i .bak 's/hdf5_hl;hdf5;/hdf5_hl-shared;hdf5-shared;/g' "$(brew --prefix netcdf)/lib/cmake/netCDF/netCDFTargets.cmake"
- name: Configure ccache
run: |
echo CCACHE_BASEDIR=$PWD >> ${GITHUB_ENV}
echo CCACHE_DIR=$PWD/.ccache >> ${GITHUB_ENV}
echo CCACHE_MAXSIZE=250M >> ${GITHUB_ENV}
ccache -z
working-directory: ${{ github.workspace }}
- name: Configure
run: |
mkdir -p $GITHUB_WORKSPACE/build
export PKG_CONFIG_PATH=/opt/homebrew/Cellar/libxml2/lib/pkgconfig
# FIXME: remove -DBUILD_PYTHON_BINDINGS=OFF. Python tests fail with "ModuleNotFoundError: No module named '_gdal'" with macos-12
cmake -Werror=dev -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install-gdal ${CMAKE_OPTIONS} -DCMAKE_C_FLAGS=-Werror -DCMAKE_CXX_FLAGS=-Werror -DUSE_CCACHE=ON -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build" -DWERROR_DEV_FLAG="-Werror=dev" -DBUILD_PYTHON_BINDINGS=OFF
#$(cat $GITHUB_WORKSPACE/build/python_executable.txt) -m pip install --user -r $GITHUB_WORKSPACE/autotest/requirements.txt
- name: Build
run: |
cmake --build $GITHUB_WORKSPACE/build -j 3
otool -L $GITHUB_WORKSPACE/build/libgdal.dylib
- name: test
run: cmake --build $GITHUB_WORKSPACE/build --target quicktest
- name: test (with ctest)
run: |
ctest --test-dir $GITHUB_WORKSPACE/build -V -j 3
env:
BUILD_NAME: "macos_build_brew"
- name: Install
run: cmake --build $GITHUB_WORKSPACE/build --target install -j 3
- name: Test post-install usage (with pkg-config)
run: |
./autotest/postinstall/test_pkg-config.sh $GITHUB_WORKSPACE/install-gdal
- name: Test post-install usage (with gdal-config)
run: |
./autotest/postinstall/test_gdal-config.sh $GITHUB_WORKSPACE/install-gdal
- name: Test post-install usage (with CMake)
run: |
./autotest/postinstall/test_cmake.sh $GITHUB_WORKSPACE/install-gdal --dynamic --disable-odbc
- name: ccache statistics
run: ccache -s
# Disabled for now since bindings in master use GDALDatasetGetFieldDomainNames
# but libgdal from Conda has not it yet.
build-windows-conda-csharp-only:
if: ${{ false }} # disable for now
runs-on: windows-2022
env:
architecture: x64
generator: Visual Studio 17 2022
steps:
# To avoid git clone to mess with the line endings of GDAL autotest data
# files that look like text, but should be handled as binary content
- name: Set git core.autocrlf to false
run: |
git config --global core.autocrlf false
- name: Checkout GDAL
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
activate-environment: gdalenv
python-version: 3.9
channels: conda-forge
- name: Install dependency
shell: bash -l {0}
run: |
conda install --yes --quiet --name gdalenv curl libiconv icu python=3.9 swig numpy pytest pytest-env pytest-benchmark filelock zlib clcache lxml
conda install --yes --quiet --name gdalenv -c conda-forge libgdal
- name: Configure
shell: bash -l {0}
run: |
mkdir -p $GITHUB_WORKSPACE/build
cmake -A ${architecture} -G "${generator}" -DGDAL_CSHARP_ONLY=ON -DCMAKE_C_FLAGS=" /WX" -DCMAKE_CXX_FLAGS=" /WX" -S "$GITHUB_WORKSPACE" -B "$GITHUB_WORKSPACE/build"
- name: Build
shell: bash -l {0}
run: cmake --build $GITHUB_WORKSPACE/build --config Release --target csharp_samples -j 2
- name: test (with ctest)
shell: bash -l {0}
run: |
ctest --test-dir $GITHUB_WORKSPACE/build -C Release -V -j 3 -R "^csharp.*"
env:
SKIP_OGR_GMLAS_HUGE_PROCESSING_TIME: YES