Skip to content

Commit

Permalink
Add Initial Package Structure
Browse files Browse the repository at this point in the history
* Add poetry package structure for SCC1 driver
* Add initial github action for build and test
  • Loading branch information
psachs committed Feb 8, 2024
1 parent 5562450 commit 99ddf62
Show file tree
Hide file tree
Showing 9 changed files with 926 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Test
on: push

jobs:
test:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
poetry-version: ["1.7.1"]
os: [ubuntu-22.04, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install --with test
- name: Verify style with flake8
run: poetry run flake8
- name: Run tests
run: poetry run pytest
- name: Coveralls
uses: coverallsapp/github-action@v2
27 changes: 27 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build and Test
on:
push:
branches:
- main
tags:
- "^[0-9]+.[0-9]+.[0-9]+"

jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install --with docs
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Test
on:
push:
tags:
- "^[0-9]+.[0-9]+.[0-9]+"

jobs:
publish:
environment:
name: release
url: https://pypi.org/p/sensirion-uart-scc1
permissions:
id-token: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ matrix.poetry-version }}
- uses: actions/cache@v3
name: Define a cache for the virtual environment based on the dependencies lock file
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install
- name: Install the project dependencies
run: poetry publish --build
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ htmlcov/
.nox/
.coverage
.coverage.*
coverage.lcov
.cache
nosetests.xml
coverage.xml
Expand Down
791 changes: 791 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[virtualenvs]
create = true
in-project = true
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[tool.poetry]
name = "sensirion-uart-scc1"
version = "0.1.0"
description = "Driver for Sensirion SCC1 USB cable"
authors = ["Pascal Sachs"]
license = "BSD-3-Clause"
readme = "README.md"

[tool.poetry.dependencies]
python = ">=3.8.1,<4"
sensirion-shdlc-driver = "^0.1.5"

[tool.poetry.group.test]
optional = true

[tool.poetry.group.test.dependencies]
pytest = "^7.4"
flake8 = "^7.0.0"
pytest-cov = "^4.1"

[tool.pytest.ini_options]
minversion = "7.0"
addopts = "--cov=sensirion_uart_scc1 --cov-report term --cov-report lcov"
testpaths = [
"tests"
]

[tool.poetry.group.docs]
optional = true

[tool.poetry.group.docs.dependencies]
sphinx = "^6.1.3"
sphinx-rtd-theme = "^1.2.0"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Empty file added sensirion_uart_scc1/__init__.py
Empty file.
Empty file added tests/__init__.py
Empty file.

0 comments on commit 99ddf62

Please sign in to comment.