Merge pull request #84 from Antelox/refactor/python_new_versions #42
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 | |
on: | |
- push | |
- pull_request | |
jobs: | |
test: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ ubuntu-latest, windows-latest, macos-latest ] | |
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] | |
# macos-latest is ARM-based and python 3.7 is not present | |
exclude: | |
- platform: macos-latest | |
python-version: 3.7 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip setuptools tox tox-gh-actions | |
- name: Install to system | |
run: | | |
python -m pip install . | |
- name: Run tox for Test | |
run: | | |
tox | |
- name: Run example*.py for test | |
shell: bash | |
run: | | |
cd examples | |
for file in $(ls example*.py); do | |
echo "::group::Run $file" | |
python3 "$file" | |
echo "::endgroup::" | |
done | |
build: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install -U pip setuptools build | |
- name: Build wheel and create SDist | |
run: | | |
python -m build . | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/dist/* | |
publish: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: dist | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |