diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..f6dcb01 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,97 @@ +name: Publish Python 🐍 distribution 📦 to PyPI + +on: + push: + tags: + - '*' + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - 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/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/evpn-connector + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + name: >- + Sign the Python 🐍 distribution 📦 with Sigstore + and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write # IMPORTANT: mandatory for making GitHub Releases + id-token: write # IMPORTANT: mandatory for sigstore + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + "$GITHUB_REF_NAME" + --repo "$GITHUB_REPOSITORY" + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + # Upload to GitHub Release using the `gh` CLI. + # `dist/` contains the built packages, and the + # sigstore-produced signatures and certificates. + run: >- + gh release upload + "$GITHUB_REF_NAME" dist/** + --repo "$GITHUB_REPOSITORY" diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..18e99e1 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,46 @@ +name: tests + +on: + push: + pull_request: + +jobs: + Lint: + runs-on: ubuntu-24.04 + strategy: + fail-fast: true + matrix: + python-version: ["3.8"] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: pip install tox + - name: pep8 + run: | + tox -e pep8 + tests: + runs-on: ubuntu-24.04 + strategy: + fail-fast: true + matrix: + python-version: ["3.8"] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install required packages + run: | + sudo apt update + sudo apt install libev-dev -y + - name: Install tox + run: pip install tox + - name: Unit tests + run: | + tox -e ${{ matrix.python-version }} + # - name: Functional tests + # run: | + # tox -e ${{ matrix.python-version }}-functional diff --git a/evpn_connector/cmd/evpn.py b/evpn_connector/cmd/evpn.py index f386fa1..68b0b0d 100644 --- a/evpn_connector/cmd/evpn.py +++ b/evpn_connector/cmd/evpn.py @@ -20,12 +20,12 @@ import sys from oslo_config import cfg -from evpn_connector.common import log as evpn_log from evpn_connector.bgp import client as bgp_client from evpn_connector.common import conf_opts from evpn_connector.common import config from evpn_connector.common import constants +from evpn_connector.common import log as evpn_log from evpn_connector.common import metrics from evpn_connector.common import sentry from evpn_connector.ovs import client as ovs_client diff --git a/requirements.txt b/requirements.txt index 2952c1a..97427ad 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,5 +11,5 @@ enum34===1.1.6; python_version<'3.8' subprocess32===3.2.6;python_version=='2.7' # PSF sentry-sdk==1.5.2;python_version<'3.8' # BSD sentry-sdk==1.6.0;python_version>='3.8' # BSD -loopster>=2.9.1,<3.0.0 # Apache-2.0 +loopster>=2.14.4,<3.0.0 # Apache-2.0 obsender>=5.0.0,<6.0.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index bf9c6c3..2cfb59f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,6 +3,7 @@ name = evpn-connector summary = The main task of this daemon is to interact with the gobgp and ovs to provide a connection using the EVPN protocol description_file = README.md +long_description_content_type = text/markdown author = VK Tech author_email = digital.tech@corp.mail.ru home_page = https://github.com/vktechdev/evpn_connector @@ -15,6 +16,7 @@ classifier = Programming Language :: Python :: 2.7 Programming Language :: Python :: 3 Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.8 [files] packages = diff --git a/test-requirements.txt b/test-requirements.txt index f23f77b..8f12f67 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,7 @@ -hacking>=0.12.0,!=0.13.0,<0.14 # Apache-2.0 +hacking<3 # Apache-2.0 typing-extensions<4.2.0;python_version=='3.6' # PSF-2.0 pytest-timer pytest==4.6.1 coverage>=4.0 # Apache-2.0 mock==3.0.5 +flake8>=3.8.4 # Flake8 License (MIT)