update pyproject and github workflow #157
This file contains hidden or 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-build | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install . --group test | |
| - name: Test with pytest | |
| run: pytest --cov=./ --cov-report=xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v3 | |
| env: | |
| env_vars: OS,PYTHON | |
| files: ./coverage.xml | |
| flags: unittests | |
| fail_ci_if_error: true | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Build package distribution | |
| if: startsWith(github.ref, 'refs/tags') | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist --wheel --outdir dist/ . | |
| - name: Publish package distribution to PyPI | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip_existing: true | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |