Skip to content

Update licence

Update licence #78

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
#
# The pipeline generates coverage data for each Python version that
# the tests are run against and then uploads this data as artifacts.
# The coverage step then pulls down this data combines it and generates
# the coverage report.
# See https://nedbatchelder.com/blog/202209/making_a_coverage_badge.html or
# or https://hynek.me/articles/ditch-codecov-python/ for examples of
# similar approaches to generating and combining coverage data on which
# this file is based.
name: "Run tests"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created, edited, published]
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, ubuntu-latest]
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, '3.10', '3.11']
exclude:
- os: ubuntu-20.04
python-version: '3.7'
- os: ubuntu-20.04
python-version: '3.8'
- os: ubuntu-20.04
python-version: '3.9'
- os: ubuntu-20.04
python-version: '3.10'
- os: ubuntu-20.04
python-version: '3.11'
- os: ubuntu-latest
python-version: '2.7'
- os: ubuntu-latest
python-version: '3.5'
- os: ubuntu-latest
python-version: '3.6'
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
# Also upgrade setuptools to resolve issue with "no module named setuptools_rust" error on 2.7/3.6
python -m pip install --upgrade setuptools
python -m pip install tox
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 django_drf_filepond --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# Aim to reduce complexity to 10 but leave at 16 for now to support existing code
flake8 django_drf_filepond --count --exit-zero --max-complexity=16 --max-line-length=80 --statistics
- name: Test with tox/pytest
run: |
# We use the default "py" environment since this will use the version
# of Python installed in the runner which will be the version from the
# matrix for this task.
tox -e py
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
name: coverage-data
path: .coverage.*
retention-days: 1
# Once the tests have been run on the different Python versions and
# the coverage data files uploaded as artifacts, we can now pull
# down the coverage data from the various jobs that may have run in
# parallel and we can combine the data to get a final coverage value.
# We then generate a badge which is stored to the repo for display in
# the main README.
coverage:
name: "Code coverage"
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: "Download coverage data"
uses: actions/download-artifact@v3
with:
name: coverage-data
- name: "Combine coverage data and show report"
run: |
tox -e coverage