Skip to content

Commit

Permalink
move windows build to github actions
Browse files Browse the repository at this point in the history
Adds tests and packaging to the windows builds. Also adds a job that
tests that the newly packaged osm2pgsql works. Disables appveyor.
  • Loading branch information
lonvia authored and joto committed Jan 24, 2022
1 parent 1a6269e commit d68f235
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 139 deletions.
26 changes: 26 additions & 0 deletions .github/actions/win-postgres/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Set up postgresql on Windows

runs:
using: composite
steps:
- name: Download postgis
run: |
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")}
7z x c:\postgis.zip -oc:\postgis_archive
shell: pwsh
- name: Install postgis
run: |
echo "Root: $PGROOT, Bin: $PGBIN"
cp -r c:/postgis_archive/postgis-bundle-*/* "$PGROOT"
shell: bash
- name: Start PostgreSQL on Windows
run: |
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
shell: pwsh
- name: Create test tablespace
run: |
mkdir c:\tablespace
& $env:PGBIN\psql -c "CREATE TABLESPACE tablespacetest LOCATION 'c:/tablespace'"
shell: pwsh
2 changes: 1 addition & 1 deletion .github/actions/win-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ runs:
using: composite
steps:
- name: Test
run: ctest --output-on-failure -C Release -L NoDB
run: ctest --output-on-failure -C Release
shell: bash
working-directory: build

66 changes: 54 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,33 +216,75 @@ jobs:
- uses: ./.github/actions/ubuntu-prerequisites
- uses: ./.github/actions/build-and-test

windows-2019:
runs-on: windows-2019
windows:
strategy:
matrix:
os: [windows-2019, windows-2022]
runs-on: ${{ matrix.os }}
env:
GETOPT_INCLUDE_DIR: ${{ github.workspace }}/../wingetopt/src
GETOPT_LIBRARY: ${{ github.workspace }}/../wingetopt/build/Release/wingetopt.lib
VCPKG_DEFAULT_BINARY_CACHE: C:/vcpkg_binary_cache
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
submodules: true
path: |
C:/vcpkg_binary_cache
key: vcpkg-binary-cache-${{ matrix.os }}
- uses: actions/cache@v2
with:
path: |
C:/postgis.zip
key: postgis-cache
- name: Prepare cache
run: if [ ! -d C:/vcpkg_binary_cache ]; then mkdir C:/vcpkg_binary_cache; fi
shell: bash
- uses: ./.github/actions/win-postgres
- uses: ./.github/actions/win-install
- uses: ./.github/actions/win-getopt
- uses: ./.github/actions/win-cmake
- uses: ./.github/actions/win-build
- uses: ./.github/actions/win-test
- name: Package osm2pgsql
run: |
mkdir c:/artifact/
mkdir c:/artifact/osm2pgsql-bin
cp -r Release/* ../README.md ../COPYING ../*.style ../scripts ../flex-config c:/artifact/osm2pgsql-bin/
shell: bash
working-directory: build
if: matrix.os == 'windows-2022'
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: osm2pgsql-win64
path: c:/artifact
if: matrix.os == 'windows-2022'

windows-2022:
windows-package:
needs: windows
runs-on: windows-2022
env:
GETOPT_INCLUDE_DIR: ${{ github.workspace }}/../wingetopt/src
GETOPT_LIBRARY: ${{ github.workspace }}/../wingetopt/build/Release/wingetopt.lib
OSMURL: https://download.geofabrik.de/europe/monaco-latest.osm.bz2
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
submodules: true
- uses: ./.github/actions/win-install
- uses: ./.github/actions/win-getopt
- uses: ./.github/actions/win-cmake
- uses: ./.github/actions/win-build
- uses: ./.github/actions/win-test
path: |
C:/postgis.zip
key: postgis-cache
- uses: actions/download-artifact@v2
with:
name: osm2pgsql-win64
- uses: ./.github/actions/win-postgres
- name: Set up database
run: |
& $env:PGBIN\createdb osm
& $env:PGBIN\psql -d osm -c "CREATE EXTENSION hstore; CREATE EXTENSION postgis;"
shell: pwsh
- name: Get test data
run: (new-object net.webclient).DownloadFile($env:OSMURL, "testfile.osm.bz2")
- name: Exceute osm2pgsql
run: ./osm2pgsql-bin/osm2pgsql --slim -d osm testfile.osm.bz2
shell: bash

125 changes: 0 additions & 125 deletions appveyor.yml

This file was deleted.

1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ if (PYTHONINTERP_FOUND)
set_tests_properties(regression-test-pbf PROPERTIES TIMEOUT ${TESTING_TIMEOUT})
set_tests_properties(regression-test-pbf
PROPERTIES FIXTURES_REQUIRED Tablespace)
set_tests_properties(regression-test-pbf PROPERTIES ENVIRONMENT OSM2PGSQL_BINARY=$<TARGET_FILE:osm2pgsql>)
message(STATUS "Added test: regression-test-pbf (needs Python with psycopg2 module)")
else()
message(WARNING "Can not find python, regression test disabled")
Expand Down
3 changes: 2 additions & 1 deletion tests/regression-test.py.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#! @PYTHON_EXECUTABLE@ -B

import os
import sys
import unittest

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

from regression import *

CONFIG['executable'] = '@osm2pgsql_BINARY_DIR@/osm2pgsql'
CONFIG['executable'] = os.environ['OSM2PGSQL_BINARY']
CONFIG['test_data_path'] = '@CMAKE_CURRENT_SOURCE_DIR@/data'
CONFIG['default_data_path'] = '@osm2pgsql_SOURCE_DIR@'
CONFIG['have_lua'] = '@HAVE_LUA@' == '1'
Expand Down

0 comments on commit d68f235

Please sign in to comment.