diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 34e8fb5..68668fe 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -15,42 +15,42 @@ jobs: steps: - name: Checkout code without submodules - uses: actions/checkout@v3 + uses: actions/checkout@v2 # Using v2 for actions/checkout with: submodules: false # Skips submodule initialization - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2 # Using v2 for setup-python with: python-version: '3.11' - name: Install dependencies run: | python -m venv venv - source venv/bin/activate # Ensure the virtual environment is activated - pip install -r backend/requirements.txt # Install all dependencies, including requests + source venv/bin/activate + pip install -r requirements.txt # Ensure all dependencies are installed, including requests - name: Cache Python dependencies - uses: actions/cache@v3 + uses: actions/cache@v2 # Using v2 for actions/cache with: path: venv - key: ${{ runner.os }}-python-${{ hashFiles('backend/requirements.txt') }} + key: ${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }} restore-keys: | ${{ runner.os }}-python- - name: Run pylint (backend only on changed files) run: | - source venv/bin/activate # Activate the virtual environment before running pylint - changed_files=$(git diff --name-only origin/main...HEAD | grep '^backend/' || true) + source venv/bin/activate + changed_files=$(git diff --name-only origin/main...HEAD | grep '\.py$' || true) if [ -n "$changed_files" ]; then - pylint backend --exit-zero | tee pylint.log + 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 in the backend, skipping pylint." - exit 0 # Exit with status 0 (success) if no Python files changed in the backend + echo "No Python files changed, skipping pylint." + exit 0 # Exit with status 0 (success) if no Python files changed fi test: @@ -59,24 +59,24 @@ jobs: steps: - name: Checkout code without submodules - uses: actions/checkout@v3 + uses: actions/checkout@v2 # Using v2 for actions/checkout with: submodules: false # Skips submodule initialization - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v2 # Using v2 for setup-python with: python-version: '3.11' - name: Install dependencies run: | python -m venv venv - source venv/bin/activate # Ensure the virtual environment is activated - pip install -r backend/requirements.txt # Install dependencies, including requests + source venv/bin/activate + pip install -r backend/requirements.txt # Ensure all dependencies are installed, including requests pip install pytest-html - name: Cache Python dependencies - uses: actions/cache@v3 + uses: actions/cache@v2 # Using v2 for actions/cache with: path: venv key: ${{ runner.os }}-python-${{ hashFiles('backend/requirements.txt') }} @@ -103,7 +103,7 @@ jobs: pytest backend/tests --html=backend/test-report.html --self-contained-html - name: Upload test report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v2 # Using v2 for actions/upload-artifact with: name: backend-test-report path: backend/test-report.html @@ -118,17 +118,17 @@ jobs: steps: - name: Checkout repository without submodules - uses: actions/checkout@v3 + uses: actions/checkout@v2 # Using v2 for actions/checkout with: submodules: false # Skips submodule initialization - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v3 # Using the latest stable version for Node.js with: node-version: '20' - name: Cache node modules - uses: actions/cache@v3 + uses: actions/cache@v2 # Using v2 for actions/cache with: path: frontend/node_modules key: ${{ runner.os }}-node-${{ hashFiles('frontend/package-lock.json') }}