From 29b6f0929805b09a20184a1d4500bf31e4dbc138 Mon Sep 17 00:00:00 2001 From: Karl Kroening Date: Mon, 7 Mar 2022 00:05:43 -0800 Subject: [PATCH] Use GitHub Actions for CI. (#641) This sets up GitHub Actions (GHA) to run in place of the currently broken Travis CI. Initially, this only covers running tox/pytest and Black, but may eventually be extended to run pylint, mypy, flake8, etc. - see #605, for example. Notes: * Python 3.10 is not yet supported due to the `collections.Iterable` issue discussed in #330, #624, etc. * The Black CI step acts as a linting step, rather than attempting to have the GHA job automatically update/commit/push the reformarted code. * Black is currently pinned to an older version that supports `--target-version py27` until Python 2 compatibility can be dropped in the final Python 2 compatibility release of ffmpeg-python. * Only the main source directory (`ffmpeg/`) is checked with Black at the moment. The `examples/` directory should also be checked, but will be done as a separate PR. Co-authored by: Christian Clauss --- .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 32 ----------------------------- README.md | 5 ++++- ffmpeg/_utils.py | 1 - setup.py | 2 -- tox.ini | 11 +++++++++- 6 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6289d8b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,44 @@ +name: CI +on: + - push + - pull_request +jobs: + test: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + python-version: + - "2.7" + - "3.5" + - "3.6" + - "3.7" + - "3.8" + - "3.9" + # - "3.10" # FIXME: broken due to `collections.Iterable` issue; see #330 / #624 / etc. + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install ffmpeg + run: | + sudo apt update + sudo apt install ffmpeg + - name: Setup pip + tox + run: | + python -m pip install --upgrade \ + "pip==20.3.4; python_version < '3.6'" \ + "pip==21.3.1; python_version >= '3.6'" + python -m pip install tox==3.24.5 tox-gh-actions==2.9.1 + - name: Test with tox + run: tox + black: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: psf/black@21.12b0 # TODO: upgrade after dropping Python 2 support. + with: + src: ffmpeg # TODO: also format `examples`. + version: 21.12b0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e4d7d75..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: python -before_install: - - > - [ -f ffmpeg-release/ffmpeg ] || ( - curl -O https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz && - mkdir -p ffmpeg-release && - tar Jxf ffmpeg-release-amd64-static.tar.xz --strip-components=1 -C ffmpeg-release - ) -matrix: - include: - - python: 2.7 - env: TOX_ENV=py27 - - python: 3.4 - env: TOX_ENV=py34 - - python: 3.5 - env: TOX_ENV=py35 - - python: 3.6 - env: TOX_ENV=py36 - - python: 3.7 - dist: xenial # required for Python >= 3.7 - env: TOX_ENV=py37 - - python: pypy - env: TOX_ENV=pypy -install: - - pip install tox -script: - - export PATH=$(readlink -f ffmpeg-release):$PATH - - tox -e $TOX_ENV -cache: - directories: - - .tox - - ffmpeg-release diff --git a/README.md b/README.md index 8cfe89a..2ac9d62 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # ffmpeg-python: Python bindings for FFmpeg -[![Build status](https://travis-ci.org/kkroening/ffmpeg-python.svg?branch=master)](https://travis-ci.org/kkroening/ffmpeg-python) +[![CI][ci-badge]][ci] + +[ci-badge]: https://github.com/kkroening/ffmpeg-python/actions/workflows/ci.yml/badge.svg +[ci]: https://github.com/kkroening/ffmpeg-python/actions/workflows/ci.yml ffmpeg-python logo diff --git a/ffmpeg/_utils.py b/ffmpeg/_utils.py index 55682a2..94ef9d0 100644 --- a/ffmpeg/_utils.py +++ b/ffmpeg/_utils.py @@ -40,7 +40,6 @@ if sys.version_info.major >= 3: class basestring(with_metaclass(BaseBaseString)): pass - else: # noinspection PyUnresolvedReferences,PyCompatibility from builtins import basestring diff --git a/setup.py b/setup.py index 0282c67..743deb2 100644 --- a/setup.py +++ b/setup.py @@ -60,8 +60,6 @@ keywords = misc_keywords + file_formats setup( name='ffmpeg-python', packages=['ffmpeg'], - setup_requires=['pytest-runner'], - tests_require=['pytest', 'pytest-mock'], version=version, description='Python bindings for FFmpeg - with complex filtering support', author='Karl Kroening', diff --git a/tox.ini b/tox.ini index 1e3ba53..e317207 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,16 @@ # and then run "tox" from this directory. [tox] -envlist = py27, py34, py35, py36, py37, pypy +envlist = py27, py35, py36, py37, py38, py39 + +[gh-actions] +python = + 2.7: py27 + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 [testenv] commands = py.test -vv