fix: wait for postmaster to fully exit on stop (#17) (#18) #58
This file contains hidden or 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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| name: Build CLI | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build | |
| run: cargo build --release | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pg0-macos | |
| path: target/release/pg0 | |
| # Mirrors the windows-x86_64 build step in release-cli.yml so CI exercises | |
| # the exact same compile path that produces the shipped Windows executable. | |
| build-windows: | |
| name: Build CLI (Windows) | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-pc-windows-msvc | |
| - name: Build | |
| run: cargo build --release --target x86_64-pc-windows-msvc | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pg0-windows | |
| path: target/x86_64-pc-windows-msvc/release/pg0.exe | |
| sdk-tests: | |
| name: SDK Tests (macOS) | |
| needs: build | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download CLI | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pg0-macos | |
| path: ~/.local/bin | |
| - name: Make CLI executable | |
| run: chmod +x ~/.local/bin/pg0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Run Python SDK tests | |
| working-directory: sdk/python | |
| run: | | |
| export PATH="$HOME/.local/bin:$PATH" | |
| uv pip install --system -e ".[dev]" | |
| pytest tests/ -v | |
| sdk-tests-windows: | |
| name: SDK Tests (Windows) | |
| needs: build-windows | |
| runs-on: windows-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download CLI | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pg0-windows | |
| path: pg0-bin | |
| - name: Put CLI on PATH | |
| shell: pwsh | |
| run: | | |
| $dest = "$env:USERPROFILE\pg0-bin" | |
| New-Item -ItemType Directory -Force -Path $dest | Out-Null | |
| Copy-Item pg0-bin\pg0.exe $dest\pg0.exe | |
| Add-Content $env:GITHUB_PATH $dest | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Run Python SDK tests | |
| working-directory: sdk/python | |
| shell: pwsh | |
| run: | | |
| uv pip install --system -e ".[dev]" | |
| pytest tests/ -v | |
| # Docker tests - one job per platform, runs both CLI and Python SDK tests | |
| # Note: ARM64 tests are skipped because QEMU emulation is too slow for PostgreSQL setup | |
| docker-tests: | |
| name: Docker Tests (${{ matrix.platform }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: debian-amd64 | |
| cli_script: docker-tests/test_debian_amd64.sh | |
| python_script: docker-tests/python/test_debian_amd64.sh | |
| needs_local_binary: false | |
| - platform: alpine-amd64 | |
| cli_script: docker-tests/test_alpine_amd64.sh | |
| python_script: docker-tests/python/test_alpine_amd64.sh | |
| needs_local_binary: false | |
| # Ubuntu 24.04 + 25.10. 25.10 only works with the libxml2/ICU | |
| # bundling added in this binary, so the test must run against a | |
| # fresh local build rather than the latest released artifact. | |
| - platform: ubuntu-amd64 | |
| cli_script: docker-tests/test_ubuntu_amd64.sh | |
| python_script: "" | |
| needs_local_binary: true | |
| - platform: missing-libs-debian-amd64 | |
| cli_script: docker-tests/test_missing_libs.sh | |
| python_script: "" | |
| needs_local_binary: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| if: matrix.needs_local_binary | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build Linux binary | |
| if: matrix.needs_local_binary | |
| run: | | |
| cargo build --release | |
| echo "PG0_BINARY_PATH=$(pwd)/target/release/pg0" >> $GITHUB_ENV | |
| - name: Run CLI Docker test | |
| run: | | |
| chmod +x ${{ matrix.cli_script }} | |
| bash ${{ matrix.cli_script }} | |
| - name: Run Python SDK Docker test | |
| if: matrix.python_script != '' | |
| run: | | |
| chmod +x ${{ matrix.python_script }} | |
| bash ${{ matrix.python_script }} | |
| # Python wheel builds - test that wheel building works | |
| python-wheels: | |
| name: Python Wheels | |
| uses: ./.github/workflows/build-python-wheels.yml | |
| with: | |
| upload-artifacts: false | |
| test-wheels: true | |
| # Test installing from sdist (source distribution) | |
| python-sdist-install: | |
| name: Python sdist Install | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| - name: Build sdist | |
| working-directory: sdk/python | |
| run: uv build --sdist | |
| - name: Install from sdist in isolated environment | |
| run: | | |
| # Create a fresh directory outside the repo to simulate user install | |
| mkdir /tmp/sdist-test | |
| cp sdk/python/dist/*.tar.gz /tmp/sdist-test/ | |
| cd /tmp/sdist-test | |
| # Install from sdist (this should download binary from GitHub releases) | |
| pip install *.tar.gz -v 2>&1 | tee install.log | |
| # Verify the download happened | |
| grep -q "Downloading pg0" install.log || echo "Warning: Download message not found" | |
| # Verify the package works | |
| python -c "from pg0 import Pg0; print('Import successful')" | |
| python -c "from pg0 import _get_bundled_binary; assert _get_bundled_binary() is not None, 'Binary not bundled'; print('Binary bundled correctly')" |