pypot/pypot-master/.github/workflows/test_and_distribute.yml
2025-07-30 11:57:45 +08:00

45 lines
1.8 KiB
YAML

name: pypot
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
env:
# The Python version from the matrix used to build and deploy to Pypi
PYTHON_BUILD_VERSION: 3.8
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 build websocket ../pypot
pip install poppy-ergo-jr
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test package with unittest
working-directory: tests
run: |
python -m unittest discover
- name: Build package with Python ${{ env.PYTHON_BUILD_VERSION }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.python-version == env.PYTHON_BUILD_VERSION }}
run: python -m build
- name: Publish package relying on pypa/gh-action-pypi-publish with Python ${{ env.PYTHON_BUILD_VERSION }}
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && matrix.python-version == env.PYTHON_BUILD_VERSION }}
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}