Skip to content

Commit

Permalink
update pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
elpablete committed Nov 5, 2024
1 parent bb41cdf commit 430d65a
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 32 deletions.
63 changes: 31 additions & 32 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
55 changes: 55 additions & 0 deletions .github/workflows/test-ci.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 430d65a

Please sign in to comment.