Skip to content

Commit

Permalink
build: updated github actions to build and publish with pdm
Browse files Browse the repository at this point in the history
  • Loading branch information
mjspeck committed Feb 9, 2024
1 parent f1e51fd commit af80638
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 35 deletions.
60 changes: 35 additions & 25 deletions .github/workflows/upload-package.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,44 @@
name: Upload Python Package

on:
push:
tags:
- 'v*'
push:
tags:
- "v*"

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9, 3.10, 3.11, 3.12]
os: [ubuntu-latest, macOS-latest, windows-latest]

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
steps:
- uses: actions/checkout@v3
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Install dependencies
run: |
pdm sync -d
- name: Run Tests
run: |
pdm run -v pytest tests
- name: Build and check package
run: |
python setup.py sdist bdist_wheel
twine check dist/*
- name: Upload to PyPi
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
pypi-publish:
name: upload release to PyPI
runs-on: ubuntu-latest
permissions:
# This permission is needed for private repositories.
contents: read
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3

- uses: pdm-project/setup-pdm@v3

- name: Publish package distributions to PyPI
run: pdm publish
105 changes: 98 additions & 7 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"python3-xlib>=0.15",
"ollama>=0.1.6",
]
requires-python = ">=3.12"
requires-python = ">=3.9"
readme = "README.md"
license = { text = "MIT" }

Expand All @@ -31,10 +31,16 @@ where = ["."]
[tool.setuptools.package-data]
"operate.models.weights" = ["best.pt"]


[tool.pdm]
distribution = true

[tool.pdm.dev-dependencies]
dev = [
"pytest>=8.0.0",
]
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"


[tool.pdm]
distribution = true
2 changes: 2 additions & 0 deletions test/test_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_import():
from operate.main import main

0 comments on commit af80638

Please sign in to comment.