Rebrand psycopg to gaussdb #1
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: Build binary packages | |
| # Note: Libpq is currently built from source on most platforms and the build | |
| # artifacts are cached across pipeline runs. | |
| # | |
| # You can see the caches at https://github.com/gaussdb/gaussdb/actions/caches | |
| # | |
| # You can delete a cache using: | |
| # | |
| # curl -L -X DELETE | |
| # -H "Accept: application/vnd.github+json" | |
| # -H "Authorization: Bearer $GITHUB_TOKEN" | |
| # -H "X-GitHub-Api-Version: 2022-11-28" | |
| # "https://api.github.com/repos/gaussdb/gaussdb/actions/caches?key=libpq-manylinux-ppc64le-17.2-3.4.0" | |
| # | |
| # ref: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-github-actions-caches-for-a-repository-using-a-cache-key | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - '.github/workflows/packages-bin.yml' | |
| schedule: | |
| - cron: '28 7 * * sun' | |
| env: | |
| # Latest release: https://www.postgresql.org/ftp/source/ | |
| LIBPQ_VERSION: "17.4" | |
| # Latest release: https://www.openssl.org/source/ | |
| OPENSSL_VERSION: "3.4.1" | |
| concurrency: | |
| # Cancel older requests of the same workflow in the same branch. | |
| group: ${{ github.workflow }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| linux: # {{{ | |
| runs-on: ubuntu-latest | |
| if: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [x86_64, i686, ppc64le, aarch64] | |
| pyver: [cp39, cp310, cp311, cp312, cp313] | |
| platform: [manylinux, musllinux] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU for multi-arch build | |
| # Check https://github.com/docker/setup-qemu-action for newer versions. | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| # https://github.com/pypa/cibuildwheel/discussions/2256 | |
| image: tonistiigi/binfmt:qemu-v8.1.5 | |
| - name: Cache libpq build | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/libpq.build | |
| key: libpq-${{ matrix.platform }}-${{ matrix.arch }}-${{ env.LIBPQ_VERSION }}-${{ env.OPENSSL_VERSION }} | |
| - name: Create the binary package source tree | |
| run: python3 ./tools/ci/copy_to_binary.py | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| with: | |
| package-dir: gaussdb_binary | |
| env: | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
| CIBW_MANYLINUX_I686_IMAGE: manylinux2014 | |
| CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | |
| CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux2014 | |
| CIBW_BUILD: ${{matrix.pyver}}-${{matrix.platform}}_${{matrix.arch}} | |
| CIBW_ARCHS_LINUX: auto aarch64 ppc64le | |
| CIBW_BEFORE_ALL_LINUX: ./tools/ci/wheel_linux_before_all.sh | |
| CIBW_REPAIR_WHEEL_COMMAND: >- | |
| ./tools/ci/strip_wheel.sh {wheel} | |
| && auditwheel repair -w {dest_dir} {wheel} | |
| CIBW_TEST_REQUIRES: ./gaussdb[test] ./gaussdb_pool | |
| CIBW_TEST_COMMAND: >- | |
| pytest {project}/tests -m 'not slow and not flakey' --color yes | |
| CIBW_ENVIRONMENT_PASS_LINUX: LIBPQ_VERSION OPENSSL_VERSION | |
| CIBW_ENVIRONMENT: >- | |
| GAUSSDB_IMPL=binary | |
| GAUSSDB_TEST_DSN='host=172.17.0.1 user=postgres' | |
| PGPASSWORD=password | |
| LIBPQ_BUILD_PREFIX=/host/tmp/libpq.build | |
| PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH" | |
| LD_LIBRARY_PATH="$LIBPQ_BUILD_PREFIX/lib:$LIBPQ_BUILD_PREFIX/lib64" | |
| GAUSSDB_TEST_WANT_LIBPQ_BUILD=${{ env.LIBPQ_VERSION }} | |
| GAUSSDB_TEST_WANT_LIBPQ_IMPORT=${{ env.LIBPQ_VERSION }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-${{matrix.pyver}}-${{matrix.platform}}_${{matrix.arch}} | |
| path: ./wheelhouse/*.whl | |
| services: | |
| postgresql: | |
| image: postgres:14 | |
| env: | |
| POSTGRES_PASSWORD: password | |
| ports: | |
| - 5432:5432 | |
| # Set health checks to wait until postgres has started | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| # }}} | |
| macos: # {{{ | |
| runs-on: macos-latest | |
| if: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [x86_64, arm64] | |
| pyver: [cp39, cp310, cp311, cp312, cp313] | |
| steps: | |
| - name: Checkout repos | |
| uses: actions/checkout@v4 | |
| - name: Cache libpq build | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/libpq.build | |
| key: libpq-${{ env.LIBPQ_VERSION }}-macos-${{ matrix.arch }}-${{ env.OPENSSL_VERSION }} | |
| - name: Create the binary package source tree | |
| run: python3 ./tools/ci/copy_to_binary.py | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| with: | |
| package-dir: gaussdb_binary | |
| env: | |
| CIBW_BUILD: ${{matrix.pyver}}-macosx_${{matrix.arch}} | |
| CIBW_ARCHS_MACOS: ${{matrix.arch}} | |
| MACOSX_ARCHITECTURE: ${{matrix.arch}} | |
| CIBW_BEFORE_ALL_MACOS: ./tools/ci/wheel_macos_before_all.sh | |
| CIBW_TEST_REQUIRES: ./gaussdb[test] ./gaussdb_pool | |
| CIBW_TEST_COMMAND: >- | |
| pytest {project}/tests -m 'not slow and not flakey' --color yes | |
| CIBW_ENVIRONMENT: >- | |
| PG_VERSION=17 | |
| GAUSSDB_IMPL=binary | |
| GAUSSDB_TEST_DSN='dbname=postgres' | |
| LIBPQ_BUILD_PREFIX=/tmp/libpq.build | |
| PATH="$LIBPQ_BUILD_PREFIX/bin:$PATH" | |
| GAUSSDB_TEST_WANT_LIBPQ_BUILD=">= ${{env.LIBPQ_VERSION}}" | |
| GAUSSDB_TEST_WANT_LIBPQ_IMPORT=">= ${{env.LIBPQ_VERSION}}" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-${{matrix.pyver}}-${{matrix.arch}} | |
| path: ./wheelhouse/*.whl | |
| # }}} | |
| windows: # {{{ | |
| runs-on: windows-latest | |
| if: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Might want to add win32, untested at the moment. | |
| arch: [win_amd64] | |
| pyver: [cp39, cp310, cp311, cp312, cp313] | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # there are some other libpq in PATH | |
| - run: rm -rf c:/tools/php C:/Strawberry/c/bin | |
| - uses: actions/checkout@v4 | |
| - name: Start PostgreSQL service for test | |
| run: | | |
| $PgSvc = Get-Service "postgresql*" | |
| Set-Service $PgSvc.Name -StartupType manual | |
| $PgSvc.Start() | |
| shell: powershell | |
| - uses: prefix-dev/[email protected] | |
| with: | |
| run-install: false | |
| - run: pixi global install libpq=${{ env.LIBPQ_VERSION }} --with openssl=${{ env.OPENSSL_VERSION }} | |
| - run: echo "EXTRA_LIB_DIR=$(pg_config.exe --bindir)" >> $GITHUB_OUTPUT | |
| id: libdir | |
| - name: Create the binary package source tree | |
| run: python3 ./tools/ci/copy_to_binary.py | |
| - name: Build wheels | |
| uses: pypa/[email protected] | |
| with: | |
| package-dir: gaussdb_binary | |
| env: | |
| VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" # cache vcpkg | |
| CIBW_BUILD: ${{matrix.pyver}}-${{matrix.arch}} | |
| CIBW_ARCHS_WINDOWS: AMD64 x86 | |
| CIBW_BEFORE_BUILD_WINDOWS: '.\tools\ci\wheel_win32_before_build.bat' | |
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- | |
| delvewheel repair -w {dest_dir} | |
| --add-path="${{ steps.libdir.outputs.EXTRA_LIB_DIR }}" | |
| --no-mangle "libiconv-2.dll;libwinpthread-1.dll" {wheel} | |
| CIBW_TEST_REQUIRES: ./gaussdb[test] ./gaussdb_pool | |
| CIBW_TEST_COMMAND: >- | |
| pytest {project}/tests -m "not slow and not flakey" --color yes | |
| CIBW_ENVIRONMENT_WINDOWS: >- | |
| GAUSSDB_IMPL=binary | |
| GAUSSDB_TEST_DSN="host=127.0.0.1 user=postgres" | |
| GAUSSDB_TEST_WANT_LIBPQ_BUILD=${{env.LIBPQ_VERSION}} | |
| GAUSSDB_TEST_WANT_LIBPQ_IMPORT=${{env.LIBPQ_VERSION}} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-${{matrix.pyver}}-${{matrix.arch}} | |
| path: ./wheelhouse/*.whl | |
| # }}} | |
| merge: # {{{ | |
| runs-on: ubuntu-latest | |
| needs: | |
| - linux | |
| - macos | |
| - windows | |
| steps: | |
| - name: Merge Artifacts | |
| uses: actions/upload-artifact/merge@v4 | |
| with: | |
| name: gaussdb-binary-artifact | |
| delete-merged: true | |
| # }}} |