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 25, 2025
1 parent 38b5385 commit dc0a095
Showing 1 changed file with 12 additions and 30 deletions.
42 changes: 12 additions & 30 deletions backend/.github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ on:
jobs:
lint:
runs-on: self-hosted
defaults:
run:
working-directory: backend

steps:
- name: Clean GitHub Actions workspace manually (force clean)
run: |
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checkout repository without submodules
uses: actions/checkout@v2
with:
submodules: false
clean: true
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@v2
with:
Expand All @@ -32,23 +23,22 @@ jobs:
run: |
python -m venv venv
source venv/bin/activate
pip install -r backend/requirements.txt
pip install -r requirements.txt
- name: Run pylint on backend only
- name: Run pylint (backend only)
run: |
source venv/bin/activate
pylint ./backend/**/*.py
pylint . --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)"
test:
runs-on: self-hosted
needs: lint

steps:
- name: Clean GitHub Actions workspace manually (force clean)
run: |
sudo rm -rf $GITHUB_WORKSPACE/*
- name: Checkout repository without submodules
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: false
Expand All @@ -68,14 +58,6 @@ jobs:
pip install -r backend/requirements.txt
pip install pytest-html
- name: Run pylint with score check
run: |
source venv/bin/activate
pylint backend/main.py backend/db.py backend/init_db.py --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)"
- name: Start Flask API server
run: |
nohup python backend/main.py > flask.log 2>&1 &
Expand All @@ -93,7 +75,7 @@ jobs:
BASE_URL: http://127.0.0.1:5000
run: |
source venv/bin/activate
pytest ./backend/tests --html=backend/test-report.html --self-contained-html
pytest backend/tests --html=backend/test-report.html --self-contained-html
- name: Upload test report
uses: actions/upload-artifact@v3
Expand All @@ -110,7 +92,7 @@ jobs:
needs: lint

steps:
- name: Checkout repository without submodules
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: false
Expand Down

0 comments on commit dc0a095

Please sign in to comment.