-
Notifications
You must be signed in to change notification settings - Fork 0
158 lines (137 loc) Β· 4.13 KB
/
Copy pathci.yaml
File metadata and controls
158 lines (137 loc) Β· 4.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: CI
on:
push:
branches:
- develop
pull_request:
branches:
- develop
jobs:
checkout:
runs-on: ubuntu-latest
outputs:
repo-cache-key: repo-${{ github.sha }}
steps:
- name: π₯ Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0 # Ensures we get commit history for diffing
- name: π Cache repository
uses: actions/cache@v6
with:
path: . # Cache the entire repo
key: repo-${{ github.sha }}
changed-files:
needs: checkout
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed-python-files.outputs.all_changed_files }}
steps:
- name: π Restore repository from cache
uses: actions/cache@v6
with:
path: .
key: repo-${{ github.sha }}
- name: π Get changed files
id: changed-python-files
uses: tj-actions/changed-files@v47
with:
files: |
**/*.py
**/*.pyi
ruff-linter:
needs: changed-files
runs-on: ubuntu-latest
if: ${{ needs.changed-files.outputs.changed_files != '' }}
permissions:
contents: read
pull-requests: write
steps:
- name: π Restore repository from cache
uses: actions/cache@v6
with:
path: .
key: repo-${{ github.sha }}
- uses: astral-sh/ruff-action@v3
name: β¨ Lint with Ruff (only changed files)
with:
version: "latest"
src: ${{ needs.changed-files.outputs.changed_files }}
ruff-format:
needs: changed-files
runs-on: ubuntu-latest
if: ${{ needs.changed-files.outputs.changed_files != '' }}
permissions:
contents: read
pull-requests: write
steps:
- name: π Restore repository from cache
uses: actions/cache@v6
with:
path: .
key: repo-${{ github.sha }}
- uses: astral-sh/ruff-action@v3
name: π Format with Ruff (only changed files)
with:
version: "latest"
src: ${{ needs.changed-files.outputs.changed_files }}
args: "format --diff"
# pylint:
# needs: changed-files
# runs-on: ubuntu-latest
# if: ${{ needs.changed-files.outputs.changed_files != '' }}
# permissions:
# contents: read
# pull-requests: write
# steps:
# - name: π Restore repository from cache
# uses: actions/cache@v6
# with:
# path: .
# key: repo-${{ github.sha }}
# - name: π οΈ Install the latest version of uv and set the python version
# uses: astral-sh/setup-uv@v7
# with:
# enable-cache: true
# cache-dependency-glob: "uv.lock"
# - name: π¦Ύ Install the project
# run: uv sync --all-extras
# - name: π¦Ύ Install pylint
# run: uv pip install pylint
# - name: π Run Pylint
# run: uv run pylint ${{ needs.changed-files.outputs.changed_files }}
sonarqube:
needs:
- checkout # Needs full repo
- changed-files
- ruff-linter
- ruff-format
# - pylint
runs-on: ubuntu-latest
if: ${{ needs.changed-files.outputs.changed_files != '' }}
steps:
- name: π Restore repository from cache
uses: actions/cache@v6
with:
path: .
key: repo-${{ github.sha }}
- name: π₯ Install ffmpeg
uses: AnimMouse/setup-ffmpeg@v1
- name: π οΈ Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: π¦Ύ Install the project
run: uv sync
- name: π§ͺ Run pytest with coverage
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: uv run pytest --cov-report=xml
# - name: π SonarQube Cloud Scan (Full Repo)
# uses: SonarSource/sonarqube-scan-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: π§Ή Minimize uv cache
run: uv cache prune --ci