1 name: Test, build, publish
3 # Run tests (all branches),
4 # for tags build wheels, publish wheels to PyPI and Github Releases.
6 on: [push, pull_request]
13 os: [ubuntu-latest, macos-11, windows-latest]
14 python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy-2.7", "pypy-3.7"]
18 pip-cache-path: ~/.cache/pip
21 pip-cache-path: ~/Library/Caches/pip
24 pip-cache-path: ~\AppData\Local\pip\Cache
26 name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }}
27 runs-on: ${{ matrix.os }}
32 - uses: actions/setup-python@v4
34 python-version: ${{ matrix.python-version }}
36 uses: actions/cache@v3
38 path: ${{ matrix.pip-cache-path }}
39 key: ${{ runner.os }}-pip
42 - name: Install dependencies
45 python -m pip install --upgrade pip setuptools wheel
47 pip install --upgrade virtualenv tox
51 if hasattr(sys, 'pypy_version_info'):
54 pyver = '%d%d' % tuple(sys.version_info[:2])
55 toxenv = 'py%s' % pyver
56 if os.name == 'posix':
57 toxenv += ',py%s-flake8' % pyver
58 with open(os.environ['GITHUB_ENV'], 'a') as f:
59 f.write('TOXENV=' + toxenv + '\n')
65 python -c "import os; print(os.environ['TOXENV'])"
69 - name: Build and publish wheel
71 pip install -U pip setuptools twine wheel
72 python setup.py bdist_wheel
73 twine upload --disable-progress-bar --skip-existing dist\*
74 if: ${{ startsWith(github.ref, 'refs/tags/') }}
76 TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
77 TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
78 - name: Publish wheel to Releases
79 uses: ncipollo/release-action@v1
83 bodyFile: "LATEST-CHANGES.rst"
84 omitBodyDuringUpdate: true
85 omitNameDuringUpdate: true
86 omitPrereleaseDuringUpdate: true
88 replacesArtifacts: false
89 skipIfReleaseExists: false
90 updateOnlyUnreleased: false
91 if: ${{ startsWith(github.ref, 'refs/tags/') }}