Skip to content

Commit 8478f6e

Browse files
authored
chore(ci): use Poetry (#398)
* 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
1 parent eb6ac51 commit 8478f6e

10 files changed

Lines changed: 673 additions & 145 deletions

File tree

.flake8

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,52 @@
1-
name: Upload Python Package
1+
name: Release
22

3+
# yamllint disable-line rule:truthy
34
on:
45
release:
5-
types: [published]
6+
types:
7+
- published
8+
9+
env:
10+
DEFAULT_PYTHON: "3.11"
611

712
jobs:
8-
deploy:
13+
release:
14+
name: Releasing to PyPI
915
runs-on: ubuntu-latest
16+
environment:
17+
name: PyPI
18+
url: https://pypi.org/p/PyViCare
19+
permissions:
20+
contents: write
21+
id-token: write
1022
steps:
11-
- uses: actions/checkout@v4
12-
- name: Set up Python
13-
uses: actions/setup-python@v5
23+
- name: ⤵️ Check out code from GitHub
24+
uses: actions/checkout@v4.1.7
25+
- name: 🏗 Set up Poetry
26+
run: pipx install poetry
27+
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
28+
id: python
29+
uses: actions/setup-python@v5.2.0
1430
with:
15-
python-version: "3.x"
16-
- name: Install dependencies
31+
python-version: ${{ env.DEFAULT_PYTHON }}
32+
cache: "poetry"
33+
- name: 🏗 Install workflow dependencies
1734
run: |
18-
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
20-
- name: Build and publish
21-
env:
22-
TWINE_USERNAME: __token__
23-
TWINE_PASSWORD: ${{ secrets.PYPI_APITOKEN }}
35+
poetry config virtualenvs.create true
36+
poetry config virtualenvs.in-project true
37+
- name: 🏗 Install dependencies
38+
run: poetry install --no-interaction
39+
- name: 🏗 Set package version
2440
run: |
25-
python setup.py sdist bdist_wheel
26-
twine upload dist/*
41+
version="${{ github.event.release.tag_name }}"
42+
version="${version,,}"
43+
version="${version#v}"
44+
poetry version --no-interaction "${version}"
45+
- name: 🏗 Build package
46+
run: poetry build --no-interaction
47+
- name: 🚀 Publish to PyPi
48+
uses: pypa/gh-action-pypi-publish@v1.10.0
49+
with:
50+
verbose: true
51+
print-hash: true
52+
password: ${{ secrets.PYPI_APITOKEN }}

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test
2+
3+
# yamllint disable-line rule:truthy
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- master
9+
pull_request:
10+
workflow_dispatch:
11+
12+
env:
13+
DEFAULT_PYTHON: "3.11"
14+
15+
jobs:
16+
pytest:
17+
name: Python ${{ matrix.python }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
22+
steps:
23+
- name: ⤵️ Check out code from GitHub
24+
uses: actions/checkout@v4.1.7
25+
- name: 🏗 Set up Poetry
26+
run: pipx install poetry
27+
- name: 🏗 Set up Python ${{ matrix.python }}
28+
id: python
29+
uses: actions/setup-python@v5.2.0
30+
with:
31+
python-version: ${{ matrix.python }}
32+
cache: "poetry"
33+
- name: 🏗 Install workflow dependencies
34+
run: |
35+
poetry config virtualenvs.create true
36+
poetry config virtualenvs.in-project true
37+
- name: 🏗 Install dependencies
38+
run: poetry install --no-interaction
39+
- name: 🚀 Run pytest
40+
run: poetry run pytest --cov PyViCare
41+
- name: ⬆️ Upload coverage artifact
42+
uses: actions/upload-artifact@v4.4.0
43+
with:
44+
name: coverage-${{ matrix.python }}
45+
path: .coverage

Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)