| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- master |
| 7 |
- '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6 |
| 8 |
tags: [ 'v*' ] |
| 9 |
pull_request: |
| 10 |
branches: |
| 11 |
- master |
| 12 |
- '[0-9].[0-9]+' |
| 13 |
|
| 14 |
jobs: |
| 15 |
lint: |
| 16 |
name: Linter |
| 17 |
runs-on: ubuntu-latest |
| 18 |
timeout-minutes: 5 |
| 19 |
outputs: |
| 20 |
version: ${{ steps.version.outputs.version }} |
| 21 |
steps: |
| 22 |
- name: Checkout |
| 23 |
uses: actions/checkout@v4 |
| 24 |
- name: Setup Python |
| 25 |
uses: actions/setup-python@v5 |
| 26 |
with: |
| 27 |
python-version: 3.11 |
| 28 |
cache: 'pip' |
| 29 |
cache-dependency-path: '**/requirements*.txt' |
| 30 |
- name: Install dependencies |
| 31 |
uses: py-actions/py-dependency-install@v4 |
| 32 |
with: |
| 33 |
path: requirements-dev.txt |
| 34 |
- name: Run linters |
| 35 |
run: | |
| 36 |
make lint |
| 37 |
|
| 38 |
test: |
| 39 |
name: Test |
| 40 |
strategy: |
| 41 |
matrix: |
| 42 |
pyver: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 43 |
os: [ubuntu, macos, windows] |
| 44 |
runs-on: ${{ matrix.os }}-latest |
| 45 |
timeout-minutes: 10 |
| 46 |
steps: |
| 47 |
- name: Checkout |
| 48 |
uses: actions/checkout@v4 |
| 49 |
- name: Setup Python ${{ matrix.pyver }} |
| 50 |
uses: actions/setup-python@v5 |
| 51 |
with: |
| 52 |
python-version: ${{ matrix.pyver }} |
| 53 |
cache: 'pip' |
| 54 |
cache-dependency-path: '**/requirements*.txt' |
| 55 |
- name: Install dependencies |
| 56 |
uses: py-actions/py-dependency-install@v4 |
| 57 |
with: |
| 58 |
path: requirements.txt |
| 59 |
- name: Run unittests |
| 60 |
run: pytest tests |
| 61 |
env: |
| 62 |
COLOR: 'yes' |
| 63 |
- run: python -m coverage xml |
| 64 |
- name: Upload coverage |
| 65 |
uses: codecov/codecov-action@v4 |
| 66 |
with: |
| 67 |
fail_ci_if_error: true |
| 68 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 69 |
|
| 70 |
check: # This job does nothing and is only used for the branch protection |
| 71 |
if: always() |
| 72 |
needs: [lint, test] |
| 73 |
runs-on: ubuntu-latest |
| 74 |
steps: |
| 75 |
- name: Decide whether the needed jobs succeeded or failed |
| 76 |
uses: re-actors/alls-green@release/v1 |
| 77 |
with: |
| 78 |
jobs: ${{ toJSON(needs) }} |
| 79 |
|
| 80 |
deploy: |
| 81 |
name: Deploy on PyPI |
| 82 |
needs: check |
| 83 |
environment: release |
| 84 |
runs-on: ubuntu-latest |
| 85 |
# Run only on pushing a tag |
| 86 |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') |
| 87 |
steps: |
| 88 |
- name: Checkout |
| 89 |
uses: actions/checkout@v4 |
| 90 |
- name: Setup Python |
| 91 |
uses: actions/setup-python@v5 |
| 92 |
with: |
| 93 |
python-version: 3.11 |
| 94 |
- name: Install dependencies |
| 95 |
uses: py-actions/py-dependency-install@v4 |
| 96 |
with: |
| 97 |
path: requirements-dev.txt |
| 98 |
- name: Update build deps |
| 99 |
run: | |
| 100 |
pip install -U build twine |
| 101 |
- name: Build dists |
| 102 |
run: | |
| 103 |
python -m build |
| 104 |
- name: Make Release |
| 105 |
uses: aio-libs/[email protected] |
| 106 |
with: |
| 107 |
changes_file: CHANGES.rst |
| 108 |
name: aiohttp-sse |
| 109 |
version_file: aiohttp_sse/__init__.py |
| 110 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 111 |
pypi_token: ${{ secrets.PYPI_TOKEN }} |
| 112 |
dist_dir: dist |
| 113 |
fix_issue_regex: "`#(\\d+) <https://github.com/aio-libs/aiohttp-sse/issues/\\1>`_" |
| 114 |
fix_issue_repl: "#\\1" |