| 1 | name: build |
| 2 | |
| 3 | on: [push, pull_request] |
| 4 | |
| 5 | jobs: |
| 6 | build: |
| 7 | |
| 8 | runs-on: ${{ matrix.os }} |
| 9 | |
| 10 | strategy: |
| 11 | fail-fast: false |
| 12 | matrix: |
| 13 | python: ["3.6", "3.7", "3.8", "3.9", "3.10"] |
| 14 | os: [ubuntu-latest, windows-latest, macos-latest] |
| 15 | include: |
| 16 | - python: "3.6" |
| 17 | tox_env: "py36" |
| 18 | - python: "3.7" |
| 19 | tox_env: "py37" |
| 20 | - python: "3.8" |
| 21 | tox_env: "py38" |
| 22 | - python: "3.9" |
| 23 | tox_env: "py39" |
| 24 | - python: "3.10" |
| 25 | tox_env: "py310" |
| 26 | |
| 27 | steps: |
| 28 | - uses: actions/checkout@v3 |
| 29 | - name: Set up Python |
| 30 | uses: actions/setup-python@v4 |
| 31 | with: |
| 32 | python-version: ${{ matrix.python }} |
| 33 | - name: Install tox |
| 34 | run: | |
| 35 | python -m pip install --upgrade pip |
| 36 | python -m pip install tox |
| 37 | - name: Test |
| 38 | run: | |
| 39 | tox -e ${{ matrix.tox_env }} |
| 40 | |
| 41 | deploy: |
| 42 | |
| 43 | if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 44 | |
| 45 | runs-on: ubuntu-latest |
| 46 | |
| 47 | needs: build |
| 48 | |
| 49 | steps: |
| 50 | - uses: actions/checkout@v3 |
| 51 | - name: Set up Python |
| 52 | uses: actions/setup-python@v4 |
| 53 | with: |
| 54 | python-version: "3.9" |
| 55 | - name: Install wheel |
| 56 | run: | |
| 57 | python -m pip install --upgrade pip |
| 58 | python -m pip install build |
| 59 | - name: Build package |
| 60 | run: | |
| 61 | python -m build |
| 62 | - name: Publish package to PyPI |
| 63 | uses: pypa/gh-action-pypi-publish@master |
| 64 | with: |
| 65 | user: __token__ |
| 66 | password: ${{ secrets.pypi_token }} |