|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + |
| 11 | + lint: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + lint-command: |
| 16 | + - bandit -r . -x ./tests |
| 17 | + - black --check --diff . |
| 18 | + - flake8 . |
| 19 | + - isort --check-only --diff . |
| 20 | + - pydocstyle . |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - uses: actions/setup-python@v4 |
| 24 | + with: |
| 25 | + python-version: "3.x" |
| 26 | + cache: 'pip' |
| 27 | + cache-dependency-path: 'pyproject.toml' |
| 28 | + - run: python -m pip install -e .[lint] |
| 29 | + - run: ${{ matrix.lint-command }} |
| 30 | + |
| 31 | + dist: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - uses: actions/setup-python@v4 |
| 36 | + with: |
| 37 | + python-version: "3.x" |
| 38 | + - run: python -m pip install --upgrade pip build wheel twine |
| 39 | + - run: python -m build --sdist --wheel |
| 40 | + - run: python -m twine check dist/* |
| 41 | + - uses: actions/upload-artifact@v3 |
| 42 | + with: |
| 43 | + path: dist/* |
| 44 | + |
| 45 | + pytest-python: |
| 46 | + name: PyTest |
| 47 | + needs: |
| 48 | + - lint |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + python-version: |
| 52 | + - "3.8" |
| 53 | + - "3.9" |
| 54 | + - "3.10" |
| 55 | + - "3.12" |
| 56 | + django-version: |
| 57 | + - "4.2" # LTS |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - uses: actions/checkout@v4 |
| 61 | + - name: Set up Python ${{ matrix.python-version }} |
| 62 | + uses: actions/setup-python@v4 |
| 63 | + with: |
| 64 | + python-version: ${{ matrix.python-version }} |
| 65 | + - run: python -m pip install .[test] |
| 66 | + - run: python -m pip install django~=${{ matrix.django-version }}.0 |
| 67 | + - run: python -m playwright install |
| 68 | + - run: python -m pytest |
| 69 | + - uses: codecov/codecov-action@v3 |
| 70 | + with: |
| 71 | + flags: py${{ matrix.python-version }} |
| 72 | + |
| 73 | + pytest-django: |
| 74 | + name: PyTest |
| 75 | + needs: |
| 76 | + - lint |
| 77 | + strategy: |
| 78 | + matrix: |
| 79 | + python-version: |
| 80 | + - "3.11" |
| 81 | + django-version: |
| 82 | + # LTS gets tested on all OS |
| 83 | + - "3.2" |
| 84 | + - "4.2" |
| 85 | + - "5.0" |
| 86 | + runs-on: ubuntu-latest |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v4 |
| 89 | + - name: Set up Python ${{ matrix.python-version }} |
| 90 | + uses: actions/setup-python@v4 |
| 91 | + with: |
| 92 | + python-version: ${{ matrix.python-version }} |
| 93 | + - run: python -m pip install .[test] |
| 94 | + - run: python -m pip install django~=${{ matrix.django-version }}.0 |
| 95 | + - run: python -m playwright install |
| 96 | + - run: python -m pytest |
| 97 | + - uses: codecov/codecov-action@v3 |
| 98 | + with: |
| 99 | + flags: dj${{ matrix.django-version }} |
| 100 | + |
| 101 | + codeql: |
| 102 | + name: CodeQL |
| 103 | + needs: [ dist, pytest-python, pytest-django ] |
| 104 | + runs-on: ubuntu-latest |
| 105 | + permissions: |
| 106 | + actions: read |
| 107 | + contents: read |
| 108 | + security-events: write |
| 109 | + strategy: |
| 110 | + fail-fast: false |
| 111 | + matrix: |
| 112 | + language: [ python ] |
| 113 | + steps: |
| 114 | + - name: Checkout |
| 115 | + uses: actions/checkout@v4 |
| 116 | + - name: Initialize CodeQL |
| 117 | + uses: github/codeql-action/init@v2 |
| 118 | + with: |
| 119 | + languages: ${{ matrix.language }} |
| 120 | + queries: +security-and-quality |
| 121 | + - name: Autobuild |
| 122 | + uses: github/codeql-action/autobuild@v2 |
| 123 | + - name: Perform CodeQL Analysis |
| 124 | + uses: github/codeql-action/analyze@v2 |
| 125 | + with: |
| 126 | + category: "/language:${{ matrix.language }}" |
0 commit comments