|
| 1 | +name: Lint and Test |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + lint: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + python-version: ["3.8", "3.9", "3.10", "3.11"] |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - name: Set up Python ${{ matrix.python-version }} |
| 14 | + uses: actions/setup-python@v3 |
| 15 | + with: |
| 16 | + python-version: ${{ matrix.python-version }} |
| 17 | + - name: Install dependencies |
| 18 | + run: | |
| 19 | + python -m pip install --upgrade pip |
| 20 | + pip install '.[dev]' |
| 21 | + pip install . |
| 22 | + pip install pylint |
| 23 | + - name: Run pylint |
| 24 | + run: | |
| 25 | + pylint tiny_web_crawler |
| 26 | +
|
| 27 | + test: |
| 28 | + needs: lint |
| 29 | + runs-on: ubuntu-latest |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + python-version: ["3.8", "3.9", "3.10", "3.11"] |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + - name: Set up Python ${{ matrix.python-version }} |
| 36 | + uses: actions/setup-python@v3 |
| 37 | + with: |
| 38 | + python-version: ${{ matrix.python-version }} |
| 39 | + - name: Install dependencies |
| 40 | + run: | |
| 41 | + python -m pip install --upgrade pip |
| 42 | + pip install '.[dev]' |
| 43 | + pip install . |
| 44 | + - name: Run tests |
| 45 | + run: | |
| 46 | + pytest |
| 47 | +
|
| 48 | + deploy: |
| 49 | + needs: test |
| 50 | + runs-on: ubuntu-latest |
| 51 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + - name: Set up Python |
| 55 | + uses: actions/setup-python@v3 |
| 56 | + with: |
| 57 | + python-version: '3.x' |
| 58 | + - name: Install dependencies |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + pip install build |
| 62 | + - name: Build package |
| 63 | + run: python -m build |
| 64 | + - name: Publish package |
| 65 | + uses: pypa/gh-action-pypi-publish@v1.5.1 |
| 66 | + with: |
| 67 | + user: __token__ |
| 68 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments