Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Maintainer ownership; existing repository review rules are unchanged.
* @scottconverse
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 5
56 changes: 56 additions & 0 deletions .github/scripts/prepare-windows-test-db.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
param([switch]$WithVector, [switch]$WithPostgis)
$ErrorActionPreference = 'Stop'
$pgroot = $env:PGROOT
if (-not $pgroot) { $pgroot = 'C:\Program Files\PostgreSQL\17' }
$pgbin = Join-Path $pgroot 'bin'
if (-not (Test-Path (Join-Path $pgbin 'initdb.exe'))) { throw 'Hosted Windows PostgreSQL 17 tools are missing.' }
if ($WithVector) {
$vector = Join-Path $env:RUNNER_TEMP 'townlight-test-pgvector'
git clone --depth 1 --branch v0.8.2 https://github.com/pgvector/pgvector.git $vector
if ($LASTEXITCODE -ne 0) { throw 'pgvector source checkout failed.' }
$vswhere = Join-Path ${env:ProgramFiles(x86)} 'Microsoft Visual Studio\Installer\vswhere.exe'
$vs = & $vswhere -latest -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$devcmd = Join-Path $vs 'Common7\Tools\VsDevCmd.bat'
if (-not (Test-Path $devcmd)) { throw 'Hosted MSVC build tools are missing.' }
Push-Location $vector
try {
$command = 'call "' + $devcmd + '" -arch=x64 -host_arch=x64 >nul && set "PGROOT=' + $pgroot + '" && nmake /F Makefile.win && nmake /F Makefile.win install'
& cmd.exe /d /s /c $command
if ($LASTEXITCODE -ne 0) { throw 'Windows pgvector build/install failed.' }
} finally { Pop-Location }
}
if ($WithPostgis) {
$archive = Join-Path $env:RUNNER_TEMP 'postgis.zip'
Invoke-WebRequest -Uri 'https://download.osgeo.org/postgis/windows/pg17/archive/postgis-bundle-pg17-3.6.2x64.zip' -OutFile $archive
if ((Get-FileHash -LiteralPath $archive -Algorithm SHA256).Hash.ToLowerInvariant() -ne '7ba180ee2a352987b9a2f194673652c59483b55852295ccf401dceccd8765425') { throw 'PostGIS hash mismatch.' }
$unpack = Join-Path $env:RUNNER_TEMP 'postgis'
Expand-Archive -LiteralPath $archive -DestinationPath $unpack
$bundle = Join-Path $unpack 'postgis-bundle-pg17-3.6.2x64'
foreach ($name in @('bin','lib','share')) {
Get-ChildItem -LiteralPath (Join-Path $bundle $name) -Force | Copy-Item -Destination (Join-Path $pgroot $name) -Recurse -Force
}
}
"PGBIN=$pgbin" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
$cluster = Join-Path $env:RUNNER_TEMP 'townlight-test-pg'
$password = [Guid]::NewGuid().ToString('N')
Write-Output "::add-mask::$password"
$pwfile = Join-Path $env:RUNNER_TEMP 'townlight-test-pg-password'
[IO.File]::WriteAllText($pwfile, $password)
try {
& "$pgbin\initdb.exe" -D $cluster -U postgres --auth=scram-sha-256 --pwfile=$pwfile --encoding=UTF8
if ($LASTEXITCODE -ne 0) { throw 'Private test cluster initialization failed.' }
} finally { Remove-Item -LiteralPath $pwfile -Force }
& "$pgbin\pg_ctl.exe" -D $cluster -l (Join-Path $env:RUNNER_TEMP 'townlight-test-pg.log') -o '-h 127.0.0.1 -p 55439' -w start
if ($LASTEXITCODE -ne 0) { throw 'Private loopback test cluster failed to start.' }
$env:PGPASSWORD = $password
& "$pgbin\createdb.exe" -h 127.0.0.1 -p 55439 -U postgres planning_p1p2_test
if ($LASTEXITCODE -ne 0) { throw 'Private test database creation failed.' }
"DATABASE_URL=postgresql+asyncpg://postgres:$password@127.0.0.1:55439/postgres" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
"PLANNING_TEST_DATABASE_URL=postgresql+psycopg2://postgres:$password@127.0.0.1:55439/planning_p1p2_test" | Out-File $env:GITHUB_ENV -Append -Encoding utf8

