Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Features #126

Merged
merged 11 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 84 additions & 8 deletions .github/workflows/unittests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,100 @@ on:
paths:
- 'tests/**'
- 'tools/**'
- '.github/workflows/tests.yaml'
- '.github/workflows/unittests.yaml'

jobs:
run_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
version: ['3.10', '3.11']

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
submodules: recursive # Ensures submodules are cloned

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: ${{ matrix.version }}
cache: pip

- name: Install package
run: python -m pip install -e .[dev]
- name: Install dependencies
run: |
pip install -e .[dev]
pip install coverage-badge>=1.1.0 pytest-cov>=4.1.0

- name: Run tests with coverage [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
run: pytest tests --cov=tools --cov-report xml --junit-xml pytest.xml

- name: Run tests [Windows, macOS]
if: matrix.os != 'ubuntu-latest' || matrix.version != '3.10'
run: pytest tests --junit-xml pytest.xml

- name: Generate coverage badge [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
run: coverage-badge -o media/coverage_badge.svg -f

- name: Generate coverage report [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}

- name: Commit coverage badge [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git diff --quiet media/coverage_badge.svg || {
git add media/coverage_badge.svg
git commit -m "[Automated] Updated coverage badge"
}
- name: Push changes [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results [${{ matrix.os }}] (Python ${{ matrix.version }})
path: pytest.xml
retention-days: 10
if-no-files-found: error

publish-test-results:
name: "Publish Tests Results"
needs: run_tests
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
if: always()

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Run Unit Tests
run: python -m pytest tests
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-bullseye
FROM python:3.11-bullseye

## set working directory
WORKDIR /app
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,30 @@ This is a command-line tool that simplifies the conversion process of YOLO model

You can either export a model stored on the cloud (e.g. S3) or locally. You can choose to install the toolkit through pip or using Docker. In the sections below, we'll describe both options.

### Prerequisites

```bash
# Cloning the tools repository and all submodules
git clone --recursive https://github.com/luxonis/tools.git
# Change folder
cd tools
```

### Using Python package

For this to work, you need to be located in the root folder of the project.

```bash
# Install the package
pip install tools@git+https://github.com/luxonis/tools.git@main
# Running the package
# Install the package
pip install .
# Running the package
tools yolov6nr4.pt --imgsz "416"
```

### Using Docker or Docker Compose

This option requires you to have Docker installed on your device. Additionally, to export a local model, please put it inside a `shared-component/models/` folder in the root folder of the project.

#### Prerequisites

```bash
# Cloning the tools repository and all submodules
git clone --recursive https://github.com/luxonis/tools.git
# Change folder
cd tools
```

#### Using Docker

```bash
Expand Down
21 changes: 21 additions & 0 deletions media/coverage_badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tools"
version = "0.1.4"
version = "0.2.0"
description = "Converter for YOLO models into .ONNX format."
readme = "README.md"
requires-python = ">=3.8"
Expand Down
Loading