diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..5df5395 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,68 @@ +name: ci +on: push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Run Unit Test + run: | + cd python + tox -e unit + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Run Link + run: | + cd python + tox -e format + + release: + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + needs: [test, lint] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - name: Setup Go Environment + uses: actions/setup-go@v3 + with: + go-version: '>=1.20.0' + - name: Upload + run: | + mkdir -p build/ + cd python && python setup.py sdist + go get github.com/tcnksm/ghr + ghr -r ${{ github.event.repository.name }} -t ${{ secrets.GITHUB_TOKEN }} -replace -draft ${{ TAG_NAME }} build/ + + pypi: + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + needs: [test, lint] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install tox tox-gh-actions + - name: Publish + env: + TWINE_USERNAME: vaporio + TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} + run: | + cd python + tox -e publish diff --git a/.jenkins b/.jenkins deleted file mode 100644 index 1579b6c..0000000 --- a/.jenkins +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env groovy - -pipeline { - - agent any - - stages { - stage('Checkout') { - steps { - checkout scm - } - } - - stage('Python: Lint') { - steps { - sh 'cd python && tox -e format' - } - } - - stage('Python: Test') { - steps { - sh 'cd python && tox -e unit' - } - } - - stage('Python: Package') { - when { - buildingTag() - } - steps { - sh 'mkdir -p build/' - - // Build the python tarball - sh 'cd python && python setup.py sdist' - sh 'cp python/dist/synse_grpc-*.tar.gz build' - } - } - - stage('Draft GitHub Release') { - when { - buildingTag() - } - environment { - GITHUB_USER = 'vapor-ware' - GITHUB_TOKEN = credentials('vio-bot-gh-token') - GITHUB_REPONAME = 'synse-server-grpc' - } - steps { - sh 'docker pull edaniszewski/ghr' - sh 'docker run --rm -v ${WORKSPACE}:/repo edaniszewski/ghr -u ${GITHUB_USER} -r ${GITHUB_REPONAME} -t ${GITHUB_TOKEN} -replace -draft ${TAG_NAME} build/' - } - } - - stage('Python: Publish to PyPi') { - when { - buildingTag() - } - environment { - TWINE_USERNAME = 'vaporio' - TWINE_PASSWORD = credentials('twine-password') - } - steps { - sh 'cd python && tox -e publish' - } - } - } -} \ No newline at end of file diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..d5cd4cc --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.10.10 diff --git a/python/setup.cfg b/python/setup.cfg index 9779cc2..5a92fe1 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -7,7 +7,6 @@ exclude = lib/,src/,docs/,bin/,.tox/,synse_pb2*.py ignore = F401,F403 [isort] -not_skip = __init__.py default_section = THIRDPARTY known_first_party = synse_grpc,tests -skip = synse_pb2.py,synse_pb2_grpc.py \ No newline at end of file +skip = synse_pb2.py,synse_pb2_grpc.py diff --git a/python/setup.py b/python/setup.py index e20d1a1..588eabe 100644 --- a/python/setup.py +++ b/python/setup.py @@ -34,7 +34,7 @@ zip_safe=False, install_requires=[ 'grpcio>=1.8.6', - 'protobuf', + 'protobuf>=3.20.3, <4', ], classifiers=[ 'Intended Audience :: Developers', diff --git a/python/tox.ini b/python/tox.ini index c66c8ca..b945a43 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -28,7 +28,7 @@ deps = isort flake8 commands = - isort {posargs:synse_grpc tests} -rc -c --diff + isort {posargs:synse_grpc tests} -c --diff flake8 --show-source --statistics {posargs:synse_grpc tests} [testenv:publish]