|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - "[0-9]+.[0-9]+" |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - "[0-9]+.[0-9]+" |
| 12 | + |
| 13 | +jobs: |
| 14 | + black: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v1 |
| 18 | + - uses: actions/setup-python@v1 |
| 19 | + with: |
| 20 | + python-version: 3.8 |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip black |
| 24 | + - name: Running black |
| 25 | + run: | |
| 26 | + black --check --diff . |
| 27 | +
|
| 28 | + flake8: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v1 |
| 32 | + - uses: actions/setup-python@v1 |
| 33 | + with: |
| 34 | + python-version: 3.8 |
| 35 | + - name: Install dependencies |
| 36 | + run: | |
| 37 | + python -m pip install --upgrade pip flake8 |
| 38 | + - name: Running flake8 |
| 39 | + run: | |
| 40 | + flake8 --count --show-source --statistics |
| 41 | +
|
| 42 | + isort: |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v1 |
| 46 | + - uses: actions/setup-python@v1 |
| 47 | + with: |
| 48 | + python-version: 3.8 |
| 49 | + - name: Install dependencies |
| 50 | + run: | |
| 51 | + python -m pip install --upgrade pip isort |
| 52 | + - name: Running isort |
| 53 | + run: | |
| 54 | + isort --check-only --diff --recursive |
| 55 | +
|
| 56 | + tests: |
| 57 | + needs: [black, flake8, isort] |
| 58 | + runs-on: ubuntu-latest |
| 59 | + strategy: |
| 60 | + fail-fast: false |
| 61 | + matrix: |
| 62 | + python-version: |
| 63 | + - "3.5" |
| 64 | + - "3.6" |
| 65 | + - "3.7" |
| 66 | + - "3.8" |
| 67 | + django-version: |
| 68 | + - "2.2" |
| 69 | + - "3.0" |
| 70 | + - "master" |
| 71 | + exclude: |
| 72 | + # Python 3.5 is compatible with Django <3.0 |
| 73 | + - python-version: "3.5" |
| 74 | + django-version: "3.0" |
| 75 | + - python-version: "3.5" |
| 76 | + django-version: "master" |
| 77 | + steps: |
| 78 | + - uses: actions/checkout@v1 |
| 79 | + |
| 80 | + - name: Set up Python ${{ matrix.python-version }} |
| 81 | + uses: actions/setup-python@v1 |
| 82 | + with: |
| 83 | + python-version: ${{ matrix.python-version }} |
| 84 | + |
| 85 | + - name: Upgrade pip version |
| 86 | + run: | |
| 87 | + python -m pip install -U pip |
| 88 | +
|
| 89 | + - name: Upgrade Django version |
| 90 | + run: | |
| 91 | + if [ "${{ matrix.django-version }}" == "master" ] ; then |
| 92 | + python -m pip install "https://github.com/django/django/archive/master.tar.gz" |
| 93 | + else |
| 94 | + python -m pip install "Django~=${{ matrix.django-version }}.0" |
| 95 | + fi |
| 96 | +
|
| 97 | + - name: Python and Django versions |
| 98 | + run: | |
| 99 | + echo "Python ${{ matrix.python-version }} -> Django ${{ matrix.django-version }}" |
| 100 | + python --version |
| 101 | + echo "Django: `django-admin --version`" |
| 102 | +
|
| 103 | + - name: Install dependencies |
| 104 | + run: | |
| 105 | + python -m pip install -e '.[testing]' |
| 106 | +
|
| 107 | + - name: Running tests |
| 108 | + run: | |
| 109 | + coverage run "$(command -v django-admin.py)" test -v 2 --settings=tests.settings |
| 110 | + coverage report |
| 111 | + coverage xml |
| 112 | +
|
| 113 | + - name: Upload coverage to codecov.io |
| 114 | + uses: codecov/codecov-action@v1 |
| 115 | + with: |
| 116 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments