From c96e00b3728de0344e26352091cfff01eb38dced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Chaves?= Date: Mon, 4 Oct 2021 13:25:14 +0200 Subject: [PATCH] =?UTF-8?q?Travis=20CI=20=E2=86=92=20GitHub=20Actions=20(#?= =?UTF-8?q?292)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/publish.yml | 33 +++++++++++++++++++++++ .github/workflows/tests.yml | 51 +++++++++++++++++++++++++++++++++++ .travis.yml | 39 --------------------------- README.rst | 4 +-- requirements-py3.txt | 3 --- requirements-test.txt | 6 ----- requirements.txt | 3 --- tox.ini | 46 ++++++++++++++++++------------- 8 files changed, 114 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .travis.yml delete mode 100644 requirements-py3.txt delete mode 100644 requirements-test.txt delete mode 100644 requirements.txt diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ca30d12 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Publish +on: + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: 3 + + - name: Build distribution + run: | + pip install -U setuptools wheel + python setup.py sdist bdist_wheel + + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..4758273 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,51 @@ +name: Tests +on: [push, pull_request] + +jobs: + tests: + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository + runs-on: ${{ matrix.os || 'ubuntu-latest' }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-18.04 + python-version: 2.7 + env: + TOXENV: py27-scrapy10 + - os: ubuntu-18.04 + python-version: 2.7 + env: + TOXENV: py27 + - os: ubuntu-18.04 + python-version: 3.4 + env: + TOXENV: py + - os: ubuntu-18.04 + python-version: 3.5 + env: + TOXENV: py35 + - python-version: 3.6 + env: + TOXENV: py + + steps: + - uses: actions/checkout@v2 + + - name: Run Splash + run: | + docker run --rm -d -p 8050:8050 --network host scrapinghub/splash + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Run tests + env: ${{ matrix.env }} + run: | + pip install -U tox + SPLASH_URL=http://127.0.0.1:8050 tox + + - name: Upload coverage report + run: bash <(curl -s https://codecov.io/bash) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4eb6577..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: python -sudo: required - -services: - - docker - -branches: - only: - - master - - /^\d\.\d+$/ - -matrix: - include: - - python: 2.7 - env: TOXENV=py27 - - python: 3.4 - env: TOXENV=py34 - - python: 3.5 - env: TOXENV=py35 - - python: 3.6 - env: TOXENV=py36 - - python: 2.7 - env: TOXENV=py27-scrapy10 - -before_install: - - docker pull scrapinghub/splash - - docker run --rm -d -p 8050:8050 --network host scrapinghub/splash - -install: - - pip install -U tox codecov - -script: SPLASH_URL=http://127.0.0.1:8050 tox - -after_success: - - codecov - -cache: - directories: - - $HOME/.cache/pip diff --git a/README.rst b/README.rst index 91b8855..dce25f9 100644 --- a/README.rst +++ b/README.rst @@ -6,8 +6,8 @@ Scrapy & JavaScript integration through Splash :target: https://pypi.python.org/pypi/scrapy-splash :alt: PyPI Version -.. image:: https://travis-ci.org/scrapy-plugins/scrapy-splash.svg?branch=master - :target: http://travis-ci.org/scrapy-plugins/scrapy-splash +.. image:: https://github.com/scrapy-plugins/scrapy-splash/workflows/Build/badge.svg + :target: https://github.com/scrapy-plugins/scrapy-splash/actions :alt: Build Status .. image:: http://codecov.io/github/scrapy-plugins/scrapy-splash/coverage.svg?branch=master diff --git a/requirements-py3.txt b/requirements-py3.txt deleted file mode 100644 index 283e188..0000000 --- a/requirements-py3.txt +++ /dev/null @@ -1,3 +0,0 @@ -scrapy>=1.1.0rc3 -service_identity -six diff --git a/requirements-test.txt b/requirements-test.txt deleted file mode 100644 index 773a2d8..0000000 --- a/requirements-test.txt +++ /dev/null @@ -1,6 +0,0 @@ -pytest >= 3.3.2 -pytest-cov >= 2.5.1 -pytest-twisted >= 1.6 -pytest-xdist >= 1.22 -hypothesis >= 3.44.14 -hypothesis-pytest diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 3c539cc..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -scrapy -service_identity -six diff --git a/tox.ini b/tox.ini index fd20a72..64865c5 100644 --- a/tox.ini +++ b/tox.ini @@ -4,34 +4,44 @@ # and then run "tox" from this directory. [tox] -envlist = py27,py34,py35,py36,py27-scrapy10 +envlist = py27-scrapy10,py27,py34,py35,py36 + +[common] +deps = + pytest >= 3.3.2 + pytest-cov >= 2.5.1 + pytest-twisted >= 1.6 + pytest-xdist >= 1.22 + hypothesis >= 3.44.14 + hypothesis-pytest + service_identity [testenv] passenv = SPLASH_URL deps = - -rrequirements-test.txt - -rrequirements.txt - + {[common]deps} + scrapy commands = pip install -e . py.test --doctest-modules --cov=scrapy_splash {posargs:scrapy_splash tests} -[testenv:py34] -basepython = python3.4 +[python2] deps = - -rrequirements-test.txt - -rrequirements-py3.txt - -[testenv:py35] -basepython = python3.5 -deps = {[testenv:py34]deps} - -[testenv:py36] -basepython = python3.6 -deps = {[testenv:py34]deps} + {[common]deps} + queuelib < 1.6.0 [testenv:py27-scrapy10] deps = - -rrequirements-test.txt + {[python2]deps} scrapy < 1.1 - service_identity + +[testenv:py27] +deps = + {[python2]deps} + scrapy < 2 + +[testenv:py35] +deps = + {[common]deps} + # https://github.com/scrapy/scrapy/pull/4094#issuecomment-704092404 + scrapy < 2 \ No newline at end of file