From 06b013aab413dfb581811db7dccb148f0198a6e3 Mon Sep 17 00:00:00 2001 From: openhands Date: Wed, 17 Dec 2025 23:30:11 +0000 Subject: [PATCH 1/2] Add linting and compilation tests before pipeline tests - Added Lint-and-Compile job to python_workflow_test.yml - Includes Black code formatting check - Includes flake8 linting with syntax error detection - Includes Python compilation tests for all .py files - Includes basic import test for blech_clust package - Pipeline tests (Spike-EMG, EMG-Only) now depend on linting success - Addresses issue #666 Co-authored-by: openhands --- .github/workflows/python_workflow_test.yml | 76 +++++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python_workflow_test.yml b/.github/workflows/python_workflow_test.yml index 0792c6bd..93df07a6 100644 --- a/.github/workflows/python_workflow_test.yml +++ b/.github/workflows/python_workflow_test.yml @@ -3,6 +3,7 @@ # # This workflow runs Python tests on a self-hosted runner # Jobs are independent to allow partial success/failure reporting +# Includes linting and compilation tests before pipeline tests name: Python test run-name: python_test @@ -10,8 +11,79 @@ on: pull_request: workflow_dispatch: jobs: + Lint-and-Compile: + runs-on: self-hosted + concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-lint + cancel-in-progress: true + steps: + - name: Clean workspace + run: | + echo "Cleaning workspace to ensure fresh checkout" + rm -rf ${{ github.workspace }}/* + rm -rf ${{ github.workspace }}/.git + rm -rf ${{ github.workspace }}/.github + + - name: Set up repo + uses: actions/checkout@v4 + + - name: Display Python version + run: | + python --version + which python + + - name: Install test dependencies + run: | + make base test + + - name: Check code formatting with Black + run: | + echo "Checking code formatting with Black..." + conda run -n blech_clust black --check --diff . + + - name: Run flake8 linting + run: | + echo "Running flake8 linting..." + conda run -n blech_clust flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + conda run -n blech_clust flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics + + - name: Python syntax check (compilation test) + run: | + echo "Checking Python syntax and compilation..." + find . -name "*.py" -not -path "./tests/*" -not -path "./.git/*" | while read file; do + echo "Checking syntax: $file" + conda run -n blech_clust python -m py_compile "$file" + done + + - name: Import test (basic compilation check) + run: | + echo "Testing basic imports..." + conda run -n blech_clust python -c " + import sys + import os + sys.path.insert(0, '.') + try: + import blech_clust + print('✓ blech_clust package imports successfully') + except ImportError as e: + print(f'✗ Failed to import blech_clust: {e}') + sys.exit(1) + except Exception as e: + print(f'✗ Error importing blech_clust: {e}') + sys.exit(1) + " + + - name: Cleanup after linting tests + if: always() + run: | + echo "Cleaning up linting test artifacts" + rm -rf .pytest_cache + rm -rf __pycache__ + find . -name "*.pyc" -delete + Preamble: runs-on: self-hosted + needs: Lint-and-Compile concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -59,7 +131,7 @@ jobs: Spike-EMG: runs-on: self-hosted - needs: Preamble + needs: [Lint-and-Compile, Preamble] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -77,7 +149,7 @@ jobs: fi EMG-Only: runs-on: self-hosted - needs: Spike-EMG + needs: [Lint-and-Compile, Spike-EMG] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true From e50a5c2b8535e4152f6be3952491a67fcededbef Mon Sep 17 00:00:00 2001 From: Abuzar Mahmood Date: Wed, 17 Dec 2025 18:55:41 -0500 Subject: [PATCH 2/2] chore(workflow): simplify CI by removing aggressive linting - Removed Black code formatting to streamline the workflow. - Eliminated flake8 linting due to its aggressive enforcement causing CI failures. - Retained basic Python syntax check to ensure code validity. This change ensures a more reliable CI process without unnecessary failures. --- .github/workflows/python_workflow_test.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/python_workflow_test.yml b/.github/workflows/python_workflow_test.yml index 93df07a6..0777a6ba 100644 --- a/.github/workflows/python_workflow_test.yml +++ b/.github/workflows/python_workflow_test.yml @@ -36,17 +36,6 @@ jobs: run: | make base test - - name: Check code formatting with Black - run: | - echo "Checking code formatting with Black..." - conda run -n blech_clust black --check --diff . - - - name: Run flake8 linting - run: | - echo "Running flake8 linting..." - conda run -n blech_clust flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - conda run -n blech_clust flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics - - name: Python syntax check (compilation test) run: | echo "Checking Python syntax and compilation..."