2424 - name : Install system dependencies
2525 run : |
2626 sudo apt-get update
27- sudo apt-get install -y libspatialindex-dev
27+ sudo apt-get install -y build-essential cmake git
28+
29+ - name : Cache libspatialindex
30+ uses : actions/cache@v3
31+ id : libspatialindex-cache
32+ with :
33+ path : |
34+ /usr/local/lib/libspatialindex*
35+ /usr/local/include/spatialindex
36+ key : ${{ runner.os }}-libspatialindex-${{ hashFiles('**/poetry.lock') }}
37+ restore-keys : |
38+ ${{ runner.os }}-libspatialindex-
39+
40+ - name : Build libspatialindex
41+ if : steps.libspatialindex-cache.outputs.cache-hit != 'true'
42+ run : |
43+ git clone https://github.com/libspatialindex/libspatialindex.git /tmp/libspatialindex
44+ cd /tmp/libspatialindex
45+ cmake -DCMAKE_BUILD_TYPE=Release -DSIDX_BUILD_TESTS=OFF .
46+ make -j$(nproc)
47+ sudo make install
48+ sudo ldconfig
2849 - name : Install Poetry
2950 uses : snok/install-poetry@v1
3051 with :
5677 - name : Install system dependencies
5778 run : |
5879 sudo apt-get update
59- sudo apt-get install -y libspatialindex-dev
80+ sudo apt-get install -y build-essential cmake git
81+
82+ - name : Cache libspatialindex
83+ uses : actions/cache@v3
84+ id : libspatialindex-cache
85+ with :
86+ path : |
87+ /usr/local/lib/libspatialindex*
88+ /usr/local/include/spatialindex
89+ key : ${{ runner.os }}-libspatialindex-${{ hashFiles('**/poetry.lock') }}
90+ restore-keys : |
91+ ${{ runner.os }}-libspatialindex-
92+
93+ - name : Build libspatialindex
94+ if : steps.libspatialindex-cache.outputs.cache-hit != 'true'
95+ run : |
96+ git clone https://github.com/libspatialindex/libspatialindex.git /tmp/libspatialindex
97+ cd /tmp/libspatialindex
98+ cmake -DCMAKE_BUILD_TYPE=Release -DSIDX_BUILD_TESTS=OFF .
99+ make -j$(nproc)
100+ sudo make install
101+ sudo ldconfig
60102 - name : Install Poetry
61103 uses : snok/install-poetry@v1
62104 with :
@@ -88,7 +130,28 @@ jobs:
88130 - name : Install system dependencies
89131 run : |
90132 sudo apt-get update
91- sudo apt-get install -y libspatialindex-dev
133+ sudo apt-get install -y build-essential cmake git
134+
135+ - name : Cache libspatialindex
136+ uses : actions/cache@v3
137+ id : libspatialindex-cache
138+ with :
139+ path : |
140+ /usr/local/lib/libspatialindex*
141+ /usr/local/include/spatialindex
142+ key : ${{ runner.os }}-libspatialindex-${{ hashFiles('**/poetry.lock') }}
143+ restore-keys : |
144+ ${{ runner.os }}-libspatialindex-
145+
146+ - name : Build libspatialindex
147+ if : steps.libspatialindex-cache.outputs.cache-hit != 'true'
148+ run : |
149+ git clone https://github.com/libspatialindex/libspatialindex.git /tmp/libspatialindex
150+ cd /tmp/libspatialindex
151+ cmake -DCMAKE_BUILD_TYPE=Release -DSIDX_BUILD_TESTS=OFF .
152+ make -j$(nproc)
153+ sudo make install
154+ sudo ldconfig
92155 - name : Install Poetry
93156 uses : snok/install-poetry@v1
94157 with :
@@ -137,7 +200,28 @@ jobs:
137200 - name : Install system dependencies
138201 run : |
139202 sudo apt-get update
140- sudo apt-get install -y libspatialindex-dev
203+ sudo apt-get install -y build-essential cmake git
204+
205+ - name : Cache libspatialindex
206+ uses : actions/cache@v3
207+ id : libspatialindex-cache
208+ with :
209+ path : |
210+ /usr/local/lib/libspatialindex*
211+ /usr/local/include/spatialindex
212+ key : ${{ runner.os }}-libspatialindex-${{ hashFiles('**/poetry.lock') }}
213+ restore-keys : |
214+ ${{ runner.os }}-libspatialindex-
215+
216+ - name : Build libspatialindex
217+ if : steps.libspatialindex-cache.outputs.cache-hit != 'true'
218+ run : |
219+ git clone https://github.com/libspatialindex/libspatialindex.git /tmp/libspatialindex
220+ cd /tmp/libspatialindex
221+ cmake -DCMAKE_BUILD_TYPE=Release -DSIDX_BUILD_TESTS=OFF .
222+ make -j$(nproc)
223+ sudo make install
224+ sudo ldconfig
141225 - name : Install Poetry
142226 uses : snok/install-poetry@v1
143227 with :
@@ -163,17 +247,17 @@ jobs:
163247 # Run tests with coverage (continue even if tests fail)
164248 - name : Run tests with coverage
165249 run : |
166- poetry run python -m pytest --cov=o2 --cov-report=xml:/tmp/coverage-reports/coverage.xml --cov-report=html:/tmp/coverage-reports/html || true
250+ poetry run python -m pytest --cov=o2 --cov-report=term-missing --cov-report= xml:/tmp/coverage-reports/coverage.xml --cov-report=html:/tmp/coverage-reports/html || true
167251
168252 # Generate the coverage badge (even if tests failed)
169253 - name : Generate coverage badge
170254 run : |
171255 if [ -f /tmp/coverage-reports/coverage.xml ]; then
172- COVERAGE=$(python -c "import xml.etree.ElementTree as ET; print('{:.2f }%'.format(float(ET.parse('/tmp/coverage-reports/coverage.xml').getroot().attrib['line-rate']) * 100))")
173- COLOR=$(python -c "import xml.etree.ElementTree as ET; rate = float(ET.parse('/tmp/coverage-reports/coverage.xml').getroot().attrib['line-rate']); print('red ' if rate < 0.5 else 'yellow ' if rate < 0.75 else 'green ')")
256+ COVERAGE=$(python -c "import xml.etree.ElementTree as ET; print('{:.0f }%'.format(float(ET.parse('/tmp/coverage-reports/coverage.xml').getroot().attrib['line-rate']) * 100))")
257+ COLOR=$(python -c "import xml.etree.ElementTree as ET; rate = float(ET.parse('/tmp/coverage-reports/coverage.xml').getroot().attrib['line-rate']); print('e05d44 ' if rate < 0.5 else 'dfb317 ' if rate < 0.75 else '97ca00 ')")
174258 else
175- COVERAGE="0.00 %"
176- COLOR="red "
259+ COVERAGE="0%"
260+ COLOR="e05d44 "
177261 fi
178262
179263 # Create badge with actual values instead of variables
@@ -201,16 +285,6 @@ jobs:
201285 </svg>
202286 EOF
203287
204- # Show directory contents for debugging
205- - name : Debug directory contents
206- run : |
207- echo "Contents of /tmp/coverage-reports:"
208- ls -la /tmp/coverage-reports
209- echo "Contents of /tmp/coverage-reports/html:"
210- ls -la /tmp/coverage-reports/html || echo "HTML directory empty"
211- echo "Contents of /tmp/coverage-reports/badges:"
212- ls -la /tmp/coverage-reports/badges || echo "Badges directory empty"
213-
214288 # Save coverage report as an artifact
215289 - name : Save coverage report artifact
216290 uses : actions/upload-artifact@v4
@@ -227,9 +301,6 @@ jobs:
227301 cp -r /tmp/coverage-reports/html/* /tmp/coverage-reports/
228302 # Keep badges directory
229303 mkdir -p /tmp/coverage-reports/badges
230- cp /tmp/coverage-reports/badges/coverage.svg /tmp/coverage-reports/badges/
231- # Keep coverage.xml
232- cp /tmp/coverage-reports/coverage.xml /tmp/coverage-reports/
233304
234305 - name : Deploy to GitHub Pages
235306 if : github.ref == 'refs/heads/main'
0 commit comments