forked from Fields2Cover/Fields2Cover
-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (119 loc) · 4.84 KB
/
build.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
name: Build and test
on:
push:
pull_request:
release:
workflow_dispatch:
jobs:
build:
name: "g++ ${{matrix.gcc}}, swig ${{matrix.swig}}, shared ${{matrix.shared}}, ${{matrix.build_type}}"
runs-on: ubuntu-latest
container: "osgeo/gdal:ubuntu-full-${{ matrix.gdal }}"
strategy:
fail-fast: false
matrix:
gcc: [9, 10, 11, 12]
gdal: ["3.6.3"]
swig: ["v4.0.0", "v4.0.1", "v4.0.2", "v4.1.0", "v4.1.1", "v4.2.0", "v4.2.1"]
shared: ["ON"]
generators: ["Unix Makefiles"]
build_type: ["Debug", "Release"]
include:
- gcc: 12
gdal: "3.6.2"
swig: "v4.2.1"
shared: "OFF"
generators: "Unix Makefiles"
build_type: "Release"
steps:
- uses: actions/checkout@v4
- name: Print env
run: |
echo github.event.action: ${{ github.event.action }}
echo github.event_name: ${{ github.event_name }}
- uses: lukka/get-cmake@latest
- name: Ubuntu system dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update --allow-insecure-repositories -y
apt-get install -y --allow-unauthenticated --no-install-recommends ca-certificates
apt-get install -y --allow-unauthenticated --no-install-recommends build-essential doxygen g++-${{ matrix.gcc }} gcc-${{ matrix.gcc }} gnuplot git lcov libboost-dev libeigen3-dev libgeos-dev libgtest-dev libpython3-dev libtbb-dev python3 python3-matplotlib python3-pip python3-pytest python3-tk libtinyxml2-dev libtinyxml2-9 nlohmann-json3-dev
python3 -m pip install gcovr setuptools
# Solve issue with matplotlib
python3 -c "import matplotlib"
echo "backend: Agg" > ~/.config/matplotlib/matplotlibrc
# Install Gtest
cd /usr/src/gtest
cmake CMakeLists.txt
make
cp *.a /usr/lib/ 2>\dev\null || :
cp lib/*.a /usr/lib/ 2>\dev\null || :
ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
# Install swig
apt-get install -y --allow-unauthenticated --no-install-recommends autoconf automake autotools-dev bison libpcre3 libpcre3-dev libpcre2-dev
cd /
mkdir folder_to_compile_swig
cd folder_to_compile_swig
git clone --depth 1 --branch ${{ matrix.swig }} https://github.com/swig/swig.git
cd swig
./autogen.sh
./configure
make -j2
make install
- name: Configure GDAL
shell: bash
run: |
mkdir -p /usr/include/new_gdal
cp -r /usr/include/gdal* /usr/include/new_gdal/
cp /usr/include/ogr* /usr/include/new_gdal/
cp /usr/include/cpl* /usr/include/new_gdal/
mv /usr/include/new_gdal/ /usr/include/gdal/
- name: Configure Or-tools
shell: bash
run: |
wget https://github.com/google/or-tools/releases/download/v9.9/or-tools_amd64_ubuntu-22.04_cpp_v9.9.3963.tar.gz -q -O /tmp/ortools.tar.gz
mkdir -p /tmp/ortools
tar -zxf /tmp/ortools.tar.gz -C /tmp/ortools --strip-components=1
cp -r /tmp/ortools/bin/. /usr/bin
cp -r /tmp/ortools/include/. /usr/include
cp -r /tmp/ortools/lib/. /usr/lib
cp -r /tmp/ortools/lib/cmake/. /usr/share
cp -r /tmp/ortools/share/. /usr/share/ortools
- name: Configure
working-directory: ${{github.workspace}}
shell: bash
run: |
mkdir build
mkdir instdir
cd build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-G "${{matrix.generators}}" \
-D CMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \
-D CMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \
-DCMAKE_INSTALL_PREFIX:PATH=../instdir \
-DBUILD_PYTHON=ON \
-DALLOW_PARALLELIZATION=ON \
-DBUILD_TUTORIALS=OFF \
-DBUILD_TESTS=ON \
-DBUILD_DOC=OFF \
-DBUILD_SHARED_LIBS={{ matrix.shared }} \
-DUSE_ORTOOLS_RELEASE=ON \
..
- name: Build
working-directory: ${{github.workspace}}/build
run: make -j2
- name: Install Strip
working-directory: ${{github.workspace}}/build
run: |
export LC_CTYPE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=C.UTF-8
make install
- name: Test C++
working-directory: ${{github.workspace}}/build
run: make check
- name: Test Python
working-directory: ${{github.workspace}}
run: PYTHONPATH=${PYTHONPATH}:instdir/lib/python$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))')/site-packages pytest-3 tests/python/