| 1 |
name: python |
| 2 |
|
| 3 |
on: [push] |
| 4 |
|
| 5 |
jobs: |
| 6 |
build: |
| 7 |
|
| 8 |
runs-on: ubuntu-latest |
| 9 |
strategy: |
| 10 |
matrix: |
| 11 |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] |
| 12 |
|
| 13 |
steps: |
| 14 |
- uses: actions/checkout@v2 |
| 15 |
- name: Set up Python ${{ matrix.python-version }} |
| 16 |
uses: actions/setup-python@v2 |
| 17 |
with: |
| 18 |
python-version: ${{ matrix.python-version }} |
| 19 |
- name: Cache pip |
| 20 |
uses: actions/cache@v2 |
| 21 |
with: |
| 22 |
# This path is specific to Ubuntu |
| 23 |
path: ~/.cache/pip |
| 24 |
# Look to see if there is a cache hit for the corresponding requirements file |
| 25 |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements_dev.txt') }}-${{ hashFiles('setup.py') }} |
| 26 |
restore-keys: | |
| 27 |
${{ runner.os }}-${{ matrix.python-version }}-pip- |
| 28 |
${{ runner.os }}-${{ matrix.python-version }}- |
| 29 |
- name: Install dev dependencies |
| 30 |
run: | |
| 31 |
python -m pip install --upgrade pip |
| 32 |
pip install -r requirements_dev.txt |
| 33 |
- name: Lint with flake8 |
| 34 |
run: | |
| 35 |
flake8 aiohttp_sse_client2 |
| 36 |
- name: Install |
| 37 |
run: | |
| 38 |
pip install -e . |
| 39 |
- name: Test with pytest |
| 40 |
run: | |
| 41 |
pytest |
| 42 |
- name: Build wheel |
| 43 |
if: matrix.python-version == 3.7 |
| 44 |
run: | |
| 45 |
python setup.py sdist bdist_wheel |
| 46 |
- name: Publish distribution 📦 to Test PyPI |
| 47 |
if: matrix.python-version == 3.7 && startsWith(github.ref, 'refs/tags') |
| 48 |
uses: pypa/gh-action-pypi-publish@master |
| 49 |
with: |
| 50 |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 51 |
repository_url: https://test.pypi.org/legacy/ |
| 52 |
- name: Publish distribution 📦 to PyPI |
| 53 |
if: matrix.python-version == 3.7 && startsWith(github.ref, 'refs/tags') |
| 54 |
uses: pypa/gh-action-pypi-publish@master |
| 55 |
with: |
| 56 |
password: ${{ secrets.PYPI_API_TOKEN }} |