From b6c4017378fef3a4cfb2ab87732164d373acf664 Mon Sep 17 00:00:00 2001 From: Ian Good Date: Mon, 10 May 2021 22:20:05 -0400 Subject: [PATCH] Switch to Github Actions build workflows --- .github/release-drafter.yml | 6 ++ .github/workflows/python-package.yml | 61 +++++++++++++++++++ .github/workflows/python-publish.yml | 52 ++++++++++++++++ .github/workflows/release-drafter.yml | 15 +++++ .lvimrc | 1 - .travis.yml | 36 ----------- docker/Dockerfile | 8 ++- docker/hooks/build | 5 -- requirements-all.txt | 1 + test/requirements.txt => requirements-dev.txt | 3 + setup.cfg | 2 +- setup.py | 2 +- 12 files changed, 145 insertions(+), 47 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/python-package.yml create mode 100644 .github/workflows/python-publish.yml create mode 100644 .github/workflows/release-drafter.yml delete mode 100644 .travis.yml delete mode 100644 docker/hooks/build create mode 100644 requirements-all.txt rename test/requirements.txt => requirements-dev.txt (64%) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..4e5af4a --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,6 @@ +exclude-labels: + - 'skip-changelog' +template: | + ## Change Log + + $CHANGES diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..f44f594 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,61 @@ +name: build + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8, 3.9] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel coveralls + python -m pip install --upgrade -r requirements-dev.txt + - name: Lint with flake8 + run: | + flake8 proxyprotocol test + - name: Type checking with mypy + run: | + mypy proxyprotocol test + - name: Test with pytest + run: | + py.test --cov=proxyprotocol + - name: Report test coverage to Coveralls + if: success() + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + coveralls --service=github + + docs: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade -r requirements-dev.txt + python -m pip install --upgrade -r doc/requirements.txt + - name: Build the Sphinx documentation + run: | + make -C doc html diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..1ffe4fe --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,52 @@ +name: publish + +on: + release: + types: [ published ] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* + + docs: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade -r requirements-dev.txt + python -m pip install --upgrade -r doc/requirements.txt + - name: Build the Sphinx documentation + run: | + make -C doc html + - name: Deploy to GitHub Pages + if: success() + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ github.token }} + publish_dir: ./doc/build/html diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..2de63b7 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,15 @@ +name: draft + +on: + push: + branches: + - master + +jobs: + update_release_draft: + + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.lvimrc b/.lvimrc index 49c62e2..5f6e825 100644 --- a/.lvimrc +++ b/.lvimrc @@ -1,4 +1,3 @@ -let g:ale_fix_on_save = 1 let g:ale_fixers = { \ 'python': ['autopep8'], \} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cc073ef..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: python -python: - - "3.9" - - "3.8" - - "3.7" -dist: bionic # https://docs.travis-ci.com/user/languages/python/#python-37-and-higher -install: - - travis_retry pip install -U -r doc/requirements.txt - - travis_retry pip install -U -r test/requirements.txt - - travis_retry pip install coveralls - - travis_retry pip install -e . -script: - - py.test --cov=proxyprotocol - - mypy proxyprotocol test - - flake8 proxyprotocol test -after_success: - - coveralls - - make -C doc html -branches: - only: - - master - - /^\d+\.\d+.*$/ # version tags -deploy: - - provider: pages:git - local_dir: doc/build/html - on: - tags: true - python: "3.9" - edge: true - - provider: pypi - distributions: sdist bdist_wheel - skip_existing: true - on: - tags: true - python: "3.9" - edge: true diff --git a/docker/Dockerfile b/docker/Dockerfile index 23c0007..a16f3d0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,11 +1,13 @@ FROM python:3.9-alpine +WORKDIR /src +COPY . . + RUN pip install -U pip wheel setuptools typing-extensions -ARG install_arg="proxy-protocol" -ARG install_source="" RUN apk --update add --virtual build-dependencies python3-dev build-base \ - && pip install "${install_arg}${install_source}" \ + && pip install -r requirements-all.txt \ && apk del build-dependencies ENTRYPOINT ["proxyprotocol-server"] +CMD ["--help"] diff --git a/docker/hooks/build b/docker/hooks/build deleted file mode 100644 index 0a2f882..0000000 --- a/docker/hooks/build +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -ex - -export install_source=" @ $GITHUB_REPO/archive/$SOURCE_BRANCH.tar.gz" -docker build --build-arg install_source -f $DOCKERFILE_PATH -t $IMAGE_NAME . diff --git a/requirements-all.txt b/requirements-all.txt new file mode 100644 index 0000000..497944e --- /dev/null +++ b/requirements-all.txt @@ -0,0 +1 @@ +-e '.' diff --git a/test/requirements.txt b/requirements-dev.txt similarity index 64% rename from test/requirements.txt rename to requirements-dev.txt index 1f90e5e..d8298cc 100644 --- a/test/requirements.txt +++ b/requirements-dev.txt @@ -4,3 +4,6 @@ autopep8 pytest pytest-asyncio pytest-cov +rope + +-r requirements-all.txt diff --git a/setup.cfg b/setup.cfg index 60d0066..9af6887 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [mypy] strict = true -python_version = 3.8 +python_version = 3.9 [tool:pytest] norecursedirs = doc diff --git a/setup.py b/setup.py index 0a4da95..0c6828f 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ license = f.read() setup(name='proxy-protocol', - version='0.6.0', + version='0.6.1', author='Ian Good', author_email='ian@icgood.net', description='PROXY protocol library with asyncio server implementation',