Add label UIs #1290
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 | |
| - release/** | |
| tags: | |
| - "v*" | |
| pull_request: | |
| merge_group: | |
| branches: | |
| - develop | |
| - release/** | |
| 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Get all paths that should trigger the workflow | |
| id: changed-files-yaml | |
| uses: tj-actions/changed-files@e0021407031f5be11a464abee9a0776171c79891 # v47.0.1 | |
| with: | |
| files_yaml: | | |
| test: | |
| - application/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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install uv and set the Python version | |
| uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # v7.1.6 | |
| with: | |
| version: "0.9.7" | |
| enable-cache: false | |
| python-version: "3.13" | |
| - 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: application/backend | |
| run: | | |
| uv lock --check | |
| uv sync --frozen --extra cpu --extra mqtt | |
| - name: Check formatting with ruff | |
| working-directory: application/backend | |
| run: | | |
| uv run ruff check --output-format=github . | |
| uv run ruff format --check . | |
| - name: Check source code with mypy | |
| working-directory: application/backend | |
| run: | | |
| uv run mypy . --config-file=pyproject.toml | |
| - name: Run unit tests | |
| working-directory: application/backend | |
| run: | | |
| uv run pytest tests/unit | |
| - name: Run integration tests | |
| working-directory: application/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 |