Merge pull request #66 from enoch3712/enoch3712-patch-1 #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python package workflow | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip install poetry | |
poetry install | |
# - name: Run tests | |
# run: poetry run pytest | |
- name: Build package | |
run: poetry build | |
- name: Publish to PyPI | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
test-python-versions: | |
name: Test Python ${{ matrix.python-version }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Verify Python version | |
run: | | |
python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))') | |
if python -c "import sys; exit(0 if sys.version_info >= (3, 9) and sys.version_info < (4, 0) else 1)"; then | |
echo "Python version $python_version meets requirements (>=3.9, <4.0)" | |
else | |
echo "Python version $python_version does not meet requirements (>=3.9, <4.0)" | |
exit 1 | |
fi | |
- name: Test installation | |
run: | | |
pip install poetry | |
poetry install |