pepp'r 0.13.1 #380
Workflow file for this run
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: "CI & CD" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| release: | |
| types: | |
| - published | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| PY_VERSION: "3.11" # Keep in sync with minimum version in pyproject.toml | |
| jobs: | |
| lint: | |
| name: Check code style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PY_VERSION }} | |
| - name: Install package and linting dependencies | |
| run: pip install .[lint] | |
| - name: Check code formatting | |
| run: ruff format --diff | |
| - name: Lint code base | |
| run: ruff check | |
| - name: Check docstring formatting | |
| run: numpydoc lint src/peppr/*.py | |
| - name: Check typing | |
| run: mypy src | |
| build: | |
| name: Build distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PY_VERSION }} | |
| - name: Install build frontend | |
| run: pip install build | |
| - name: Build distribution | |
| run: python -m build . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: distribution | |
| path: ./dist/* | |
| test: | |
| name: Run tests | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: distribution | |
| path: dist | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PY_VERSION }} | |
| - name: Install peppr and test dependencies | |
| # Indirection to install the wheel from glob pattern with extra dependencies | |
| run: | | |
| WHL=(dist/*.whl) | |
| pip install $WHL"[tests]" | |
| - name: Run tests | |
| run: pytest | |
| docs: | |
| name: Build documentation | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| env: | |
| TMPDIR: /tmp/ | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: distribution | |
| path: dist | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PY_VERSION }} | |
| - name: Install peppr and documentation dependencies | |
| run: | | |
| WHL=(dist/*.whl) | |
| pip install $WHL"[docs]" | |
| - name: Build documentation | |
| run: sphinx-build docs build/docs | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: build/docs/ | |
| publish-dist: | |
| name: Publish distribution to GitHub Releases and PyPI | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: | |
| - lint | |
| - build | |
| - test | |
| - docs | |
| environment: | |
| name: publish | |
| url: https://pypi.org/p/peppr | |
| permissions: | |
| contents: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: distribution | |
| path: dist | |
| - name: Upload to GitHub Releases | |
| uses: softprops/action-gh-release@v2.2.1 | |
| with: | |
| files: dist/* | |
| - name: Upload to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| publish-docs: | |
| name: Publish documentation to GitHub Releases and documentation website | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| needs: | |
| - lint | |
| - build | |
| - test | |
| - docs | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: github-pages | |
| path: dist | |
| - name: Rename packaged docs | |
| run: mv dist/artifact.tar dist/docs.tar | |
| - name: Upload to GitHub Releases | |
| uses: softprops/action-gh-release@v2.2.1 | |
| with: | |
| files: dist/docs.tar | |
| - name: Upload to GitHub Pages | |
| uses: actions/deploy-pages@v4 |