Refactor code formatting/linting workflow #1734
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow installs Python dependencies, runs tests and lints | |
# using a variety of Python versions. | |
# For more information see: | |
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Run Test Suite | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
# Uses Python Framework build because on macOS, Matplotlib requires it | |
macos: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: s-weigand/setup-conda@v1.2.2 | |
with: | |
activate-conda: true | |
- name: Install pythonw | |
run: conda install python.app | |
- name: Python Version Info | |
run: | | |
pythonw --version | |
which python | |
pythonw -m site --user-site | |
echo $PYTHONPATH | |
echo $PYTHONHOME | |
- name: Install dependencies | |
run: | | |
brew install imagemagick | |
# needed for installing matplotlib | |
brew install pkg-config | |
python -m pip install --upgrade wheel setuptools coveralls | |
python -m pip install ".[test, optional]" | |
- name: Test with pytest | |
run: | | |
pythonw -m pytest --doctest-glob "moviepy/**/**.py" -v --cov moviepy --cov-report term-missing | |
- name: Coveralls | |
run: coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github | |
windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get ImageMagick installer from cache | |
id: imagemagick-installer-cache | |
uses: actions/cache@v4.0.2 | |
with: | |
path: | | |
ImageMagick.exe | |
key: ${{ runner.os }}-latest | |
- name: Download ImageMagick installer | |
shell: cmd | |
if: steps.imagemagick-installer-cache.outputs.cache-hit != 'true' | |
run: | | |
python3 scripts/get-latest-imagemagick-win.py >im-url.txt | |
set /p IMAGEMAGICK_URL= <im-url.txt | |
rm im-url.txt | |
echo %IMAGEMAGICK_URL% | |
curl %IMAGEMAGICK_URL% -o ImageMagick.exe | |
- name: Install ImageMagick | |
id: imagemagick-install | |
shell: cmd | |
run: | | |
set IMAGEMAGICK_INSTALL_DIR=%CD%\imagemagick | |
mkdir %IMAGEMAGICK_INSTALL_DIR% | |
echo %IMAGEMAGICK_INSTALL_DIR% | |
ImageMagick.exe /SILENT /SP /DIR=%IMAGEMAGICK_INSTALL_DIR% | |
dir imagemagick | |
move imagemagick\ffmpeg.exe ffmpeg.exe | |
move imagemagick\magick.exe convert.exe | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade wheel setuptools coveralls | |
python -m pip install ".[test]" | |
- name: Check third party dependencies | |
run: | | |
python moviepy\config.py | |
- name: PyTest | |
shell: cmd | |
run: | | |
python -m pytest --cov moviepy --cov-report term-missing | |
- name: Coveralls | |
run: coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Python Version Info | |
run: | | |
python --version | |
which python | |
python -m site --user-site | |
- name: Install common requirements | |
run: | | |
python -m pip install --upgrade wheel setuptools | |
- name: Install test requirements | |
if: ${{ matrix.python-version == '3.7' }} | |
run: | | |
python -m pip install ".[test, doc]" | |
python -m pip install python-dotenv | |
- name: Install test and optional requirements | |
if: ${{ matrix.python-version != '3.7' }} | |
run: | | |
python -m pip install ".[test, optional, doc]" | |
- name: Configure ImageMagick policy | |
run: | | |
cat /etc/ImageMagick-6/policy.xml \ | |
| sed 's/none/read,write/g' \ | |
| sudo tee /etc/ImageMagick-6/policy.xml | |
- name: PyTest | |
run: | | |
python -m pytest --doctest-glob "moviepy/**/**.py" --cov moviepy --cov-report term-missing | |
- name: Test pip installation | |
run: | | |
pip install -e . | |
pip install -e .[optional] | |
pip install -e .[test] | |
pip install -e .[doc] | |
- name: Coveralls | |
run: coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_SERVICE_NAME: github |