tests: fix file locks making tests fail on Linux and MacOS #4
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 will install Python dependencies and run tests with a variety of Python versions | |
# It uses the Python Package GitHub Actions workflow. | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
# and https://www.youtube.com/watch?v=l6fV09z5XHk | |
name: ci-build | |
on: | |
push: | |
branches: | |
- main # $default-branch only works in Workflows templates, not in Workflows, see https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.7", "3.x", pypy-3.9] # check the list of versions: https://github.com/actions/python-versions/releases and https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md -- note that "*" represents the latest stable version of Python, while "3.x" is the latest stable version of Python in the v3 branch. | |
os: [ ubuntu-latest, windows-latest, macos-latest ] # jobs that run on Windows and macOS runners that GitHub hosts consume minutes at 2 and 10 times the rate that jobs on Linux runners consume respectively. But it's free for public OSS repositories. | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
# You can test your matrix by printing the current Python version | |
- name: Display Python version | |
run: | | |
python -c "import sys; print(sys.version)" | |
- name: Upgrade pip | |
run: | | |
python -m pip install --upgrade pip | |
#- uses: FedericoCarboni/setup-ffmpeg@v2 # ffmpeg is transparently and automatically downloaded by moviepy | |
# id: setup-ffmpeg | |
- name: Install this module | |
run: | | |
python -m pip install --upgrade --editable .[test,testmeta] --verbose --use-pep517 | |
- name: Test with pytest | |
run: | | |
coverage run --branch -m pytest -v | |
coverage report -m | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos, but still advised to avoid rate-limiting API by GitHub which makes the upload fails randomly: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954/9 and https://github.com/codecov/codecov-action/issues/598 | |
#directory: ./coverage/reports/ | |
env_vars: OS,PYTHON | |
fail_ci_if_error: true | |
#files: ./coverage1.xml,./coverage2.xml | |
flags: unittests | |
name: codecov-umbrella | |
verbose: true | |
- name: Build sdist (necessary for the other tests below) | |
if: ${{ matrix.python-version == '3.x' }} | |
run: python -sBm build | |
- name: Twine check | |
if: ${{ matrix.python-version == '3.x' }} | |
run: | | |
twine check "dist/*" | |
- name: pyproject.toml validity | |
if: ${{ matrix.python-version == '3.x' }} | |
run: validate-pyproject pyproject.toml -v |