-
Notifications
You must be signed in to change notification settings - Fork 21
48 lines (40 loc) · 1.31 KB
/
python-validation.yml
File metadata and controls
48 lines (40 loc) · 1.31 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
name: Python Validation
on:
pull_request:
paths:
- 'modules/python/**'
env:
PYTHON_MODULES_DIR: modules/python
jobs:
python-validation:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Python Version Check
run: python --version
- name: Install Python Dependencies
working-directory: ${{ env.PYTHON_MODULES_DIR }}
run: pip install -r requirements.txt
- name: Fetch all branches
run: git fetch --prune --unshallow
- name: Run Pylint on changed files
id: changed-files
run: |
# Get list of changed files
file_changes=$(git diff --name-only --diff-filter=d origin/main HEAD -- '*.py')
echo "Files changed: $file_changes"
if [ -z "$file_changes" ]; then
echo "No Python files were changed."
else
pylint $file_changes
fi
- name: Run Python Tests with Coverage
if: always()
working-directory: ${{ env.PYTHON_MODULES_DIR }}
# TODO: Update Validation to check 80% coverage for each test file
run: pytest --cov=. --cov-report=term-missing --cov-fail-under=80