diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index dcb9bf8..f46a05f 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -26,7 +26,7 @@ jobs: pip install -r requirements.txt - name: Cache Python dependencies - uses: actions/cache@v3 # Updated to v3 + uses: actions/cache@v3 # Using the latest stable version with: path: venv key: ${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }} @@ -38,14 +38,16 @@ jobs: source venv/bin/activate # Compare against the remote main branch to handle the first commit changed_files=$(git diff --name-only origin/main...HEAD | grep '\.py$' || true) + if [ -n "$changed_files" ]; then pylint $changed_files --exit-zero | tee pylint.log + SCORE=$(tail -n 2 pylint.log | grep -oP '[0-9]+\.[0-9]+(?=/10)') + echo "Pylint score: $SCORE" + python -c "import sys; sys.exit(0 if float('$SCORE') >= 8.0 else 1)" else echo "No Python files changed, skipping pylint." + exit 0 # Exit with status 0 (success) if no Python files changed fi - SCORE=$(tail -n 2 pylint.log | grep -oP '[0-9]+\.[0-9]+(?=/10)') - echo "Pylint score: $SCORE" - python -c "import sys; sys.exit(0 if float('$SCORE') >= 8.0 else 1)" test: runs-on: self-hosted @@ -73,7 +75,7 @@ jobs: pip install pytest-html - name: Cache Python dependencies - uses: actions/cache@v3 # Updated to v3 + uses: actions/cache@v3 # Using the latest stable version with: path: venv key: ${{ runner.os }}-python-${{ hashFiles('backend/requirements.txt') }} @@ -128,7 +130,7 @@ jobs: node-version: '20' - name: Cache node modules - uses: actions/cache@v3 # Updated to v3 + uses: actions/cache@v3 # Using the latest stable version with: path: frontend/node_modules key: ${{ runner.os }}-node-${{ hashFiles('frontend/package-lock.json') }}