-
Notifications
You must be signed in to change notification settings - Fork 42
187 lines (163 loc) · 5.76 KB
/
CI.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
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
# cancel running jobs on new commit to PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.65.0
override: true
components: rustfmt
- run: cargo fmt -- --check
- run: cd sys && cargo fmt -- --check
clippy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
components: clippy
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y libgeos-dev
- run: cargo clippy -- -D warnings
- run: cd sys && cargo clippy -- -D warnings
check_static:
name: Check static feature
runs-on: ubuntu-20.04
env:
LD_LIBRARY_PATH: /usr/local/lib
steps:
- uses: actions/checkout@v2
with:
submodules: "true"
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.65.0
override: true
- name: Build static geos crate
run: cargo build --features static
check:
name: Check ${{ matrix.toolchain }} / ${{ matrix.geos }} - ${{ matrix.triple.target }}
runs-on: ubuntu-20.04
env:
LD_LIBRARY_PATH: /usr/local/lib
GEOS_LIB_DIR: "/usr/lib/x86_64-linux-gnu"
GEOS_VERSION: ${{ matrix.geos }}
strategy:
fail-fast: false
matrix:
toolchain:
- 1.65.0
- nightly
geos: ["3.6.5", "3.7.5", "3.8.3", "3.9.3", "3.10.3", "3.11.0"]
include:
- geos: "3.7.5"
version_feature: "v3_7_0"
- geos: "3.8.3"
version_feature: "v3_8_0"
- geos: "3.9.3"
version_feature: "v3_9_0"
- geos: "3.10.3"
version_feature: "v3_10_0"
- geos: "3.11.0"
version_feature: "v3_11_0"
steps:
- uses: actions/checkout@v2
with:
submodules: "true"
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- name: Install dependencies
run: |
sudo apt update
sudo apt install build-essential ccache ninja-build pkg-config valgrind
sudo /usr/sbin/update-ccache-symlinks
- name: Prepare ccache
run: ccache --clear --set-config cache_dir=~/.ccache
- name: Cache ccache
uses: actions/cache@v2
env:
cache-name: ccache-v1
with:
path: ~/.ccache
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}
- name: Clear ccache statistics
run: |
ccache --zero-stats --set-config cache_dir=~/.ccache
ccache --max-size=2G --set-config cache_dir=~/.ccache
ccache --show-stats --set-config cache_dir=~/.ccache
- name: Install GEOS
run: |
cd sys/geos-src/source
git fetch --unshallow --tags origin
git checkout "tags/${{ matrix.geos }}"
mkdir build
cd build
cmake -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=Release ..
sudo ninja install
- name: Build geos crate
run: |
cargo build
cargo build --features 'geo,json'
- name: Build geos crate for GEOS version > 3.6
if: ${{ matrix.version_feature }}
run: |
cargo build --features ${{ matrix.version_feature }}
cargo build --features '${{ matrix.version_feature }},geo,json'
- name: Run geos tests
run: |
cargo test
cargo test --features 'geo,json'
- name: Run geos tests for GEOS version > 3.6
if: ${{ matrix.version_feature }}
run: |
cargo test --features ${{ matrix.version_feature }}
cargo test --features '${{ matrix.version_feature }},geo,json'
- name: Check doc generation
run: |
cargo doc --features dox
cargo doc
- name: Run examples
run: |
cargo run --example verbose_example
cargo run --example prepared_geom
cargo run --features geo --example prepared_geom
cargo run --example from_geo
cargo run --features geo --example from_geo
- name: Check memory leaks
# run valgrind to check that there are no memoryleaks
# Note: cargo seems to randomly name the executable, so we use find to find all the tests
#
# As long as leaks come from "geos::geom::GeometryFactory::getDefaultInstance", then
# it's fine (singleton).
run: |
find ./target/debug/deps -name "geos*" -type f -executable | xargs -n 1 valgrind --leak-check=full --error-exitcode=42 --show-leak-kinds=all
valgrind --leak-check=full --error-exitcode=42 ./target/debug/examples/from_geo
valgrind --leak-check=full --error-exitcode=42 ./target/debug/examples/verbose_example
valgrind --leak-check=full --error-exitcode=42 ./target/debug/examples/prepared_geom