Skip to content

Commit 2230104

Browse files
committed
enh: add static analysis with pyright
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
1 parent 2b42c8a commit 2230104

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Static Analysis
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
8+
branches:
9+
- master
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: static-analysis-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
changes:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
25+
outputs:
26+
src: ${{ steps.changes.outputs.src}}
27+
28+
steps:
29+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
30+
id: changes
31+
continue-on-error: true
32+
with:
33+
filters: |
34+
src:
35+
- 'main.py'
36+
- 'main_em.py'
37+
- 'config.cpu.yaml'
38+
- 'config.gpu.yaml'
39+
- 'context_chat_backend/**'
40+
- 'appinfo/**'
41+
- 'example.env'
42+
- 'hwdetect.sh'
43+
- 'persistent_storage/**'
44+
- 'project.toml'
45+
- 'requirements.txt'
46+
- 'logger_config.yaml'
47+
- '.github/workflows/static-analysis.yml'
48+
49+
analysis:
50+
runs-on: ubuntu-latest
51+
52+
needs: changes
53+
if: needs.changes.outputs.src != 'false'
54+
55+
steps:
56+
- name: Checkout CCB
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
58+
59+
- name: Setup python 3.11
60+
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5
61+
with:
62+
python-version: '3.11'
63+
cache: 'pip'
64+
cache-dependency-path: |
65+
requirements.txt
66+
requirements_dev.txt
67+
68+
- name: Install dependencies
69+
run: |
70+
pip install --upgrade pip setuptools wheel
71+
pip install -r requirements_dev.txt
72+
73+
- name: Static analysis with pyright
74+
run: |
75+
pyright
76+
77+
summary:
78+
permissions:
79+
contents: none
80+
runs-on: ubuntu-latest-low
81+
needs: [changes, analysis]
82+
83+
if: always()
84+
85+
# This is the summary, we just avoid to rename it so that branch protection rules still match
86+
name: static-analysis
87+
88+
steps:
89+
- name: Summary status
90+
run: if ${{ needs.changes.outputs.src != 'false' && needs.analysis.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)