Skip to content

Commit

Permalink
chore(ci): use Poetry (#398)
Browse files Browse the repository at this point in the history
* add poetry

* add codespell workflow

* fix findings

* update lock file

* use python v3.8

* remove setup.py etc

* update release workflow

* Revert "fix findings"

This reverts commit 1e4ae0f.

* Revert "add codespell workflow"

This reverts commit 194694b.

* remove codespell

* update test workflow

* update dependencies

* update coverage command

* update coverage command

* Update build.yml

* Rename build.yml to test.yml
  • Loading branch information
CFenner authored Sep 23, 2024
1 parent eb6ac51 commit 8478f6e
Show file tree
Hide file tree
Showing 10 changed files with 673 additions and 145 deletions.
4 changes: 0 additions & 4 deletions .flake8

This file was deleted.

58 changes: 0 additions & 58 deletions .github/workflows/build.yml

This file was deleted.

58 changes: 42 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
name: Upload Python Package
name: Release

# yamllint disable-line rule:truthy
on:
release:
types: [published]
types:
- published

env:
DEFAULT_PYTHON: "3.11"

jobs:
deploy:
release:
name: Releasing to PyPI
runs-on: ubuntu-latest
environment:
name: PyPI
url: https://pypi.org/p/PyViCare
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: "3.x"
- name: Install dependencies
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_APITOKEN }}
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install dependencies
run: poetry install --no-interaction
- name: 🏗 Set package version
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
version="${{ github.event.release.tag_name }}"
version="${version,,}"
version="${version#v}"
poetry version --no-interaction "${version}"
- name: 🏗 Build package
run: poetry build --no-interaction
- name: 🚀 Publish to PyPi
uses: pypa/[email protected]
with:
verbose: true
print-hash: true
password: ${{ secrets.PYPI_APITOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test

# yamllint disable-line rule:truthy
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"

jobs:
pytest:
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ matrix.python }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install dependencies
run: poetry install --no-interaction
- name: 🚀 Run pytest
run: poetry run pytest --cov PyViCare
- name: ⬆️ Upload coverage artifact
uses: actions/[email protected]
with:
name: coverage-${{ matrix.python }}
path: .coverage
20 changes: 0 additions & 20 deletions Makefile

This file was deleted.

Loading

0 comments on commit 8478f6e

Please sign in to comment.