Development #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: # Allows manual trigger for testing | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the repository | |
- name: Check out the repository | |
uses: actions/checkout@v3 # Updated to v3 | |
# Step 2: Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v3 # Updated to v3 | |
with: | |
python-version: '3.10' | |
# Step 3: Cache pip dependencies for faster workflow runs | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
# Step 4: Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
# Debugging Step: Display Python version and installed packages | |
- name: Display Python Version and Installed Packages | |
run: | | |
python --version | |
pip list | |
# Step 5: Install Linting Tools | |
- name: Install Linting Tools | |
run: | | |
pip install flake8 flake8-bugbear flake8-docstrings | |
# Step 6: Run flake8 linting (Strict Errors) | |
- name: Run flake8 linting (Strict Errors) | |
run: | | |
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics | |
continue-on-error: false # Ensures the job fails if there are strict errors | |
# Step 7: Run flake8 linting (Complexity & Style) | |
- name: Run flake8 linting (Complexity & Style) | |
run: | | |
flake8 src --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics > flake8_style_report.txt | |
# Step 8: Upload Linting Reports as Artifacts | |
- name: Upload Linting Reports | |
uses: actions/upload-artifact@v3 | |
with: | |
name: flake8-reports | |
path: | | |
flake8_style_report.txt | |
# Step 9: Display Linting Completion Message | |
- name: Display Linting Completion Message | |
if: always() | |
run: | | |
echo "Linting completed. Check artifacts for any issues found." |