diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index bdaab28..0e7c3db 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,39 +1,38 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package +name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI on: - release: - types: [published] - -permissions: - contents: read + push: + tags: + - "**" # Push events to every tag including hierarchical tags like v1.0/beta jobs: - deploy: - + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI runs-on: ubuntu-latest + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + + strategy: + matrix: + # Run in all these versions of Python + python-version: ["3.10"] steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - uses: actions/checkout@master + + - name: Set Up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Build and wheel + run: uvx --from build pyproject-build --installer uv + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test-ci.yml b/.github/workflows/test-ci.yml new file mode 100644 index 0000000..cda60e7 --- /dev/null +++ b/.github/workflows/test-ci.yml @@ -0,0 +1,55 @@ +name: Test +run-name: ${{ github.actor }} is testing + +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" + workflow_dispatch: + +jobs: + test: + name: Test code + runs-on: ubuntu-latest + + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + # Run in all these versions of Python + python-version: ["3.10"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + + - name: Test with pytest + run: uv run pytest tests + + mypy: + name: Type check code + runs-on: ubuntu-latest + + strategy: + matrix: + # Run in all these versions of Python + python-version: ["3.10"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Set up uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Type check code + run: uv run mypy src + - name: Type check tests + run: uv run mypy tests \ No newline at end of file