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
57 changes: 11 additions & 46 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,15 @@
name: Release

on:
pull_request:
branches:
- "master"
- "ci"
- "[0-9]+.[0-9x]+*"
paths:
- "async_gaussdb/_version.py"
push:
tags:
- "*"

jobs:
validate-release-request:
runs-on: ubuntu-latest
steps:
- name: Validate release PR
uses: edgedb/action-release/validate-pr@master
id: checkver
with:
require_team: Release Managers
require_approval: no
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
version_file: async_gaussdb/_version.py
version_line_pattern: |
__version__(?:\s*:\s*typing\.Final)?\s*=\s*(?:['"])([[:PEP440:]])(?:['"])

- name: Stop if not approved
if: steps.checkver.outputs.approved != 'true'
run: |
echo ::error::PR is not approved yet.
exit 1

- name: Store release version for later use
env:
VERSION: ${{ steps.checkver.outputs.version }}
run: |
mkdir -p dist/
echo "${VERSION}" > dist/VERSION

- uses: actions/upload-artifact@v4
with:
name: dist-version
path: dist/VERSION
permissions:
contents: write

jobs:
build-sdist:
needs: validate-release-request
runs-on: ubuntu-latest

env:
Expand Down Expand Up @@ -71,7 +37,6 @@ jobs:
path: dist/*.tar.*

build-wheels-matrix:
needs: validate-release-request
runs-on: ubuntu-latest
outputs:
include: ${{ steps.set-matrix.outputs.include }}
Expand Down Expand Up @@ -119,7 +84,7 @@ jobs:
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2

- uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b # v2.21.3
- uses: pypa/cibuildwheel@7940a4c0e76eb2030e473a5f864f291f63ee879b
with:
only: ${{ matrix.only }}
env:
Expand Down Expand Up @@ -214,8 +179,8 @@ jobs:
id: relver
run: |
set -e
echo "version=$(cat dist/VERSION)" >> $GITHUB_OUTPUT
rm dist/VERSION
# 从标签中提取版本
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Merge and tag the PR
uses: edgedb/action-release/merge@master
Expand All @@ -233,8 +198,8 @@ jobs:
with:
tag_name: v${{ steps.relver.outputs.version }}
release_name: v${{ steps.relver.outputs.version }}
target: ${{ github.event.pull_request.base.ref }}
body: ${{ github.event.pull_request.body }}
target: ${{ github.ref }} # 使用提交的标签作为目标
body: "Release v${{ steps.relver.outputs.version }}"

- run: |
ls -al dist/
Expand Down
100 changes: 36 additions & 64 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
loop: [asyncio, uvloop]
exclude:
# uvloop does not support windows
Expand All @@ -33,6 +33,18 @@ jobs:

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
services:
opengauss:
image: opengauss/opengauss-server:latest
ports:
- 5432:5432
env:
GS_USERNAME: testuser
GS_USER_PASSWORD: Test@123
GS_PASSWORD: Test@123
options: >-
--privileged=true
--name opengauss-custom

steps:
- uses: actions/checkout@v4
Expand All @@ -50,11 +62,6 @@ jobs:
version_line_pattern: |
__version__(?:\s*:\s*typing\.Final)?\s*=\s*(?:['"])([[:PEP440:]])(?:['"])

- name: Setup PostgreSQL
if: "!steps.release.outputs.is_release && matrix.os == 'macos-latest'"
run: |
brew install postgresql

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: "!steps.release.outputs.is_release"
Expand All @@ -67,80 +74,45 @@ jobs:
[ "$RUNNER_OS" = "Linux" ] && .github/workflows/install-krb5.sh
python -m pip install -U pip setuptools wheel
python -m pip install -e .[test]

- name: Wait for openGauss to be ready
env:
GSQL_PASSWORD: Test@123
run: |
for i in {1..30}; do
pg_isready -h localhost -p 5432 -U testuser && break
sleep 10
done
if ! pg_isready -h localhost -p 5432 -U testuser; then
echo "openGauss is not ready"
exit 1
fi

- name: Create test database
run: |
docker exec opengauss-custom bash -c "su - omm -c 'gsql -d postgres -c \"CREATE DATABASE test ;CREATE user user ;\"'"

- name: Test
if: "!steps.release.outputs.is_release"
env:
LOOP_IMPL: ${{ matrix.loop }}
PGHOST: "127.0.0.1"
PGPORT: 5432
PGUSER: "testuser"
PGPASSWORD: "Test@123"
PGDATABASE: "test"
run: |
if [ "${LOOP_IMPL}" = "uvloop" ]; then
env USE_UVLOOP=1 python -m unittest -v tests.suite
else
python -m unittest -v tests.suite
fi

test-postgres:
strategy:
matrix:
postgres-version: ["9.5", "9.6", "10", "11", "12", "13", "14", "15", "16", "17"]

runs-on: ubuntu-latest

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 50
submodules: true

- name: Check if release PR.
uses: edgedb/action-release/validate-pr@master
id: release
with:
github_token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
missing_version_ok: yes
version_file: async_gaussdb/_version.py
version_line_pattern: |
__version__(?:\s*:\s*typing\.Final)?\s*=\s*(?:['"])([[:PEP440:]])(?:['"])

- name: Set up PostgreSQL
if: "!steps.release.outputs.is_release"
env:
PGVERSION: ${{ matrix.postgres-version }}
DISTRO_NAME: focal
run: |
sudo env DISTRO_NAME="${DISTRO_NAME}" PGVERSION="${PGVERSION}" \
.github/workflows/install-postgres.sh
echo PGINSTALLATION="/usr/lib/postgresql/${PGVERSION}/bin" \
>> "${GITHUB_ENV}"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
if: "!steps.release.outputs.is_release"
with:
python-version: "3.x"

- name: Install Python Deps
if: "!steps.release.outputs.is_release"
run: |
[ "$RUNNER_OS" = "Linux" ] && .github/workflows/install-krb5.sh
python -m pip install -U pip setuptools wheel
python -m pip install -e .[test]

- name: Test
if: "!steps.release.outputs.is_release"
env:
PGVERSION: ${{ matrix.postgres-version }}
run: |
python -m unittest -v tests.suite

# This job exists solely to act as the test job aggregate to be
# targeted by branch policies.
regression-tests:
name: "Regression Tests"
needs: [test-platforms, test-postgres]
needs: [test-platforms]
runs-on: ubuntu-latest

steps:
Expand Down
50 changes: 6 additions & 44 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
async_gaussdb-gaussdb -- A fast GaussDB/openGauss Database Client Library for Python/asyncio
async_gaussdb -- A fast GaussDB/openGauss Database Client Library for Python/asyncio
=====================================================================================

.. image:: https://github.com/MagicStack/async_gaussdb/workflows/Tests/badge.svg
Expand All @@ -7,12 +7,12 @@ async_gaussdb-gaussdb -- A fast GaussDB/openGauss Database Client Library for Py
.. image:: https://img.shields.io/pypi/v/async_gaussdb.svg
:target: https://pypi.python.org/pypi/async_gaussdb

**async_gaussdb-gaussdb** is a database interface library designed specifically for
**async_gaussdb** is a database interface library designed specifically for
GaussDB and openGauss databases with Python/asyncio. This fork of async_gaussdb is
optimized for GaussDB/openGauss compatibility, including native SHA256
authentication support and enhanced features for enterprise database environments.

async_gaussdb-gaussdb requires Python 3.8 or later and is specifically designed for
async_gaussdb requires Python 3.8 or later and is specifically designed for
GaussDB and openGauss databases. It includes compatibility fixes and
optimizations for openGauss-specific features and enterprise database requirements.

Expand All @@ -24,31 +24,10 @@ optimizations for openGauss-specific features and enterprise database requiremen
* Comprehensive test suite adapted for openGauss


Documentation
-------------

The project documentation can be found
`here <https://magicstack.github.io/async_gaussdb/current/>`_.


Performance
-----------

async_gaussdb-gaussdb maintains the high performance characteristics of the original
async_gaussdb library while being optimized for GaussDB/openGauss environments.

.. image:: https://raw.githubusercontent.com/MagicStack/async_gaussdb/master/performance.png?fddca40ab0
:target: https://gistpreview.github.io/?0ed296e93523831ea0918d42dd1258c2

The above results are a geometric mean of benchmarks obtained with PostgreSQL
`client driver benchmarking toolbench <https://github.com/MagicStack/pgbench>`_
in June 2023 (click on the chart to see full details).


Features
--------

async_gaussdb-gaussdb implements the GaussDB/openGauss server protocol natively and
async_gaussdb implements the GaussDB/openGauss server protocol natively and
exposes its features directly, optimized for enterprise database environments:

* **SHA256 authentication** - Native support for GaussDB/openGauss authentication
Expand All @@ -65,7 +44,7 @@ exposes its features directly, optimized for enterprise database environments:
Installation
------------

async_gaussdb-gaussdb is available on PyPI. When not using GSSAPI/SSPI authentication it
async_gaussdb is available on PyPI. When not using GSSAPI/SSPI authentication it
has no dependencies. Use pip to install::

$ pip install async-gaussdb
Expand Down Expand Up @@ -137,21 +116,4 @@ This library includes enhanced support for GaussDB and openGauss databases:
asyncio.run(run())


Development with Docker
----------------------

A Dockerfile is provided for development with openGauss:

.. code-block:: bash

# Build the development image
docker build -t async_gaussdb-gaussdb-dev .

# Run the container
docker run -it async_gaussdb-gaussdb-dev


License
-------

async_gaussdb-gaussdb is developed and distributed under the Apache 2.0 license.
asyncpg is developed and distributed under the Apache 2.0 license.
6 changes: 1 addition & 5 deletions tests/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import warnings
import weakref

import distro

import async_gaussdb
from async_gaussdb import _testbase as tb
from async_gaussdb import connection as pg_connection
Expand Down Expand Up @@ -390,8 +388,7 @@ async def test_auth_md5_unsupported(self, _):
await self.connect(user='md5_user', password=CORRECT_PASSWORD)


@unittest.skipIf(
distro.id() == "alpine",
@unittest.skip(
"Alpine Linux ships GaussDBSQL without GSS auth support",
)
class TestGssAuthentication(BaseTestAuthentication):
Expand All @@ -411,7 +408,6 @@ def setUpClass(cls):
# Add credentials.
cls.realm.addprinc('gaussdb/localhost')
cls.realm.extract_keytab('gaussdb/localhost', cls.realm.keytab)

cls.USERS = [
(cls.realm.user_princ, 'gss', None),
(f'wrong-{cls.realm.user_princ}', 'gss', None),
Expand Down