diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index a55c6ab..f7faeb3 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -19,8 +19,32 @@ on: default: 'CRITICAL,HIGH' jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10","3.11","3.12","3.13"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Run unit tests + run: | + python -m unittest tests/*.py + build-and-pubish: name: Build and publish Python packages to PyPi + needs: unit-tests uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-publish-to-pypi-versioned.yaml@v3 with: release_type: ${{ inputs.release_type }} diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 68fe5da..1033265 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -2,8 +2,31 @@ name: Build and Test on: [pull_request, push, workflow_dispatch] jobs: - build: + vulnerability-scan: uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-build-and-test.yaml@v3 secrets: inherit with: vulnerability_scan_only: true + + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10","3.11","3.12","3.13"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e .[dev] + + - name: Run unit tests + run: | + python -m unittest tests/*.py diff --git a/Dockerfile.dev b/Dockerfile.dev index 60fe2b6..d3d0530 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,3 +1,3 @@ -FROM python:3.8 +FROM python:3.10 COPY . /build RUN pip install --no-cache-dir -e /build[dev] diff --git a/pyproject.toml b/pyproject.toml index e08a110..f699236 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,14 @@ [build-system] requires = [ - "setuptools == 68.2.2", + "setuptools < 81", "wheel", ] build-backend = "setuptools.build_meta" +[tool.setuptools.packages.find] +include = ["uid2_client*"] +exclude = ["tests*", "examples*"] + [project] name = "uid2_client" version = "2.7.0" @@ -18,13 +22,19 @@ classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ] -requires-python = ">=3.6" +requires-python = ">=3.8" dependencies = [ - "setuptools", "pycryptodome", "bitarray" ] -keywords = ["uid2"] + +[project.optional-dependencies] +dev = [ + "pytest", + "pytest-cov", + "unittest-xml-reporting" +] +keywords = ["uid2","euid"] [project.license] file="LICENSE" [project.urls] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 31eb46d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,39 +0,0 @@ -[metadata] -name = uid2-client -author = UID2 team -author_email = unifiedid-admin@thetradedesk.com -home_page = https://iabtechlab.com -description = Client for working with advertising UID2 services -long_description = file: README.md -long_description_content_type = text/markdown -platform = any -# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers -classifiers = - Development Status :: 3 - Alpha - Environment :: Console - Intended Audience :: Other Audience - Natural Language :: English - Operating System :: OS Independent - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Topic :: Internet - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Utilities - License :: OSI Approved :: Apache 2.0 - -[options] -zip_safe = true -packages = find: -include_package_data = true - -[options.packages.find] -exclude = examples, tests - -[bdist_wheel] -universal = false - -[sdist] -formats = zip, gztar diff --git a/setup.py b/setup.py deleted file mode 100644 index 1abbd06..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -import setuptools - -if __name__ == "__main__": - setuptools.setup() diff --git a/tests/test_bidstream_client.py b/tests/test_bidstream_client.py index 463fa8e..5df9b1c 100644 --- a/tests/test_bidstream_client.py +++ b/tests/test_bidstream_client.py @@ -2,7 +2,7 @@ import unittest from unittest.mock import patch -from test_utils import * +from .test_utils import * from uid2_client import BidstreamClient, Uid2Base64UrlCoder, DecryptionStatus, Uid2ClientFactory from uid2_client.refresh_response import RefreshResponse diff --git a/tests/test_client.py b/tests/test_client.py index 84fcef8..73e9ecc 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1,7 +1,7 @@ import unittest from unittest.mock import patch -from test_utils import * +from .test_utils import * from uid2_client import * from uid2_client.euid_client_factory import EuidClientFactory from uid2_client.refresh_response import RefreshResponse diff --git a/tests/test_encryption.py b/tests/test_encryption.py index f79e651..f971e49 100644 --- a/tests/test_encryption.py +++ b/tests/test_encryption.py @@ -1,6 +1,6 @@ import unittest -from test_utils import * +from .test_utils import * from uid2_client import * _master_secret = bytes([139, 37, 241, 173, 18, 92, 36, 232, 165, 168, 23, 18, 38, 195, 123, 92, 160, 136, 185, 40, 91, 173, 165, 221, 168, 16, 169, 164, 38, 139, 8, 155]) diff --git a/tests/test_refresh_keys_util.py b/tests/test_refresh_keys_util.py index 0ca0059..8eca05c 100644 --- a/tests/test_refresh_keys_util.py +++ b/tests/test_refresh_keys_util.py @@ -3,7 +3,7 @@ from unittest.mock import patch, MagicMock from uid2_client import refresh_keys_util, Uid2Response -from test_utils import * +from .test_utils import * from uid2_client.encryption import _encrypt_gcm, _decrypt_gcm diff --git a/tests/test_sharing.py b/tests/test_sharing.py index 203c292..5a1cfbe 100644 --- a/tests/test_sharing.py +++ b/tests/test_sharing.py @@ -2,7 +2,7 @@ from unittest.mock import patch from uid2_client import * -from test_utils import * +from .test_utils import * import datetime as dt diff --git a/tests/test_sharing_client.py b/tests/test_sharing_client.py index a9e2d3b..f112120 100644 --- a/tests/test_sharing_client.py +++ b/tests/test_sharing_client.py @@ -2,9 +2,9 @@ import unittest from unittest.mock import patch -from test_utils import * -from test_bidstream_client import TestBidStreamClient -from test_encryption import TestEncryptionFunctions +from .test_utils import * +from .test_bidstream_client import TestBidStreamClient +from .test_encryption import TestEncryptionFunctions from uid2_client import SharingClient, DecryptionStatus, Uid2ClientFactory from uid2_client.encryption_status import EncryptionStatus from uid2_client.refresh_response import RefreshResponse