8000 Add `workflow_call` support in unittests workflow by JSabadin · Pull Request #93 · luxonis/datadreamer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add workflow_call support in unittests workflow #93

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

Merged
merged 5 commits into from
May 13, 2025
Merged
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
50 changes: 43 additions & 7 deletions .github/workflows/unit-tests.yaml
10000
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ on:
- 'datadreamer/**/**.py'
- 'tests/core_tests/unittests/**.py'
- .github/workflows/unit-tests.yaml
workflow_dispatch:
workflow_call:
inputs:
ml_ref:
description: 'luxonis-ml version (branch/tag/SHA)'
required: true
type: string
datadreamer_ref:
description: 'datadreamer version (branch/tag/SHA)'
required: true
type: string

jobs:

Expand All @@ -25,9 +34,18 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}
with:
ref: ${{ github.head_ref }}

- name: Checkout at datadreamer_ref
if: ${{ inputs.datadreamer_ref != ''}}
uses: actions/checkout@v4
with:
repository: Luxonis/datadreamer
ref: ${{ inputs.datadreamer_ref }}
path: datadreamer

- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -43,42 +61,60 @@ jobs:

- name: Install dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
working-directory: ${{ inputs.datadreamer_ref != '' && 'datadreamer' || '' }}
run: |
sudo apt update
sudo apt install -y pandoc
pip install -e .[dev]
pip install coverage-badge>=1.1.0 pytest-cov>=4.1.0
- name: Install dependencies [Windows]
if: matrix.os == 'windows-latest'
working-directory: ${{ inputs.datadreamer_ref != '' && 'datadreamer' || '' }}
run: |
pip install -e .[dev]
pip install coverage-badge>=1.1.0 pytest-cov>=4.1.0
- name: Install dependencies [macOS]
if: matrix.os == 'macOS-latest'
working-directory: ${{ inputs.datadreamer_ref != '' && 'datadreamer' || '' }}
run: |
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: datadreamer
env:
ML_REF: ${{ inputs.ml_ref }}
run: |
pip uninstall luxonis-ml -y
pip install \
"luxonis-ml[all] @ 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.datadreamer_ref != '' && 'datadreamer' || '' }}
run: pytest tests/core_tests/unittests --cov=datadreamer --cov-report xml --junit-xml pytest.xml

- name: Run tests [Windows, macOS]
if: matrix.os != 'ubuntu-latest' || matrix.version != '3.10'
working-directory: ${{ inputs.datadreamer_ref != '' && 'datadreamer' || '' }}
run: pytest tests/core_tests/unittests --junit-xml pytest.xml

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

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

- name: Commit coverage badge [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' && github.event_name == 'pull_request'
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
Expand All @@ -87,13 +123,13 @@ jobs:
git commit -m "[Automated] Updated coverage badge"
}
- name: Push changes [Ubuntu]
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10'
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.10' && github.event_name == 'pull_request'
uses: ad-m/github-push-action@master
with:
branch: ${{ github.head_ref }}

- name: Upload Test Results
if: always()
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: Test Results [${{ matrix.os }}] (Python ${{ matrix.version }})
Expand All @@ -108,7 +144,7 @@ jobs:
permissions:
checks: write
pull-requests: write
if: always()
if: always() && github.event_name == 'pull_request'

steps:
- name: Checkout
Expand Down
Loading
0