Skip to content

build using uv

build using uv #217

Workflow file for this run

name: Workflow Push
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}
- name: Run lint
run: uv run --group lint pylint --fail-under=10.0 "--ignore-patterns=.*egg-info.*,.*test.*" src/*
- name: Run test
run: |
uv run --group test pytest \
-vv \
--timeout=120 \
--junitxml=pytest.xml \
--cov-config=pyproject.toml \
--cov=src \
--cov-report html:cov_html \
--cov-report xml:cov.xml \
--cov-fail-under=97
- name: Run build
run: uv build
- name: Build doc
run: |
cd docs
uv run --group docs make html
env:
SPHINXBUILD: "python -m sphinx"
- name: Store the distribution packages
uses: actions/upload-artifact@v5
with:
name: build-artifacts-${{ matrix.python-version }}
path: |
dist
deploy-docs:
name: Deploy documentation πŸ“š to GitHub Pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
needs:
- build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: write
pages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
- name: Build docs
run: |
cd docs
uv run --group docs make html
env:
SPHINXBUILD: "python -m sphinx"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
force_orphan: true
publish-to-testpypi:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/nasdaq-protocols
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
- name: Build package
run: uv build
- name: Publish distribution πŸ“¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
publish-to-pypi:
name: >-
Publish Python 🐍 distribution πŸ“¦ to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- publish-to-testpypi # only publish to PyPI after TestPyPI publishing
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nasdaq-protocols
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
- name: Build package
run: uv build
- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true