Skip to content

Commit d68f235

Browse files
lonviajoto
authored andcommitted
move windows build to github actions
Adds tests and packaging to the windows builds. Also adds a job that tests that the newly packaged osm2pgsql works. Disables appveyor.
1 parent 1a6269e commit d68f235

File tree

6 files changed

+84
-139
lines changed

6 files changed

+84
-139
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Set up postgresql on Windows
2+
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Download postgis
7+
run: |
8+
if (!(Test-Path "C:\postgis.zip")){(new-object net.webclient).DownloadFile("https://osm2pgsql.org/ci/winbuild/postgis-bundle-pg14-3.2.0x64.zip", "c:\postgis.zip")}
9+
7z x c:\postgis.zip -oc:\postgis_archive
10+
shell: pwsh
11+
- name: Install postgis
12+
run: |
13+
echo "Root: $PGROOT, Bin: $PGBIN"
14+
cp -r c:/postgis_archive/postgis-bundle-*/* "$PGROOT"
15+
shell: bash
16+
- name: Start PostgreSQL on Windows
17+
run: |
18+
$pgService = Get-Service -Name postgresql*
19+
Set-Service -InputObject $pgService -Status running -StartupType automatic
20+
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
21+
shell: pwsh
22+
- name: Create test tablespace
23+
run: |
24+
mkdir c:\tablespace
25+
& $env:PGBIN\psql -c "CREATE TABLESPACE tablespacetest LOCATION 'c:/tablespace'"
26+
shell: pwsh

.github/actions/win-test/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ runs:
44
using: composite
55
steps:
66
- name: Test
7-
run: ctest --output-on-failure -C Release -L NoDB
7+
run: ctest --output-on-failure -C Release
88
shell: bash
99
working-directory: build
1010

.github/workflows/ci.yml

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -216,33 +216,75 @@ jobs:
216216
- uses: ./.github/actions/ubuntu-prerequisites
217217
- uses: ./.github/actions/build-and-test
218218

219-
windows-2019:
220-
runs-on: windows-2019
219+
windows:
220+
strategy:
221+
matrix:
222+
os: [windows-2019, windows-2022]
223+
runs-on: ${{ matrix.os }}
221224
env:
222225
GETOPT_INCLUDE_DIR: ${{ github.workspace }}/../wingetopt/src
223226
GETOPT_LIBRARY: ${{ github.workspace }}/../wingetopt/build/Release/wingetopt.lib
227+
VCPKG_DEFAULT_BINARY_CACHE: C:/vcpkg_binary_cache
224228
steps:
225229
- uses: actions/checkout@v2
230+
- uses: actions/cache@v2
226231
with:
227-
submodules: true
232+
path: |
233+
C:/vcpkg_binary_cache
234+
key: vcpkg-binary-cache-${{ matrix.os }}
235+
- uses: actions/cache@v2
236+
with:
237+
path: |
238+
C:/postgis.zip
239+
key: postgis-cache
240+
- name: Prepare cache
241+
run: if [ ! -d C:/vcpkg_binary_cache ]; then mkdir C:/vcpkg_binary_cache; fi
242+
shell: bash
243+
- uses: ./.github/actions/win-postgres
228244
- uses: ./.github/actions/win-install
229245
- uses: ./.github/actions/win-getopt
230246
- uses: ./.github/actions/win-cmake
231247
- uses: ./.github/actions/win-build
232248
- uses: ./.github/actions/win-test
249+
- name: Package osm2pgsql
250+
run: |
251+
mkdir c:/artifact/
252+
mkdir c:/artifact/osm2pgsql-bin
253+
cp -r Release/* ../README.md ../COPYING ../*.style ../scripts ../flex-config c:/artifact/osm2pgsql-bin/
254+
shell: bash
255+
working-directory: build
256+
if: matrix.os == 'windows-2022'
257+
- name: 'Upload Artifact'
258+
uses: actions/upload-artifact@v2
259+
with:
260+
name: osm2pgsql-win64
261+
path: c:/artifact
262+
if: matrix.os == 'windows-2022'
233263

234-
windows-2022:
264+
windows-package:
265+
needs: windows
235266
runs-on: windows-2022
236267
env:
237-
GETOPT_INCLUDE_DIR: ${{ github.workspace }}/../wingetopt/src
238-
GETOPT_LIBRARY: ${{ github.workspace }}/../wingetopt/build/Release/wingetopt.lib
268+
OSMURL: https://download.geofabrik.de/europe/monaco-latest.osm.bz2
239269
steps:
240270
- uses: actions/checkout@v2
271+
- uses: actions/cache@v2
241272
with:
242-
submodules: true
243-
- uses: ./.github/actions/win-install
244-
- uses: ./.github/actions/win-getopt
245-
- uses: ./.github/actions/win-cmake
246-
- uses: ./.github/actions/win-build
247-
- uses: ./.github/actions/win-test
273+
path: |
274+
C:/postgis.zip
275+
key: postgis-cache
276+
- uses: actions/download-artifact@v2
277+
with:
278+
name: osm2pgsql-win64
279+
- uses: ./.github/actions/win-postgres
280+
- name: Set up database
281+
run: |
282+
& $env:PGBIN\createdb osm
283+
& $env:PGBIN\psql -d osm -c "CREATE EXTENSION hstore; CREATE EXTENSION postgis;"
284+
shell: pwsh
285+
- name: Get test data
286+
run: (new-object net.webclient).DownloadFile($env:OSMURL, "testfile.osm.bz2")
287+
- name: Exceute osm2pgsql
288+
run: ./osm2pgsql-bin/osm2pgsql --slim -d osm testfile.osm.bz2
289+
shell: bash
248290

appveyor.yml

Lines changed: 0 additions & 125 deletions
This file was deleted.

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ if (PYTHONINTERP_FOUND)
131131
set_tests_properties(regression-test-pbf PROPERTIES TIMEOUT ${TESTING_TIMEOUT})
132132
set_tests_properties(regression-test-pbf
133133
PROPERTIES FIXTURES_REQUIRED Tablespace)
134+
set_tests_properties(regression-test-pbf PROPERTIES ENVIRONMENT OSM2PGSQL_BINARY=$<TARGET_FILE:osm2pgsql>)
134135
message(STATUS "Added test: regression-test-pbf (needs Python with psycopg2 module)")
135136
else()
136137
message(WARNING "Can not find python, regression test disabled")

tests/regression-test.py.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#! @PYTHON_EXECUTABLE@ -B
22

3+
import os
34
import sys
45
import unittest
56

67
sys.path.insert(1, '@CMAKE_CURRENT_SOURCE_DIR@')
78

89
from regression import *
910

10-
CONFIG['executable'] = '@osm2pgsql_BINARY_DIR@/osm2pgsql'
11+
CONFIG['executable'] = os.environ['OSM2PGSQL_BINARY']
1112
CONFIG['test_data_path'] = '@CMAKE_CURRENT_SOURCE_DIR@/data'
1213
CONFIG['default_data_path'] = '@osm2pgsql_SOURCE_DIR@'
1314
CONFIG['have_lua'] = '@HAVE_LUA@' == '1'

0 commit comments

Comments
 (0)