Migrate anomaly task to use the new Datumaro dataset #203
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: Geti Tune server checks | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
- releases/** | |
tags: | |
- "v*" | |
pull_request: | |
merge_group: | |
branches: | |
- develop | |
- releases/** | |
permissions: {} # No permissions by default on workflow level | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.after }} | |
cancel-in-progress: true | |
jobs: | |
# Determines if workflow should execute based on event type and changed paths | |
# If push or workflow_dispatch -> always run | |
# If PR or merge_group -> run only if files in specified paths changed | |
check_paths: | |
name: Check if workflow should run | |
runs-on: ubuntu-latest | |
outputs: | |
run_workflow: ${{ steps.run_workflow.outputs.run }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Get all paths that should trigger the workflow | |
id: changed-files-yaml | |
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0 | |
with: | |
files_yaml: | | |
test: | |
- backend/** | |
- .github/** | |
- name: Set run flag | |
id: run_workflow | |
run: | | |
if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
echo "run=true" >> "$GITHUB_OUTPUT" | |
elif [ "${{ steps.changed-files-yaml.outputs.test_any_changed }}" = "true" ]; then | |
echo "run=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "run=false" >> "$GITHUB_OUTPUT" | |
fi | |
python-checks: | |
runs-on: ubuntu-latest | |
needs: check_paths | |
if: needs.check_paths.outputs.run_workflow == 'true' | |
permissions: | |
contents: read # to checkout code | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
with: | |
python-version: "3.13" | |
- name: Install uv | |
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0 | |
with: | |
version: "0.8.8" | |
enable-cache: false | |
- name: Install OpenCV dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libgl1 \ | |
libglib2.0-0 | |
- name: Prepare venv and install Python dependencies | |
working-directory: backend | |
run: | | |
uv lock --check | |
uv sync --frozen --all-extras | |
- name: Check formatting with ruff | |
working-directory: backend | |
run: | | |
uv run ruff check --output-format=github . | |
uv run ruff format --check . | |
- name: Check source code with mypy | |
working-directory: backend | |
run: | | |
uv run mypy . --config-file=pyproject.toml | |
- name: Run unit tests | |
working-directory: backend | |
run: | | |
uv run pytest tests/unit | |
- name: Run integration tests | |
working-directory: backend | |
run: | | |
uv run pytest tests/integration | |
required_check: | |
name: Required Check backend-lint-and-test | |
needs: | |
- check_paths | |
- python-checks | |
runs-on: ubuntu-latest | |
env: | |
CHECKS: ${{ join(needs.*.result, ' ') }} | |
if: always() && !cancelled() | |
steps: | |
- name: Check jobs results | |
run: | | |
for check in ${CHECKS}; do | |
echo "::notice::check=${check}" | |
if [[ "$check" != "success" && "$check" != "skipped" ]]; then | |
echo "::error ::Required status checks failed. They must succeed before this pull request can be merged." | |
exit 1 | |
fi | |
done |