|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +name: Python package |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "main" ] |
| 9 | + pull_request: |
| 10 | + branches: [ "main" ] |
| 11 | + |
| 12 | +env: |
| 13 | + DJANGO_SETTINGS_MODULE: tests.settings |
| 14 | + |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + python-version: ["3.9", "3.10"] |
| 24 | + django-version: ["3.2.18", "4.0.10", "4.1.7"] |
| 25 | + database: ["sqlite:memory:", "postgres://:@:/django-shared-property"] |
| 26 | + |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v3 |
| 29 | + - name: Set up Python ${{ matrix.python-version }} |
| 30 | + uses: actions/setup-python@v3 |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + - name: Install dependencies |
| 34 | + run: | |
| 35 | + python -m pip install --upgrade pip poetry flake8 |
| 36 | + poetry run pip install django=="${{ matrix.django-version }}" |
| 37 | + poetry install --with dev,test |
| 38 | + - name: Lint with flake8 |
| 39 | + run: | |
| 40 | + # stop the build if there are Python syntax errors or undefined names |
| 41 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 42 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 43 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 44 | + - name: Test with pytest |
| 45 | + run: | |
| 46 | + DATABASE_URL=${{ matrix.database }} poetry run pytest --cov=src/django_shared_property -s tests/tests/ |
0 commit comments