YOLO26 ReduceMax in graph + YOLO26 with NMS in graph option #133
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit Tests | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'tests/**' | |
| - 'tools/**' | |
| - '.github/workflows/unittests.yaml' | |
| - 'requirements*.txt' | |
| workflow_call: | |
| inputs: | |
| ml_ref: | |
| description: 'luxonis-ml version (branch/tag/SHA)' | |
| required: true | |
| type: string | |
| tools_ref: | |
| description: 'tools version (branch/tag/SHA)' | |
| required: true | |
| type: string | |
| jobs: | |
| run_tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macOS-latest] | |
| version: ['3.10', '3.11'] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout at tools_ref | |
| if: ${{ inputs.tools_ref != '' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: Luxonis/tools | |
| ref: ${{ inputs.tools_ref }} | |
| path: tools | |
| submodules: recursive # Ensures submodules are cloned | |
| - name: Checkout | |
| if: ${{ inputs.tools_ref == '' && inputs.ml_ref == '' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| submodules: recursive # Ensures submodules are cloned | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.version }} | |
| cache: pip | |
| - name: Install dependencies | |
| shell: bash | |
| working-directory: ${{ inputs.tools_ref != '' && 'tools' || '' }} | |
| run: | | |
| CONSTRAINTS_FILE="$GITHUB_WORKSPACE/constraints.txt" | |
| echo "setuptools<81" > "$CONSTRAINTS_FILE" | |
| export PIP_CONSTRAINT="$CONSTRAINTS_FILE" | |
| pip install -e .[dev] | |
| pip install coverage-badge>=1.1.0 pytest-cov>=4.1.0 | |
| - name: Install specified luxonis-ml | |
| shell: bash | |
| if: inputs.ml_ref != '' | |
| working-directory: tools | |
| env: | |
| ML_REF: ${{ inputs.ml_ref }} | |
| run: | | |
| pip uninstall luxonis-ml -y | |
| pip install \ | |
| "luxonis-ml[data,nn_archive,utils] @ git+https://github.com/luxonis/luxonis-ml.git@${ML_REF}" \ | |
| --upgrade --force-reinstall | |
| - name: Run tests with coverage [Ubuntu] | |
| if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' | |
| working-directory: ${{ inputs.tools_ref != '' && 'tools' || '' }} | |
| env: | |
| COVERAGE_PROCESS_START: .coveragerc | |
| run: | | |
| coverage erase | |
| coverage run -m pytest tests/test_unittests.py --download-weights --delete-weights-now -s -v --junit-xml pytest.xml | |
| coverage combine | |
| coverage xml -o coverage.xml -i # Recent changes to coverage 7.13 make it stricter where it was previously passing https://coverage.readthedocs.io/en/7.13.0/messages.html#error-no-source | |
| - name: Run tests [Windows, macOS] | |
| if: matrix.os != 'ubuntu-latest' || matrix.version != '3.10' | |
| working-directory: ${{ inputs.tools_ref != '' && 'tools' || '' }} | |
| run: pytest tests/test_unittests.py --download-weights --delete-weights-now -s -v --junit-xml pytest.xml | |
| - name: Generate coverage badge [Ubuntu] | |
| if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' && inputs.tools_ref == '' && inputs.ml_ref == '' | |
| run: coverage-badge -f -o media/coverage_badge.svg | |
| - name: Generate coverage report [Ubuntu] | |
| if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' && inputs.tools_ref == '' && inputs.ml_ref == '' | |
| uses: orgoro/coverage@v3.1 | |
| with: | |
| coverageFile: coverage.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Skip coverage badge for forks because we cannot push to another fork without their PAT | |
| - name: Commit coverage badge [Ubuntu] | |
| if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' && inputs.tools_ref == '' && inputs.ml_ref == '' && github.event.pull_request.head.repo.full_name == github.repository | |
| run: | | |
| git config --global user.name 'GitHub Actions' | |
| git config --global user.email 'actions@github.com' | |
| 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' && inputs.tools_ref == '' && inputs.ml_ref == '' && github.event.pull_request.head.repo.full_name == github.repository | |
| uses: ad-m/github-push-action@master | |
| with: | |
| branch: ${{ github.head_ref }} | |
| - name: Upload Test Results | |
| if: always() && inputs.tools_ref == '' && inputs.ml_ref == '' | |
| 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() && inputs.tools_ref == '' && inputs.ml_ref == '' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Publish Test Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: "artifacts/**/*.xml" |