Skip to content

Commit

Permalink
actions: switch windows install to postgis package from OSGeo
Browse files Browse the repository at this point in the history
Also enabled Windows 2025 build.
  • Loading branch information
lonvia committed Jan 13, 2025
1 parent 8063f60 commit 02ac17e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
29 changes: 28 additions & 1 deletion .github/actions/win-postgres/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,38 @@ name: Set up PostgreSQL on Windows
runs:
using: composite
steps:
- name: Decide Postgis version (Windows)
# Borrowed from https://github.com/nyurik/action-setup-postgis/blob/main/action.yml
id: postgis-ver
shell: pwsh
run: |
echo "PowerShell version: ${PSVersionTable.PSVersion}"
$PG_VERSION = Split-Path $env:PGROOT -Leaf
$postgis_page = "https://download.osgeo.org/postgis/windows/pg$PG_VERSION"
echo "Detecting PostGIS version from $postgis_page for PostgreSQL $PG_VERSION"
$pgis_bundle = (Invoke-WebRequest -Uri $postgis_page -ErrorAction Stop).Links.Where({$_.href -match "^postgis.*zip$"}).href
if (!$pgis_bundle) {
Write-Error "Could not find latest PostGIS version in $postgis_page that would match ^postgis.*zip$ pattern"
exit 1
}
$pgis_bundle = [IO.Path]::ChangeExtension($pgis_bundle, [NullString]::Value)
$pgis_bundle_url = "$postgis_page/$pgis_bundle.zip"
Add-Content $env:GITHUB_OUTPUT "postgis_file=$pgis_bundle"
Add-Content $env:GITHUB_OUTPUT "postgis_bundle_url=$pgis_bundle_url"
- uses: actions/cache@v4
with:
path: |
C:/postgis.zip
key: postgis-cache-${{ steps.postgis-ver.outputs.postgis_file }}

- 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")}
if (!(Test-Path "C:\postgis.zip")){(new-object net.webclient).DownloadFile($env:PGIS_BUNDLE_URL, "c:\postgis.zip")}
7z x c:\postgis.zip -oc:\postgis_archive
shell: pwsh
env:
PGIS_BUNDLE_URL: ${{ steps.postgis-ver.outputs.postgis_bundle_url }}

- name: Install postgis
run: |
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
os: [windows-2019, windows-2022, windows-2025]
runs-on: ${{ matrix.os }}

env:
Expand All @@ -356,11 +356,6 @@ jobs:
key: vcpkg-binary-cache-${{ matrix.os }}-${{ github.run_id }}
restore-keys: |
vcpkg-binary-cache-${{ matrix.os }}
- uses: actions/cache@v4
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
Expand Down Expand Up @@ -393,11 +388,6 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
C:/postgis.zip
key: postgis-cache
- uses: actions/download-artifact@v4
with:
name: osm2pgsql-win64
Expand Down

0 comments on commit 02ac17e

Please sign in to comment.