|
1 | | -name: Release to PyPi |
2 | | -on: [push] |
| 1 | +name: Lint, Build and Test |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - master |
3 | 9 |
|
4 | 10 | jobs: |
| 11 | + lint: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + name: Lint |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + - name: Set up Python 3.8 |
| 18 | + uses: actions/setup-python@v5 |
| 19 | + with: |
| 20 | + python-version: 3.8 |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + python -m pip install --upgrade pip |
| 24 | + pip install flake8 |
| 25 | + - name: Lint |
| 26 | + run: flake8 dj_rest_auth/ --append-config ./.flake8 |
5 | 27 | build: |
6 | | - name: Publish |
7 | 28 | runs-on: ubuntu-latest |
| 29 | + name: Build |
| 30 | + needs: [lint] |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + - name: Set up Python 3.8 |
| 35 | + uses: actions/setup-python@v5 |
| 36 | + with: |
| 37 | + python-version: 3.8 |
| 38 | + - name: Install dependencies |
| 39 | + run: | |
| 40 | + python -m pip install --upgrade pip |
| 41 | + - name: Build |
| 42 | + run: python3 setup.py sdist |
| 43 | + - name: Store artifacts |
| 44 | + uses: actions/upload-artifact@v4 |
| 45 | + with: |
| 46 | + name: dist |
| 47 | + path: dist/ |
| 48 | + test: |
| 49 | + runs-on: ubuntu-20.04 |
| 50 | + name: Test Python ${{ matrix.python-version }} + Django ~= ${{ matrix.django-version }} |
| 51 | + needs: [build] |
| 52 | + strategy: |
| 53 | + matrix: |
| 54 | + python-version: ['3.8', '3.9', '3.10', '3.11'] |
| 55 | + django-version: ['3.2', '4.2', '5.0'] |
| 56 | + exclude: |
| 57 | + - python-version: '3.8' |
| 58 | + django-version: '5.0' |
| 59 | + - python-version: '3.9' |
| 60 | + django-version: '5.0' |
8 | 61 | steps: |
9 | | - - name: Publish package |
10 | | - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
11 | | - uses: pypa/gh-action-pypi-publish@master |
| 62 | + - name: Checkout |
| 63 | + uses: actions/checkout@v4 |
| 64 | + - name: Set up Python ${{ matrix.python-version }} |
| 65 | + uses: actions/setup-python@v5 |
| 66 | + with: |
| 67 | + python-version: ${{ matrix.python-version }} |
| 68 | + - name: Install dependencies |
| 69 | + run: | |
| 70 | + pip install -r dj_rest_auth/tests/requirements.pip |
| 71 | + pip install "Django~=${{ matrix.django-version }}.0" |
| 72 | + - name: Run Tests |
| 73 | + run: | |
| 74 | + echo "$(python --version) / Django $(django-admin --version)" |
| 75 | + coverage run ./runtests.py |
| 76 | + - name: Generate Coverage Report |
| 77 | + run: | |
| 78 | + mkdir -p test-results/ |
| 79 | + coverage report |
| 80 | + coverage xml |
| 81 | + - name: Code Coverage Summary Report |
| 82 | + uses: irongut/CodeCoverageSummary@v1.3.0 |
| 83 | + with: |
| 84 | + filename: coverage.xml |
| 85 | + - name: Store test results |
| 86 | + uses: actions/upload-artifact@v4 |
12 | 87 | with: |
13 | | - user: __token__ |
14 | | - password: ${{ secrets.pypi_password }} |
| 88 | + name: results-${{ matrix.python-version }}-${{ matrix.django-version }} |
| 89 | + path: test-results/ |
0 commit comments