v0.1.3 #22
Workflow file for this run
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: Build and Test | |
on: | |
push: | |
branches: | |
- testing | |
- main | |
release: | |
types: | |
- created | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: macos-12 | |
arch: x86_64 | |
deployment-target: '12.0' | |
- os: macos-latest | |
arch: arm64 | |
deployment-target: '14.0' | |
- os: ubuntu-latest | |
arch: x86_64 | |
deployment-target: '' | |
- os: windows-2022 | |
arch: AMD64 | |
deployment-target: '' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
if: matrix.os != 'ubuntu-latest' | |
with: | |
python-version: '3.10' | |
- uses: actions/setup-python@v4 | |
if: matrix.os == 'ubuntu-latest' | |
# for testing due to docker env issues | |
with: | |
python-version: '3.9' | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade cibuildwheel | |
- name: Restore postgres build from cache | |
if: ${{ matrix.os != 'ubuntu-latest' }} | |
id: restore-postgres | |
uses: actions/cache/restore@v3 | |
env: | |
cache-name: cache-postgres | |
with: | |
path: | | |
pgbuild | |
src/pgserver/pginstall | |
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile', 'pgbuild/Makefile') }} | |
- name: Build postgres and pgvector | |
if: ${{ matrix.os != 'ubuntu-latest' && ! steps.restore-postgres.outputs.cache-hit }} | |
# this step is implied by Build wheels, but we do it here for caching before python tests run | |
# on ubuntu, cibuildwheel will run this step within a docker container, so it cannot use the cache this way | |
run: make | |
- name: Save postgres build | |
if: ${{ matrix.os != 'ubuntu-latest' && ! steps.restore-postgres.outputs.cache-hit }} | |
id: cache-postgres | |
uses: actions/cache/save@v3 | |
env: | |
cache-name: cache-postgres | |
with: | |
path: | | |
pgbuild | |
src/pgserver/pginstall | |
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile', 'pgbuild/Makefile') }} | |
- name: Build wheels | |
env: | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_SKIP: pp* cp38-* *-musllinux* | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment-target }} | |
run: python -m cibuildwheel --output-dir wheelhouse | |
- name: Save postgres build | |
if: ${{ matrix.os == 'ubuntu-latest' && ! steps.restore-postgres.outputs.cache-hit }} | |
id: cache-postgres2 | |
uses: actions/cache/save@v3 | |
env: | |
cache-name: cache-postgres | |
with: | |
path: | | |
pgbuild | |
src/pgserver/pginstall | |
key: ${{ runner.os }}-${{ runner.arch }}-build-${{ env.cache-name }}-${{ hashFiles('Makefile', 'pgbuild/Makefile') }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: wheelhouse/*.whl | |
name: python-package-distributions | |
publish-to-pypi: | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
name: Publish Python dist to PyPI | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pgserver # Replace <package-name> with your PyPI project name | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |