11# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33
4- name : Python package (Linux)
4+ name : Package
55
6- on : [push, pull_request]
6+ on :
7+ push :
8+ pull_request :
9+ release :
10+ types : [created]
11+
12+ defaults :
13+ run :
14+ shell : bash
715
816jobs :
917 build :
10-
11- runs-on : ubuntu-20.04
18+ runs-on : ${{ matrix.os }}
1219 strategy :
1320 matrix :
14- python-version : ['3.6', '3.7', '3.8', '3.9']
21+ os : ['ubuntu-20.04', 'windows-2019']
22+ python-version : ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7']
1523 fail-fast : false
1624
1725 steps :
18- - name : Clone ${{github.repository}}
19- # actions/checkout breaks `git describe` so a manual clone is needed.
26+ - name : Checkout code
27+ # v2 breaks `git describe` so v1 is needed.
2028 # https://github.com/actions/checkout/issues/272
21- run : |
22- git clone https://github.com/${{github.repository}}.git ${{github.workspace}}
23- git checkout ${{github.sha}}
29+ uses : actions/checkout@v1
2430 - name : Checkout submodules
2531 run : |
2632 git submodule update --init --recursive --depth 1
@@ -29,13 +35,14 @@ jobs:
2935 with :
3036 python-version : ${{ matrix.python-version }}
3137 - name : Install APT dependencies
38+ if : runner.os == 'Linux'
3239 run : |
3340 sudo apt-get update
3441 sudo apt-get install libsdl2-dev xvfb
3542 - name : Install Python dependencies
3643 run : |
3744 python -m pip install --upgrade pip
38- python -m pip install flake8 mypy pytest pytest-cov pytest-benchmark black isort
45+ python -m pip install flake8 mypy pytest pytest-cov pytest-benchmark black isort wheel
3946 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4047 - name : Initialize package
4148 run : |
6067 isort examples/ --check --diff --thirdparty tcod
6168 - name : Build package.
6269 run : |
63- python setup.py develop # Install the package in-place.
70+ python setup.py build sdist develop bdist_wheel --py-limited-api cp36 # Install the package in-place.
6471 - name : Test with pytest
72+ if : runner.os == 'Windows'
73+ run : |
74+ pytest --cov-report=xml
75+ - name : Test with pytest
76+ if : runner.os != 'Windows'
6577 run : |
6678 xvfb-run --auto-servernum pytest --cov-report=xml
6779 - uses : codecov/codecov-action@v1
80+ - name : Upload to PyPI
81+ if : github.event_name == 'release' && runner.os != 'Linux'
82+ env :
83+ TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
84+ TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
85+ run : |
86+ twine upload --skip-existing dist/*
0 commit comments