diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index c7877329..6ec0d919 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -28,6 +28,8 @@ jobs: - python-version: "3.14" python-tag: "314" architecture: "AMD64" + + steps: - uses: actions/checkout@v4 @@ -47,6 +49,7 @@ jobs: run: | python scripts/generate_meson.py ./src/dbzero/ core python scripts/generate_meson_tests.py tests/ + python scripts/generate_meson_dbzero.py dbzero/ - name: Configure git run: | @@ -80,6 +83,7 @@ jobs: - uses: actions/checkout@v3 - run: python3 scripts/generate_meson.py ./src/dbzero/ core - run: python3 scripts/generate_meson_tests.py tests/ + - run: python3 scripts/generate_meson_dbzero.py dbzero/ - run: git config --global user.email "you@example.com" - run: git config --global user.name "Your Name" - run: rm .gitignore @@ -97,6 +101,77 @@ jobs: name: wheels-linux-${{ matrix.python-version }} path: dist/*.whl + test-wheels-windows: + runs-on: windows-latest + needs: wheels-windows + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.10" + python-tag: "310" + architecture: "AMD64" + - python-version: "3.11" + python-tag: "311" + architecture: "AMD64" + - python-version: "3.12" + python-tag: "312" + architecture: "AMD64" + - python-version: "3.13" + python-tag: "313" + architecture: "AMD64" + - python-version: "3.14" + python-tag: "314" + architecture: "AMD64" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: wheels-windows-${{ matrix.python-version }} + path: ./wheels/ + - name: Install wheel and dependencies + run: | + pip install pytest + pip install -r requirements.txt + Get-ChildItem -Path "./wheels/*.whl" | ForEach-Object { pip install $_.FullName } + shell: powershell + - name: Run tests + run: | + python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv + + test-wheels-linux: + runs-on: ubuntu-latest + needs: wheels-linux + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: wheels-linux-${{ matrix.python-version }} + path: ./wheels/ + - name: Install wheel and dependencies + run: | + pip install pytest + pip install -r requirements.txt + pip install ./wheels/*.whl + - name: Run tests + run: | + python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv + sdist: runs-on: ubuntu-latest steps: @@ -105,6 +180,7 @@ jobs: run: | python scripts/generate_meson.py ./src/dbzero/ core python scripts/generate_meson_tests.py tests/ + python scripts/generate_meson_dbzero.py dbzero/ - name: Configure git run: | @@ -122,7 +198,7 @@ jobs: deploy-to-pypi: name: Deploy to PyPI (Manual) runs-on: ubuntu-latest - needs: [sdist, wheels-linux, wheels-windows] + needs: [sdist, test-wheels-windows] if: github.event_name == 'workflow_dispatch' environment: pypi-deployment permissions: diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 00000000..4e62c28e --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,72 @@ +name: Build and Deploy Packages +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build-linux: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v3 + - run: python3 scripts/generate_meson.py ./src/dbzero/ core + - run: python3 scripts/generate_meson_tests.py tests/ + - run: python3 scripts/generate_meson_dbzero.py dbzero/ + - run: git config --global user.email "you@example.com" + - run: git config --global user.name "Your Name" + - run: rm .gitignore + - run: git add . && git commit -m "Update meson files" + - run: pip install build + - run: python3 -m build + env: + CIBW_SKIP: pp* cp36-* *-musllinux* + CIBW_ARCHS_MACOS: x86_64 arm64 + CIBW_ARCHS_LINUX: x86_64 aarch64 + CIBW_ARCHS_WINDOWS: ${{ matrix.architecture }} + + - uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.python-version }} + path: dist/*.whl + + test-wheels-linux: + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: build-linux + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: wheels-linux-${{ matrix.python-version }} + path: ./wheels/ + - name: Install wheel and dependencies + run: | + pip install pytest + pip install -r requirements.txt + pip install ./wheels/*.whl + - name: Run tests + run: | + python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv + diff --git a/requirements.txt b/requirements.txt index 157e159e..69621f6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,5 @@ pytest==7.2.1 pytest-asyncio==0.23.8 build==0.10.0 meson-python==0.13.2 -patchelf==0.17.2.1 fasteners==0.19 -psutil==7.0.0 \ No newline at end of file +psutil==7.0.0 diff --git a/src/dbzero/bindings/python/collections/PyDict.cpp b/src/dbzero/bindings/python/collections/PyDict.cpp index 47132c54..b4392d62 100644 --- a/src/dbzero/bindings/python/collections/PyDict.cpp +++ b/src/dbzero/bindings/python/collections/PyDict.cpp @@ -185,29 +185,39 @@ namespace db0::python { switch (op) { case Py_EQ: { - // First check sizes - if (dict_obj->ext().size() != PyDict_Size(other)) { + + // check sizes + + if(PyDict_Check(other)) { + if (dict_obj->ext().size() != (size_t)(PyDict_Size(other))) { + return PyBool_fromBool(false); + } + } else if (DictObject_Check(other)) { + DictObject * other_list = (DictObject*) other; + if (dict_obj->ext().size() != other_list->ext().size()) { + return PyBool_fromBool(false); + } + } else { + // false if types do not match return PyBool_fromBool(false); } - + + // Check all key-value pairs match auto iterator = Py_OWN(PyObject_GetIter(dict_obj)); if (!iterator) { return nullptr; } - ObjectSharedPtr key; Py_FOR(key, iterator) { auto our_value = Py_OWN(tryDictObject_GetItem(dict_obj, *key)); if (!our_value) { return nullptr; } - auto their_value = Py_OWN(PyDict_GetItem(other, *key)); if (!their_value) { return PyBool_fromBool(false); } - int cmp_result = PyObject_RichCompareBool(*our_value, *their_value, Py_EQ); if (cmp_result == -1) { return nullptr;