support use with mixin classes #29
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: Build, Test, Publish | |
| on: | |
| pull_request: | |
| push: | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: Build, Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: "Check out source code" | |
| uses: actions/checkout@v5 | |
| with: | |
| # do not create shallow checkout to avoid setuptools_scm warnings | |
| fetch-depth: 0 | |
| - name: "Set up Python" | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: "Install uv" | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Install dependencies | |
| run: uv sync --locked --all-extras --dev | |
| - name: Get project version | |
| id: version | |
| run: echo "project-version=$(uv run python -m setuptools_scm)" >> $GITHUB_OUTPUT | |
| - name: Run linters | |
| run: uv run make lint | |
| - name: Run tests | |
| run: uv run make coverage.xml coverage | |
| - name: Python Coverage report | |
| uses: orgoro/coverage@v3.2 | |
| with: | |
| coverageFile: coverage.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build project | |
| run: uv run make dist | |
| - name: Upload build result artifact | |
| id: build-artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.event.repository.name }} ${{ steps.version.outputs.project-version }} | |
| path: dist/* | |
| compression-level: 9 | |
| if-no-files-found: error | |
| outputs: | |
| build-artifact-id: ${{ steps.build-artifact.outputs.artifact-id }} | |
| build-artifact-digest: ${{ steps.build-artifact.outputs.artifact-digest }} | |
| publish-pypi-test: | |
| name: Test publish distribution | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: testpypi | |
| if: ${{ startsWith(github.ref, 'refs/tags') }} | |
| permissions: | |
| # required for trusted publishing to PyPI | |
| id-token: write | |
| steps: | |
| - name: Fetch build artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| artifact-ids: ${{ needs.build.outputs.build-artifact-id }} | |
| path: ${{ github.workspace }}/dist | |
| - name: Publish distribution to Test PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| verbose: true | |
| publish-pypi: | |
| name: Publish distribution | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: pypi | |
| if: ${{ startsWith(github.ref, 'refs/tags') }} | |
| permissions: | |
| # required for trusted publishing to PyPI | |
| id-token: write | |
| steps: | |
| - name: Fetch build artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| artifact-ids: ${{ needs.build.outputs.build-artifact-id }} | |
| path: ${{ github.workspace }}/dist | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true |