1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ lint :
11+ name : Lint Code
12+ runs-on : ubuntu-latest
13+ strategy :
14+ matrix :
15+ python-version : ["3.10", "3.11", "3.12", "3.14"]
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Set up Python ${{ matrix.python-version }}
21+ uses : actions/setup-python@v4
22+ with :
23+ python-version : ${{ matrix.python-version }}
24+
25+ - name : Install uv
26+ uses : astral-sh/setup-uv@v3
27+ with :
28+ enable-cache : true
29+ cache-dependency-glob : " pyproject.toml"
30+
31+ - name : Install dependencies
32+ run : |
33+ uv sync --dev
34+
35+ - name : Run ruff (linting)
36+ run : |
37+ uv run ruff check dify_client tests
38+
39+ - name : Run black (check formatting)
40+ run : |
41+ uv run black --check dify_client tests
42+
43+ - name : Run isort (check import sorting)
44+ run : |
45+ uv run isort --check-only dify_client tests
46+
47+ - name : Run mypy (type checking)
48+ run : |
49+ uv run mypy dify_client
50+
51+ - name : Compile Python files (syntax check)
52+ run : |
53+ uv run python -m py_compile $(find dify_client -name "*.py") $(find tests -name "*.py")
54+
55+ test :
56+ name : Test Code
57+ runs-on : ubuntu-latest
58+ strategy :
59+ matrix :
60+ python-version : ["3.10", "3.11", "3.12", "3.14"]
61+
62+ steps :
63+ - uses : actions/checkout@v4
64+
65+ - name : Set up Python ${{ matrix.python-version }}
66+ uses : actions/setup-python@v4
67+ with :
68+ python-version : ${{ matrix.python-version }}
69+
70+ - name : Install uv
71+ uses : astral-sh/setup-uv@v3
72+ with :
73+ enable-cache : true
74+ cache-dependency-glob : " pyproject.toml"
75+
76+ - name : Install dependencies
77+ run : |
78+ uv sync --dev
79+
80+ - name : Run tests with pytest
81+ run : |
82+ uv run pytest -v --cov=dify_client --cov-report=xml --cov-report=html
83+
84+ - name : Upload coverage to Codecov
85+ uses : codecov/codecov-action@v3
86+ with :
87+ file : ./coverage.xml
88+ flags : unittests
89+ name : codecov-umbrella
90+ fail_ci_if_error : false
91+
92+ security :
93+ name : Security Scan
94+ runs-on : ubuntu-latest
95+
96+ steps :
97+ - uses : actions/checkout@v4
98+
99+ - name : Set up Python
100+ uses : actions/setup-python@v4
101+ with :
102+ python-version : " 3.11"
103+
104+ - name : Install uv
105+ uses : astral-sh/setup-uv@v3
106+ with :
107+ enable-cache : true
108+ cache-dependency-glob : " pyproject.toml"
109+
110+ - name : Install dependencies
111+ run : |
112+ uv sync --dev
113+
114+ - name : Run bandit security linter
115+ run : |
116+ uv run bandit -r dify_client -f json -o bandit-report.json
117+
118+
119+ - name : Upload security reports
120+ uses : actions/upload-artifact@v4
121+ if : always()
122+ with :
123+ name : security-reports
124+ path : |
125+ bandit-report.json
0 commit comments