Skip to content

Commit

Permalink
cicd: implement gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dynobo committed Aug 2, 2024
1 parent 2fae9d4 commit 0d93ef2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install hatch
run: pipx install hatch

- uses: actions/setup-python@v5
with:
python-version: "3.11"

python-version: "3.12"
- name: Install system deps
run: |
sudo apt-get update
Expand All @@ -29,11 +24,11 @@ jobs:
python3-gi \
gobject-introspection \
libgtk-3-dev
- name: Run pytest
run: hatch run test

- name: Install python deps
run: pip install '.[dev]'
- name: Run tests
run: pytest
- name: Coveralls
run: hatch run coveralls
run: coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
26 changes: 11 additions & 15 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install hatch
run: pipx install hatch

- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install system deps
run: |
Expand All @@ -27,10 +23,14 @@ jobs:
libcairo2-dev \
python3-gi \
gobject-introspection \
libgtk-4-dev
libgtk-4-dev \
libxml2-utils # required for pre-commit hooks
- name: Run project checks
run: hatch run check
- name: Install python deps
run: pip install '.[dev]'

- name: Run tests
run: pre-commit run --all-files

publish:
name: Build & Publish
Expand All @@ -46,13 +46,9 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Install hatch
run: pipx install hatch

- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"

- name: Install system deps
run: |
Expand All @@ -64,8 +60,8 @@ jobs:
gobject-introspection \
libgtk-4-dev
- name: Build Python package
run: hatch build
- name: Install python deps
run: pip install '.[dev]'

- name: Publish to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MyHumbleSelf

**_Utility to display webcam image for presentation or screencasts on Linux._**
**_Utility to display webcam image for presentations or screencasts on Linux._**

<p align="center"><br>
<img alt="Tests passing" src="https://github.com/dynobo/myhumbleself/workflows/Test/badge.svg">
Expand Down
5 changes: 5 additions & 0 deletions myhumbleself/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ def __init__(self) -> None:

def read(self) -> tuple[bool, np.ndarray]:
sleep(0.01)
if self._placeholder_image is None:
raise ValueError(
"Placeholder miss: %s",
str(Path(__file__).parent / "resources" / "placeholder.jpg"),
)
return True, self._placeholder_image.copy()

def release(self) -> None:
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
build-backend = "setuptools.build_meta"
requires = ["setuptools >= 61.0"]

[tool.setuptools.package-data]
myhumbleself = ["resources/*"]

[project]
name = "MyHumbleSelf"
version = "0.1.0"
Expand Down Expand Up @@ -29,6 +32,7 @@ optional-dependencies = { dev = [
"pre-commit==3.8.0",
"pytest==8.3.2",
"pytest-cov==5.0.0",
"coveralls==4.0.1",
"ruff==0.5.5",
] }

Expand Down

0 comments on commit 0d93ef2

Please sign in to comment.