mirror of https://github.com/leafspark/AutoGGUF
ci: add radon, dependabot, and pre-commit workflows
- add radon, dependabot, and pre-commit workflows - optimize imports in AutoGGUF.py
This commit is contained in:
parent
f3257bfa69
commit
034bbbb3b9
|
@ -0,0 +1,8 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
day: "sunday"
|
||||||
|
open-pull-requests-limit: 10
|
|
@ -0,0 +1,17 @@
|
||||||
|
name: pre-commit
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre-commit:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
- name: Install pre-commit
|
||||||
|
run: pip install pre-commit
|
||||||
|
- name: Run pre-commit
|
||||||
|
run: pre-commit run --all-files
|
|
@ -0,0 +1,75 @@
|
||||||
|
name: Radon Code Metrics
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # This allows manual triggering
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- '**.py' # This will run the workflow only when Python files are changed
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- '**.py' # This will run the workflow only when Python files are changed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
radon:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # This is important to fetch all history for comparing changes
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install radon
|
||||||
|
run: pip install radon
|
||||||
|
|
||||||
|
- name: Run radon
|
||||||
|
run: |
|
||||||
|
# Get the list of changed Python files
|
||||||
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||||
|
CHANGED_FILES=$(git ls-files '*.py')
|
||||||
|
else
|
||||||
|
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.py$' || echo "")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$CHANGED_FILES" ]; then
|
||||||
|
# Run Cyclomatic Complexity check
|
||||||
|
echo "Running Cyclomatic Complexity check..."
|
||||||
|
radon cc $CHANGED_FILES -a -s -n D
|
||||||
|
|
||||||
|
# Run Maintainability Index check
|
||||||
|
echo "Running Maintainability Index check..."
|
||||||
|
radon mi $CHANGED_FILES -s -n D
|
||||||
|
else
|
||||||
|
echo "No Python files to analyze."
|
||||||
|
fi
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Check radon output
|
||||||
|
run: |
|
||||||
|
# Get the list of changed Python files
|
||||||
|
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||||||
|
CHANGED_FILES=$(git ls-files '*.py')
|
||||||
|
else
|
||||||
|
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.py$' || echo "")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$CHANGED_FILES" ]; then
|
||||||
|
# Run checks and capture output
|
||||||
|
CC_OUTPUT=$(radon cc $CHANGED_FILES -a -s -n D)
|
||||||
|
MI_OUTPUT=$(radon mi $CHANGED_FILES -s -n D)
|
||||||
|
|
||||||
|
# Check if there's any output (which indicates issues)
|
||||||
|
if [ -n "$CC_OUTPUT" ] || [ -n "$MI_OUTPUT" ]; then
|
||||||
|
echo "Radon detected code complexity or maintainability issues:"
|
||||||
|
[ -n "$CC_OUTPUT" ] && echo "$CC_OUTPUT"
|
||||||
|
[ -n "$MI_OUTPUT" ] && echo "$MI_OUTPUT"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "No code complexity or maintainability issues detected."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No Python files to analyze."
|
||||||
|
fi
|
|
@ -8,7 +8,6 @@
|
||||||
from PySide6.QtCore import *
|
from PySide6.QtCore import *
|
||||||
from PySide6.QtGui import *
|
from PySide6.QtGui import *
|
||||||
from PySide6.QtWidgets import *
|
from PySide6.QtWidgets import *
|
||||||
from flask import Flask, jsonify
|
|
||||||
|
|
||||||
from DownloadThread import DownloadThread
|
from DownloadThread import DownloadThread
|
||||||
from GPUMonitor import GPUMonitor
|
from GPUMonitor import GPUMonitor
|
||||||
|
|
Loading…
Reference in New Issue