feat: add windows support #1173
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [pull_request, workflow_dispatch] | |
permissions: | |
contents: read | |
jobs: | |
build-and-test-extension: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
postgres-version: [ 16, 17 ] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/install-action@just | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" # caching pip dependencies | |
- name: Verify Docker installation | |
run: | | |
docker --version | |
docker info | |
- name: Build Docker image | |
run: just ext docker-build | |
env: | |
PG_MAJOR: ${{ matrix.postgres-version }} | |
- name: Run Docker container | |
run: just ext docker-run | |
- name: Build | |
run: docker exec pgai-ext just build | |
- name: Lint SQL and Python | |
run: docker exec pgai-ext just lint | |
- name: Check Python Formatting | |
run: docker exec pgai-ext just format-py | |
- name: Install extension | |
run: docker exec pgai-ext just install | |
- name: Run test server | |
run: docker exec -d pgai-ext just test-server | |
- name: Run tests | |
run: docker exec pgai-ext just test | |
- name: Stop and remove Docker container | |
run: | | |
just ext docker-stop | |
just ext docker-rm | |
build-and-test-extension-windows-pg14: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/install-action@just | |
- name: Install PostgreSQL | |
uses: ikalnytskyi/action-setup-postgres@v7 | |
with: | |
postgres-version: 16 | |
- name: Configure Passwordless Authentication | |
shell: bash | |
run: | | |
# This is the PGDATA dir used on the previous step. | |
PGDATA="$RUNNER_TEMP/pgdata" | |
# Add trust authentication to pg_hba.conf the extension tests | |
# required this, otherwise they will fail. | |
echo "host all all 127.0.0.1/32 trust" > "$PGDATA/pg_hba.conf" | |
echo "host all all ::1/128 trust" >> "$PGDATA/pg_hba.conf" | |
# Restart PostgreSQL to apply changes | |
pg_ctl -D "$PGDATA" restart | |
- name: Install pgvector | |
shell: cmd | |
env: | |
PGROOT: "C:/Program Files/PostgreSQL/16" | |
run: | | |
git clone --branch v0.8.0 https://github.com/pgvector/pgvector.git | |
cd pgvector | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" && ^ | |
nmake /NOLOGO /F Makefile.win && ^ | |
nmake /NOLOGO /F Makefile.win install | |
- name: Create pip cache directory | |
run: | | |
New-Item -Path "C:\Users\runneradmin\AppData\Local\pip\cache" -ItemType Directory -Force | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
cache: "pip" # caching pip dependencies | |
- name: Install test dependencies | |
shell: cmd | |
run: | | |
pip3 install -r projects/extension/requirements-test.txt | |
- name: Build and install extension | |
shell: cmd | |
env: | |
PGAI_EXT_SKIP_BUILD_CHECKS: "true" | |
run: | | |
just ext build-install | |
- name: Run test server | |
shell: cmd | |
env: | |
PYTHONUTF8: 1 | |
run: | | |
start /b python3 -m fastapi dev projects/extension/tests/vectorizer/server.py | |
- name: Run test | |
shell: cmd | |
run: | | |
just ext test | |
build-and-test-pgai: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/install-action@just | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "0.4.29" | |
enable-cache: true | |
cache-dependency-glob: "./projects/pgai/uv.lock" | |
- name: "Set up Python" | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: "./projects/pgai/.python-version" | |
- name: Install dependencies | |
working-directory: ./projects/pgai | |
run: uv sync | |
- name: Lint | |
run: just pgai lint | |
- name: Check Typing | |
run: just pgai type-check | |
- name: Check Formatting | |
run: just pgai format | |
- name: Run Tests | |
run: just pgai test | |
- name: Build the pgai distributable and check artifacts | |
run: just pgai build |