From 10236834e7f9317718a02d7f65324658fe11c5b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=C5=9Aliwi=C5=84ski?= Date: Fri, 14 May 2021 16:48:37 +0200 Subject: [PATCH 1/2] Move to Github Actions CI --- .github/workflows/automerge.yml | 41 ++++++++++++++++++++++ .github/workflows/build.yml | 26 ++++++++++++++ .github/workflows/linters.yml | 60 +++++++++++++++++++++++++++++++++ .github/workflows/pypi.yml | 29 ++++++++++++++++ .github/workflows/tests.yml | 43 +++++++++++++++++++++++ README.rst | 11 ------ pyproject.toml | 8 +++++ requirements-lint.txt | 4 +-- 8 files changed, 208 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/automerge.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/linters.yml create mode 100644 .github/workflows/pypi.yml create mode 100644 .github/workflows/tests.yml create mode 100644 pyproject.toml diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 0000000..78dff52 --- /dev/null +++ b/.github/workflows/automerge.yml @@ -0,0 +1,41 @@ +name: Automerge Pull Requests +on: + pull_request: + types: + - labeled + - unlabeled + - synchronize + - opened + - edited + - ready_for_review + - reopened + - unlocked + pull_request_review: + types: + - submitted + check_suite: + types: + - completed + status: {} + +jobs: + automerge: + name: Automerge Dependabot + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' + steps: + - name: 'Wait for status checks' + id: waitforstatuschecks + uses: "WyriHaximus/github-action-wait-for-status@v1.3" + with: + ignoreActions: Automerge Dependabot + checkInterval: 13 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: Merge pull requests + uses: pascalgn/automerge-action@v0.13.1 + if: steps.waitforstatuschecks.outputs.status == 'success' + env: + MERGE_METHOD: "squash" + MERGE_LABELS: "" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..79c1444 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: Test build package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Build Python 🐍 distributions 📦 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install build tools + run: pip install pep517 + - name: Build a wheel package + run: python -m pep517.build . + - name: Install twine to check the package + run: pip install twine + - name: Check the package + run: twine check dist/* diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml new file mode 100644 index 0000000..8b089a3 --- /dev/null +++ b/.github/workflows/linters.yml @@ -0,0 +1,60 @@ +name: Run linters + +on: + push: + branches: [ master ] + paths: + - '**.py' + - .github/workflows/linters.yml + - requirements-lint.txt + pull_request: + branches: [ master ] + paths: + - '**.py' + - .github/workflows/linters.yml + - requirements-lint.txt + +jobs: + pydocstyle: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-lint.txt + - name: Run pydocstyle + run: | + pydocstyle src/ tests/ + + pycodestyle: + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-lint.txt + - name: Run pydocstyle + run: | + pycodestyle src/ tests/ + black: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: psf/black@main diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..fed3bbc --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,29 @@ +name: Package and publish +on: + push: + tags: + - v* +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install build tools + run: pip install pep517 + - name: Build a wheel package + run: python -m pep517.build . +# - name: Publish distribution 📦 to Test PyPI +# uses: pypa/gh-action-pypi-publish@master +# with: +# password: ${{ secrets.test_pypi_password }} +# repository_url: https://test.pypi.org/legacy/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.pypi_password }} + verbose: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..df2b654 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,43 @@ +name: Run tests + +on: + push: + branches: [ master ] + paths: + - '**.py' + - .github/workflows/tests.yml + - requirements-test.txt + pull_request: + branches: [ master ] + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + python-version: [3.7, 3.8, 3.9, pypy-3.7-v7.3.3] + env: + OS: ubuntu-latest + PYTHON: ${{ matrix.python-version }} + # Service containers to run with `container-job` + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Run test + run: | + pytest -n 0 --cov-report=xml + - name: Run xdist test + run: | + pytest -n 1 --cov-report=xml:coverage-xdist.xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + files: ./coverage.xml, ./coverage-xdist.xml + flags: linux + env_vars: OS, PYTHON + fail_ci_if_error: true diff --git a/README.rst b/README.rst index f44f94a..b91a363 100644 --- a/README.rst +++ b/README.rst @@ -21,17 +21,6 @@ pytest-redis :target: https://pypi.python.org/pypi/pytest-redis/ :alt: License -Package status --------------- - -.. image:: https://travis-ci.org/ClearcodeHQ/pytest-redis.svg?branch=v2.0.0 - :target: https://travis-ci.org/ClearcodeHQ/pytest-redis - :alt: Tests - -.. image:: https://coveralls.io/repos/ClearcodeHQ/pytest-redis/badge.svg?branch=v2.0.0 - :target: https://coveralls.io/r/ClearcodeHQ/pytest-redis?branch=v2.0.0 - :alt: Coverage Status - What is this? ============= diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..a6e8882 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,8 @@ +[build-system] +requires = ["setuptools >= 40.6.0", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.black] +line-length = 100 +target-version = ['py38'] +include = '.*\.pyi?$' diff --git a/requirements-lint.txt b/requirements-lint.txt index 6e9cad2..dcb1a52 100644 --- a/requirements-lint.txt +++ b/requirements-lint.txt @@ -1,7 +1,5 @@ # linters pycodestyle==2.7.0 pydocstyle==6.0.0 -pylint==2.8.2 -pygments -pyroma==3.1 +black==21.5b1 -r requirements-test.txt From f4ed6c18b76ff52c7a44f8ac38f982a1a528dddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20=C5=9Aliwi=C5=84ski?= Date: Fri, 14 May 2021 22:56:47 +0200 Subject: [PATCH 2/2] Install dependencies --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df2b654..23a2572 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,10 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-test.txt - name: Run test run: | pytest -n 0 --cov-report=xml