From a1feb2d86723d45967f7d433e3f85277cd269260 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 15:55:39 +0300 Subject: [PATCH 1/9] Use GitHub Actions for testing --- .github/workflows/python-package.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/python-package.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 00000000..73e7b0dd --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,41 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python package + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "pypy3"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + # apt-get install -y ffmpeg libopus-dev python-scipy python3-scipy + python -m pip install --upgrade pip + #python -m pip install flake8 pytest + python -m pip install pylama + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint + 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=10 --max-line-length=127 --statistics + pip install pylama && python -m pylama -i W,E501 pydub/ + - name: Test + run: | + python test/test.py From 12227586ff315eebcc8939d0b72f6856d9de4a90 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 16:48:27 +0300 Subject: [PATCH 2/9] Proper pypy identifier and allow lint to fail --- .github/workflows/python-package.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 73e7b0dd..fca0d6e4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -15,11 +15,11 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "pypy3"] + python-version: ["3.8", "3.9", "3.10", "pypy3.9", "pypy3.10"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -30,6 +30,7 @@ jobs: python -m pip install pylama if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint + continue-on-error: true run: | # stop the build if there are Python syntax errors or undefined names #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics From 0b6b98ec4d4507673e709fd665f020db945ae99f Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 16:50:02 +0300 Subject: [PATCH 3/9] Install `ffmpeg` --- .github/workflows/python-package.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index fca0d6e4..1ad0c1ff 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,9 +24,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - # apt-get install -y ffmpeg libopus-dev python-scipy python3-scipy + apt-get install -y ffmpeg # libopus-dev python-scipy python3-scipy python -m pip install --upgrade pip - #python -m pip install flake8 pytest python -m pip install pylama if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint From 2469414b9a088e5b1c529ebde3a88c1d8f8dfa80 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 16:51:39 +0300 Subject: [PATCH 4/9] `apt-get` needs `sudo` --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 1ad0c1ff..25c00c42 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,7 +24,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - apt-get install -y ffmpeg # libopus-dev python-scipy python3-scipy + sudo apt-get install -y ffmpeg # libopus-dev python-scipy python3-scipy python -m pip install --upgrade pip python -m pip install pylama if [ -f requirements.txt ]; then pip install -r requirements.txt; fi From 774824e45edbbc076e753c3be2923442ed19db69 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 17:50:26 +0300 Subject: [PATCH 5/9] Use `if: always()` to report failed status --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 25c00c42..29bddde6 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,7 +29,6 @@ jobs: python -m pip install pylama if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint - continue-on-error: true run: | # stop the build if there are Python syntax errors or undefined names #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics @@ -37,5 +36,6 @@ jobs: #flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics pip install pylama && python -m pylama -i W,E501 pydub/ - name: Test + if: always() run: | python test/test.py From 99ddc167f9eeb31260b81b964f3bf095698e2538 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 18:03:13 +0300 Subject: [PATCH 6/9] Get back `continue-on-error` Without it, the whole workflow fails. With it, the linter is shown as green. It is better to get test green first and then get picky for the linter. --- .github/workflows/python-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 29bddde6..60396b13 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,6 +29,7 @@ jobs: python -m pip install pylama if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint + continue-on-error: true run: | # stop the build if there are Python syntax errors or undefined names #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics From 6dcd5f394cce4b37d26ba2f59f7ff761ab851a64 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 18:05:41 +0300 Subject: [PATCH 7/9] Do not install `pylama` twice --- .github/workflows/python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 60396b13..ab85de33 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -35,7 +35,7 @@ jobs: #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=10 --max-line-length=127 --statistics - pip install pylama && python -m pylama -i W,E501 pydub/ + python -m pylama -i W,E501 pydub/ - name: Test if: always() run: | From ca35ec83b2f7b5072c07dc4b217c406a6ed2ba14 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 18:06:41 +0300 Subject: [PATCH 8/9] Remove `.travis.yml` for GitHub Actions --- .travis.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2eacfd10..00000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -os: linux -dist: bionic # focal -language: python -before_install: - - sudo apt-get update --fix-missing -install: - - sudo apt-get install -y ffmpeg libopus-dev python-scipy python3-scipy -python: - - "2.7" - - "3.6" - - "3.7" - - "3.8" - - "3.9" - - "pypy2" - - "pypy3" -script: - - python test/test.py -after_script: - - pip install pylama && python -m pylama -i W,E501 pydub/ || true From 548321bcad45cd381babcb42a3077f3b20b43fb6 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Tue, 11 Jul 2023 18:09:46 +0300 Subject: [PATCH 9/9] Replace Travis badge with GHA --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index e6fe12cc..597331d5 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -# Pydub [![Build Status](https://travis-ci.org/jiaaro/pydub.svg?branch=master)](https://travis-ci.org/jiaaro/pydub) [![Build status](https://ci.appveyor.com/api/projects/status/gy1ucp9o5khq7fqi/branch/master?svg=true)](https://ci.appveyor.com/project/jiaaro/pydub/branch/master) +# Pydub [![GitHub Actions](https://github.com/abitrolly/pydub/actions/workflows/python-package.yml/badge.svg)](https://github.com/abitrolly/pydub/actions/workflows/python-package.yml) [![Build status](https://ci.appveyor.com/api/projects/status/gy1ucp9o5khq7fqi/branch/master?svg=true)](https://ci.appveyor.com/project/jiaaro/pydub/branch/master) Pydub lets you do stuff to audio in a way that isn't stupid.