Skip to content

Commit

Permalink
Merge branch 'main' into headless
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter committed Feb 12, 2025
2 parents dff7f27 + 36b20f6 commit 952b607
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 19 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# see https://github.com/viamrobotics/build-action for help
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
release:
types: [published]

jobs:
validate-tag: # Make sure we're publishing a tag that looks like semantic versioning
runs-on: ubuntu-latest
steps:
- name: Validate tag format
run: |
TAG="${{ github.event.release.tag_name }}"
echo "Validating tag: '$TAG'"
if [[ $TAG =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[0-9]*)?$ ]]; then
echo "Tag matches semver."
else
echo "Error: tag does not match semver."
exit 1
fi
publish:
runs-on: ubuntu-latest
needs: [validate-tag]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: viamrobotics/build-action@v1
with:
# note: you can replace this line with 'version: ""' if you want to test the build process without deploying
version: ${{ github.ref_name }}
version: ${{ github.event.release.tag_name }}
ref: ${{ github.sha }}
key-id: ${{ secrets.viam_key_id }}
key-value: ${{ secrets.viam_key_value }}
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ jobs:
- uses: actions/checkout@v3

- name: Install dependencies
run: pip install -r requirements.txt
run: |
python --version
pip install --upgrade pip
pip --version
pip install -r requirements.txt
- name: Run lint
run: make lint
Expand Down
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.venv/
__pycache__
.venv

# Artifacts created from running `make setup`
build/
dist/
main.spec
__pycache__/
.venv/
4 changes: 3 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ python3 -m venv $VIRTUAL_ENV
echo installing dependencies from requirements.txt
$VIRTUAL_ENV/bin/pip install -r requirements.txt -U
source $VIRTUAL_ENV/bin/activate
$PYTHON -m PyInstaller --onefile --hidden-import="googleapiclient" main.py
$PYTHON -m PyInstaller --onefile --hidden-import="googleapiclient" --add-data="./src:src" src/main.py
# When running as a local module, we need meta.json to be in the same directory as the module.
ln -sf ../meta.json dist
tar -czvf dist/archive.tar.gz dist/main

4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ async def main():
registry before the module adds the resource model.
"""
Registry.register_resource_creator(
Vision.SUBTYPE,
Vision.API,
MotionDetector.MODEL,
ResourceCreatorRegistration(
MotionDetector.new_service, MotionDetector.validate_config
),
)
module = Module.from_args()

module.add_model_from_registry(Vision.SUBTYPE, MotionDetector.MODEL)
module.add_model_from_registry(Vision.API, MotionDetector.MODEL)
await module.start()


Expand Down
13 changes: 7 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
pillow == 10.0.1
numpy == 1.25.0
viam-sdk>=0.27
pyinstaller
pylint
pytest
pillow == 11.0.0
numpy == 1.26.4
viam-sdk==0.39.0
pyinstaller==6.11.1
pylint==3.3.4
pytest==8.3.4
pytest-asyncio==0.25.3
opencv-python-headless == 4.9.0.80
3 changes: 2 additions & 1 deletion src/motion_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ async def get_properties(
object_point_clouds_supported=False,
)

async def capture_all_from_camera(
# The linter doesn't like the vision service API, which we can't change.
async def capture_all_from_camera( # pylint: disable=too-many-positional-arguments
self,
camera_name: str,
return_image: bool = False,
Expand Down

0 comments on commit 952b607

Please sign in to comment.