diff --git a/.github/actions/setup-postgresql-windows/action.yml b/.github/actions/setup-postgresql-windows/action.yml index 41256435..fab18778 100644 --- a/.github/actions/setup-postgresql-windows/action.yml +++ b/.github/actions/setup-postgresql-windows/action.yml @@ -11,6 +11,18 @@ runs: using: "composite" steps: + - name: Set up PostgreSQL variables + shell: pwsh + run: | + $version = "${{ inputs.postgresql-version }}" + $root = "C:\Program Files\PostgreSQL\$version" + $bin = "$root\bin" + + echo "PGROOT=$root" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "PGBIN=$bin" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + echo "$bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Decide Postgis version (Windows) id: postgis-ver shell: pwsh @@ -36,19 +48,19 @@ runs: key: postgis-cache-${{ steps.postgis-ver.outputs.postgis_file }} - name: Download postgis + shell: pwsh run: | if (!(Test-Path "C:\postgis.zip")){(new-object net.webclient).DownloadFile($env:PGIS_BUNDLE_URL, "c:\postgis.zip")} if (Test-path "c:\postgis_archive"){Remove-Item "c:\postgis_archive" -Recurse -Force} 7z x c:\postgis.zip -oc:\postgis_archive - shell: pwsh env: PGIS_BUNDLE_URL: ${{ steps.postgis-ver.outputs.postgis_bundle_url }} - name: Install postgis + shell: bash run: | echo "Root: $PGROOT, Bin: $PGBIN" - cp -r c:/postgis_archive/postgis-bundle-*/* "$PGROOT" - shell: bash + cp -r c:/postgis_archive/postgis-bundle-*/* "$PGROOT" - name: Start PostgreSQL on Windows run: | diff --git a/.github/workflows/ci-tests-windows.yml b/.github/workflows/ci-tests-windows.yml deleted file mode 100644 index 6ca82a1f..00000000 --- a/.github/workflows/ci-tests-windows.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: CI Tests (Windows) - -on: [ push, pull_request ] - -jobs: - tests: - strategy: - matrix: - flavour: ["windows-latest"] - include: - - flavour: windows-latest - runner: windows-latest - python: '3.11' - - runs-on: ${{ matrix.runner }} - - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - cache: pip - - - name: Install test prerequisites - run: | - python -m pip install -U pip - python -m pip install \ - pytest pytest-asyncio \ - "psycopg[binary]!=3.3.0" \ - python-dotenv pyyaml jinja2 psutil sqlalchemy - - - name: Python unit tests (Windows subset) - run: | - python -m pytest \ - test/python/utils \ - test/python/config \ - test/python/api/test_api_types.py \ - test/python/api/search/test_query.py \ - test/python/api/query_processing/test_regex_replace.py \ - test/python/api/query_processing/test_split_japanese_phrases.py \ No newline at end of file diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 4d6608c5..487753a7 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -154,7 +154,7 @@ jobs: - uses: ./Nominatim/.github/actions/setup-postgresql-windows with: - postgresql-version: 18 + postgresql-version: 17 - name: Set up Python uses: actions/setup-python@v5 @@ -167,6 +167,19 @@ jobs: 7z x spatialite.7z -o"C:\spatialite" echo "C:\spatialite\mod_spatialite-5.1.0-win-amd64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Install osm2pgsql + run: | + Invoke-WebRequest -Uri "https://osm2pgsql.org/download/windows/osm2pgsql-latest-x64.zip" -OutFile "osm2pgsql.zip" + Expand-Archive -Path "osm2pgsql.zip" -DestinationPath "C:\osm2pgsql" + $BinDir = Get-ChildItem -Path "C:\osm2pgsql" -Recurse -Filter "osm2pgsql.exe" | Select-Object -ExpandProperty DirectoryName | Select-Object -First 1 + if (-not $BinDir) { + Write-Error "Could not find osm2pgsql.exe" + exit 1 + } + echo "$BinDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + $FullExePath = Join-Path $BinDir "osm2pgsql.exe" + echo "NOMINATIM_OSM2PGSQL_BINARY=$FullExePath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + - name: Set UTF-8 encoding run: | echo "PYTHONUTF8=1" >> $env:GITHUB_ENV @@ -181,16 +194,9 @@ jobs: python -m pip install -U pip python -m pip install pytest pytest-asyncio "psycopg[binary]!=3.3.0" python-dotenv pyyaml jinja2 psutil sqlalchemy pytest-bdd falcon starlette uvicorn asgi_lifespan aiosqlite osmium mwparserfromhell - - name: Python unit tests (subset) + - name: Python unit tests run: | - python -m pytest test/python ` - --ignore=test/python/tools/test_add_osm_data.py ` - --ignore=test/python/tools/test_database_import.py ` - --ignore=test/python/tools/test_exec_utils.py ` - --ignore=test/python/cli/test_cmd_import.py ` - --ignore=test/python/data/test_country_info.py ` - --ignore=test/python/db/test_utils.py ` - --ignore=test/python/tools/test_refresh.py + python -m pytest test/python -k "not (import_osm or run_osm2pgsql)" working-directory: Nominatim install: diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml deleted file mode 100644 index be44f5a9..00000000 --- a/.github/workflows/windows-ci.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Windows CI (experimental) - -on: - pull_request: - push: - -jobs: - windows-smoke: - runs-on: windows-latest - continue-on-error: true #this is a smoke test (experimental); it won't block merges - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - cache: pip - cache-dependency-path: | - packaging/nominatim-db/pyproject.toml - packaging/nominatim-api/pyproject.toml - - - name: Install latest flake8 - run: python -m pip install -U pip flake8 - - - name: Python linting - run: python -m flake8 src test/python test/bdd - - - name: Compile Python sources (smoke) - run: python -m compileall src/nominatim_db src/nominatim_api nominatim-cli.py