From 8904757d7e49c7bfb8ea738dc649cfd582be4921 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Mon, 6 Jul 2020 14:28:28 -1000 Subject: [PATCH] Replace travis with GitHub action (#1290) * CI: replace travis with GitHub action matrix The GitHub action runs the same tests as travis however using a more complex matrix: Python versions: 3.5, 3.6, 3.7, 3.8 Python 3.4 is dropped by redis-py, therefore not required in the tests. Redis versions: 3, 4, 5, 6 The different Redis versions offer different features and this allows checks for compatibility. redis-py versions: 3.5.0, 3.5.3 3.5.0 is the oldest supported version, 3.5.3 is the latest upstream verison Signed-off-by: Paul Spooren * CI: Add flake8 lint action This actions runs `flake8` and shows style problems of the code. It uses th GitHub default options which handle most problems as warnings. These rules could become slowly more strict. Signed-off-by: Paul Spooren --- .github/workflows/lint.yml | 32 +++++++++++++++++++++++++++ .github/workflows/test.yml | 45 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 18 --------------- README.md | 2 +- 4 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..163994b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint rq + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=5 --max-line-length=120 --statistics diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..251517b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Test rq + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: Python${{ matrix.python-version }}/Redis${{ matrix.redis-version }}/redis-py${{ matrix.redis-py-version }} + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.5, 3.6, 3.7, 3.8] + redis-version: [3, 4, 5, 6] + redis-py-version: [3.5.0, 3.5.3] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Start Redis + uses: supercharge/redis-github-action@1.1.0 + with: + redis-version: ${{ matrix.redis-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install redis==${{ matrix.redis-py-version }} + pip install pytest pytest-cov sentry-sdk codecov mock + pip install -e . + + - name: Test with pytest + run: | + RUN_SLOW_TESTS_TOO=1 pytest --cov rq --durations=5 + + - name: Codecov + run: | + codecov diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f51ee9a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: python -services: - - redis -matrix: - include: - - python: "3.5" - - python: "3.6" - - python: "3.7" - - python: "3.8" - - python: "pypy3" -install: - - pip install -e . - - pip install pytest-cov sentry-sdk codecov - #- pip install pytest # installed by Travis by default already -script: - - RUN_SLOW_TESTS_TOO=1 py.test --cov rq --durations=5 -after_success: - - codecov diff --git a/README.md b/README.md index e29f380..1e32afc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ easily. RQ requires Redis >= 3.0.0. -[![Build status](https://travis-ci.org/rq/rq.svg?branch=master)](https://secure.travis-ci.org/rq/rq) +![Build status](https://github.com/rq/rq/workflows/Test%20rq/badge.svg) [![PyPI](https://img.shields.io/pypi/pyversions/rq.svg)](https://pypi.python.org/pypi/rq) [![Coverage](https://codecov.io/gh/rq/rq/branch/master/graph/badge.svg)](https://codecov.io/gh/rq/rq)