diff --git a/.github/workflows/python-checks.yaml b/.github/workflows/python-checks.yaml new file mode 100644 index 00000000..30be9559 --- /dev/null +++ b/.github/workflows/python-checks.yaml @@ -0,0 +1,91 @@ +name: Python Checks + +on: + pull_request: + push: + +jobs: + python-checks: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + + if [ -f requirements.txt ]; then + pip install -r requirements.txt + fi + + pip install pylint ruff black bandit pytype pandas + + - name: Run Pylint + id: pylint + continue-on-error: true + run: | + python_files=$(find . -name "*.py" -not -path "./.venv/*") + python -m pylint $python_files + + - name: Run Ruff + id: ruff + continue-on-error: true + run: | + python -m ruff check . + + - name: Run Black + id: black + continue-on-error: true + run: | + python -m black --check --diff --color . + + - name: Run Bandit + id: bandit + continue-on-error: true + run: | + python -m bandit -r . -x ./.venv + + - name: Run Pytype + id: pytype + continue-on-error: true + run: | + python_files=$(find . -name "*.py" -not -path "./.venv/*") + python -m pytype $python_files + + - name: Fail if any check failed + run: | + failed=0 + + if [ "${{ steps.pylint.outcome }}" != "success" ]; then + echo "Pylint failed" + failed=1 + fi + + if [ "${{ steps.ruff.outcome }}" != "success" ]; then + echo "Ruff failed" + failed=1 + fi + + if [ "${{ steps.black.outcome }}" != "success" ]; then + echo "Black failed" + failed=1 + fi + + if [ "${{ steps.bandit.outcome }}" != "success" ]; then + echo "Bandit failed" + failed=1 + fi + + if [ "${{ steps.pytype.outcome }}" != "success" ]; then + echo "Pytype failed" + failed=1 + fi + + exit $failed diff --git a/idk.txt b/idk.txt new file mode 100644 index 00000000..e69de29b