Skip to content

Commit

Permalink
Update backend-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
pdr21001 authored Apr 26, 2025
1 parent 376b322 commit f5d3b5c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}
Expand All @@ -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
Expand Down Expand Up @@ -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') }}
Expand Down Expand Up @@ -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') }}
Expand Down

0 comments on commit f5d3b5c

Please sign in to comment.