Skip to content

uv, ruff, github actions #10

uv, ruff, github actions

uv, ruff, github actions #10

name: Python package
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --all-extras --dev
- name: Run tests
env:
MS_TEAMS_WEBHOOK: https://httpbin.org/
run: uv run pytest tests --junit-xml=test-results.xml
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: pytest-results
path: test-results.xml
- name: Run Ruff
run: uv run ruff check . --output-file ruff-results.xml --output-format junit
- name: Upload ruff results
uses: actions/upload-artifact@v4
with:
name: ruff-results
path: ruff-results.xml
build:
name: build distribution
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- run: git fetch --tags
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Build dist
run: uv build
- name: built artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pymsteams
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1