Skip to content

fix: fixed formating #9

fix: fixed formating

fix: fixed formating #9

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, enhance-pipeline ]
pull_request:
branches: [ main, enhance-pipeline ]
permissions:
contents: write
pull-requests: write
jobs:
lint:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 isort mypy
pip install -r requirements.txt
- name: Check formatting with Black
run: black --check --line-length 120 src/ tests/
- name: Lint with Flake8
run: flake8 src/ tests/
- name: Check import sorting with isort
run: isort --check-only --profile black src/ tests/
- name: Type check with mypy
run: mypy src/
continue-on-error: true
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run unit tests with coverage
run: |
pytest tests/unit/ -v --cov=src --cov-report=xml --cov-report=term-missing
env:
PYTHONPATH: ${{ github.workspace }}
- name: Upload coverage to Codecov
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run integration tests
run: |
pytest tests/integration/ -v -m integration
env:
PYTHONPATH: ${{ github.workspace }}
continue-on-error: true
format:
name: Auto-format Code
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install formatting tools
run: |
python -m pip install --upgrade pip
pip install black isort
- name: Format code with Black
run: black --line-length 120 src/ tests/
- name: Sort imports with isort
run: isort --profile black src/ tests/
- name: Check for changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add -A
git commit -m "style: auto-format code with black and isort [skip ci]"
git push