Skip to content

Commit ca45abe

Browse files
committed
ci: add pyright static analysis
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
1 parent 59468d3 commit ca45abe

3 files changed

Lines changed: 98 additions & 4 deletions

File tree

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

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
nc_py_api[app]>=0.16.0
2-
apscheduler==3.10.4
3-
timelength==2.0.5
4-
peewee==3.17.6
1+
nc_py_api[app]>=0.20.1
2+
apscheduler
3+
timelength
4+
peewee

requirements_dev.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-r requirements.txt
2+
3+
pyright
4+
ruff
5+
pre-commit

0 commit comments

Comments
 (0)