Skip to content

commit in class 01

commit in class 01 #10

Workflow file for this run

name: CI - Code Quality & Testing

Check failure on line 1 in .github/workflows/code-quality.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/code-quality.yml

Invalid workflow file

(Line: 59, Col: 12): Job 'unit-tests' depends on unknown job 'code-quelity'.
on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
env:
PYTHON_VERSION: 3.10
jobs:
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black isort mypy pytest pytest-cov
pip install -r requirements.dev.txt
- name: Run Black (Code Formatting)
run: |
black --check --diff streamlit-app/ training-pipeline/ tests/
- name: Run isort (Import Sorting)
run: |
isort --check-only --diff streamlit-app/ training-pipeline/ tests/
- name: Run Flake8 (Linting)
run: |
flake8 streamlit-app/ training-pipeline/ tests/ --max-line-length=88 --extend-ignore=E203,W503
- name: Run MyPy (Type Checking)
run: |
mypy streamlit-app/ training-pipeline/ --ignore-missing-imports
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: code-quelity
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r streamlit-app/requirements.txt
pip install -r training-pipeline/requirements.txt
pip install -r requirements.dev.txt
- name: Run unit tests
run: |
pytest tests/ -v --cov=streamlit-app --cov=training-pipeline --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Bandit Security Scan
run: |
pip install bandit[toml]
bandit -r streamlit-app/ training-pipeline/ -f json -o bandit-resport.json
- name: Upload Bandit scan results
uses: actions/upload-artifact@v4
if: always()
with:
name: bandit-security-report
path: bandit-report.json
- name: Run Safety check for dependencies
run: |
pip install safety
safety check --json --output safety-report.json
- name: Upload Safety check results
uses: actions/upload-artifact@v4
if: always()
with:
name: safety-report
path: safety-report.json