-
-
Notifications
You must be signed in to change notification settings - Fork 45
62 lines (56 loc) · 2.13 KB
/
Copy pathpython-app.yml
File metadata and controls
62 lines (56 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python checks
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
JWT_SECRET_KEY: ci-test-jwt-secret-not-for-production
DATABASE_URL: postgresql+asyncpg://ci:ci@localhost:5432/construction_hazard_detection_test
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.14
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Install dependencies
run: |
python -m pip install --upgrade pip "uv==0.9.9"
# Exercise every source module, but exclude the CUDA/TensorRT-only
# deployment extra. Tests use CPU-compatible ONNX Runtime.
uv sync --frozen --all-extras --no-extra yolo-gpu
- name: Verify lockfile
run: uv lock --check
- name: Lint with flake8
run: |
# Lint the full project, excluding local dependency and history trees.
lint_exclude='.venv,.history,build'
uv run flake8 . --extend-exclude="$lint_exclude" --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
uv run flake8 . --extend-exclude="$lint_exclude" --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
# Measure application code only (main, src, examples). Do not include tests in coverage sources
uv run pytest \
--cov=main \
--cov=src \
--cov=examples \
--cov-report=xml:coverage.xml \
--cov-report=term-missing \
-n auto \
tests/
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
disable_search: true
fail_ci_if_error: true