foreach ($name in @('townlight_meetings_windows_test','townlight_zoning_test')) {
& "$pgbin/createdb.exe" -h 127.0.0.1 -p 55439 -U postgres $name
if ($LASTEXITCODE -ne 0) { throw "Could not create $name" }
}
"TOWNLIGHT_MEETINGS_TEST_DATABASE_URL=postgresql+psycopg2://postgres:$password@127.0.0.1:55439/townlight_meetings_windows_test" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
"TOWNLIGHT_ZONING_TEST_DATABASE_URL=postgresql+psycopg2://postgres:$password@127.0.0.1:55439/townlight_zoning_test" | Out-File $env:GITHUB_ENV -Append -Encoding utf8
30 changes: 30 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CodeQL
'on':
pull_request:
paths:
- '**/*.py'
- '**/*.js'
- '**/*.ts'
- '**/*.tsx'
- '**/*.jsx'
- '**/pyproject.toml'
- '**/package*.json'
- .github/workflows/codeql.yml
workflow_dispatch: null
permissions:
contents: read
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
- uses: github/codeql-action/init@v4
with:
languages: python
build-mode: none
- uses: github/codeql-action/analyze@v4
36 changes: 29 additions & 7 deletions .github/workflows/windows-contracts.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Windows component contracts
on:
pull_request:
paths: ["**/*.py", "**/pyproject.toml", ".github/workflows/windows-contracts.yml"]
push:
paths: ["**/*.py", "**/pyproject.toml", ".github/workflows/windows-contracts.yml"]
branches: [main]
paths: ["**/*.py", "**/*.toml", "**/*.sql", "**/*.json", "**/*.ini", "**/*.cfg", "**/*.ps1", "**/*.sh", "**/*.yaml", "**/*.yml", "**/requirements*.txt", "**/*.lock"]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
windows-contracts:
runs-on: windows-latest
timeout-minutes: 20
timeout-minutes: 45
defaults:
run:
working-directory: .
Expand All @@ -20,16 +20,38 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.13'
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install pinned shared Core
run: python -m pip install git+https://github.com/townlight/core.git@3021821bf9a92c790a399ad12aed821d65b09105
- name: Install component and test tools
run: python -m pip install -e ".[dev]" pytest
- name: Run existing Windows contracts
run: python -X utf8 -m pytest tests/test_runtime_foundation.py tests/test_milestone_3_parcel_lookup.py tests/test_milestone_4_use_dimensional_rules.py -q --junitxml=windows-contracts.xml
- name: Prepare isolated Windows PostgreSQL fixture
working-directory: .
shell: pwsh
run: ./.github/scripts/prepare-windows-test-db.ps1 -WithVector -WithPostgis
- name: Migrate isolated geographic test database
shell: pwsh
run: |
$env:DATABASE_URL = $env:TOWNLIGHT_ZONING_TEST_DATABASE_URL
python -m alembic -c townlight_zoning/migrations/alembic.ini upgrade head
if ($LASTEXITCODE -ne 0) { throw 'Zoning fixture migration failed.' }
- name: Run full Python suite on Windows
run: python -X utf8 -m pytest tests -q -ra --junitxml=windows-contracts.xml
- name: Preserve results
if: always()
uses: actions/upload-artifact@v4
with:
name: windows-contract-results
path: ./windows-contracts.xml
retention-days: 7
- name: Stop owned test database
if: always()
working-directory: .
shell: pwsh
run: |
$cluster = Join-Path $env:RUNNER_TEMP 'townlight-test-pg'
if (Test-Path (Join-Path $cluster 'postmaster.pid')) {
& "$env:PGBIN/pg_ctl.exe" -D $cluster -m fast -w stop
if ($LASTEXITCODE -ne 0) { throw 'Owned test database did not stop.' }
}
7 changes: 7 additions & 0 deletions docs/WINDOWS-CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Windows component testing

The Windows component workflow collects and runs the full Python tests directory.
SQL, configuration, dependency and script changes trigger the job alongside Python changes.
JUnit results retain exact passes, failures and explicit platform/dependency skips.
The existing hosted database/browser checks remain; component tests do not establish signed MSI installed acceptance.
The obsolete manual release-preflight workflow is preserved under docs/history/retired-workflows-2026-11, not used to describe current release readiness.
Loading