diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..582ca95 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,33 @@ +name: CI + +on: + - push + - pull_request + +jobs: + coverage: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements_dev.txt . + - name: Pre-commit + uses: pre-commit/action@v3.0.1 + - name: Tests + run: pytest --cov=onvif --cov-report=term-missing --cov-report=xml tests + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5.0.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} # required diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..d4ffebf --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,53 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + deploy: + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + runs-on: ubuntu-latest + needs: + - build + name: >- + Publish Python 🐍 distribution 📦 to PyPI + environment: + name: pypi + url: https://pypi.org/p/onvif-zeep-async + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 920e8de..82e6130 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks exclude: "CHANGELOG.md|.copier-answers.yml|.all-contributorsrc" -default_stages: [pre-commit] +default_stages: [commit] ci: autofix_commit_msg: "chore(pre-commit.ci): auto fixes" diff --git a/requirements.txt b/requirements.txt index 26e3ef2..5a96384 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,18 +1,3 @@ # Package -httpx==0.19.0 +httpx==0.28.0 zeep[async]==4.3.1 - -# Dev -pytest -pytest-cov -pylint - -# pre-commit -pre-commit==2.7.1 -pyupgrade==3.19.0 -black==20.8b1 -flake8==7.1.1 -# flake8-docstrings==1.5.0 -pydocstyle==6.3.0 -bandit==1.6.2 -isort==5.13.2 diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..4bb1a5a --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,11 @@ +# Package +-r requirements.txt + +# Dev +pytest +pytest-cov +pytest-asyncio +pylint + +# pre-commit +pre-commit==2.7.1