Add main workflow #3
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: test pydantify_common | |
| on: [push, pull_request] | |
| jobs: | |
| linters: | |
| name: linters | |
| strategy: | |
| matrix: | |
| python-version: ["3.13"] | |
| platform: [ubuntu-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Run ruff | |
| run: make ruff | |
| - name: Run mypy | |
| run: make mypy | |
| pytest: | |
| name: Testing on Python ${{ matrix.python-version }} (${{ matrix.platform}}) | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| # platform: [ubuntu-latest, macOS-latest, windows-latest] | |
| platform: [ubuntu-latest, macOS-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install the project | |
| run: uv sync --locked --all-extras --dev | |
| - name: Run pytest | |
| run: make pytest | |
| release: | |
| name: Releasing to pypi | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
| needs: [linters, pytest] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Install uv and set the python version | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: "3.13" | |
| - name: build release | |
| run: uv build | |
| - name: Publish package to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| - uses: actions/upload-artifact@v5 | |
| with: | |
| name: build | |
| path: dist/* |