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]
11 not_in_conda: "['3.11', 'pypy-3.7']"
15 os: [ubuntu-latest, macos-11, windows-latest]
16 python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.7"]
20 pip-cache-path: ~/.cache/pip
23 pip-cache-path: ~/Library/Caches/pip
26 pip-cache-path: ~\AppData\Local\pip\Cache
28 name: Python ${{ matrix.python-version }} @ ${{ matrix.os-name }}
29 runs-on: ${{ matrix.os }}
34 - uses: s-weigand/setup-conda@v1
36 python-version: ${{ matrix.python-version }}
37 if: ${{ runner.os == 'Linux' && !contains(fromJSON(env.not_in_conda), matrix.python-version) }}
38 - uses: actions/setup-python@v4
40 python-version: ${{ matrix.python-version }}
41 if: ${{ runner.os != 'Linux' || contains(fromJSON(env.not_in_conda), matrix.python-version) }}
43 uses: actions/cache@v3
45 path: ${{ matrix.pip-cache-path }}
46 key: ${{ runner.os }}-pip
49 - name: Install dependencies
52 python -m pip install --upgrade pip setuptools wheel
54 pip install --upgrade virtualenv tox
58 if hasattr(sys, 'pypy_version_info'):
61 pyver = '%d%d' % tuple(sys.version_info[:2])
62 toxenv = 'py%s' % pyver
63 if os.name == 'posix':
64 toxenv += ',py%s-flake8' % pyver
65 with open(os.environ['GITHUB_ENV'], 'a') as f:
66 f.write('TOXENV=' + toxenv + '\n')
72 python -c "import os; print(os.environ['TOXENV'])"
76 - name: Build and publish wheel
78 pip install -U pip setuptools twine wheel
79 python setup.py bdist_wheel
80 twine upload --disable-progress-bar --skip-existing dist\*
81 if: ${{ startsWith(github.ref, 'refs/tags/') }}
83 TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
84 TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
85 - name: Publish wheel to Releases
86 uses: ncipollo/release-action@v1
90 bodyFile: "LATEST-CHANGES.rst"
91 omitBodyDuringUpdate: true
92 omitNameDuringUpdate: true
93 omitPrereleaseDuringUpdate: true
95 replacesArtifacts: false
96 skipIfReleaseExists: false
97 updateOnlyUnreleased: false
98 if: ${{ startsWith(github.ref, 'refs/tags/') }}