Skip to content

Refactor/decoupling tests #262

Refactor/decoupling tests

Refactor/decoupling tests #262

name: Lints, formats, and checks vulnerabilities in the code
on: [push, pull_request]
jobs:
lint_and_format:
runs-on: ubuntu-latest
steps:
- name: Fetch code
uses: actions/checkout@v3
# - name: Check linting
# uses: astral-sh/ruff-action@v1
# with:
# args: "check"
- uses: astral-sh/ruff-action@v1
with:
args: "format --check"
vulnerability_analysis:
runs-on: ubuntu-latest
needs: lint_and_format
steps:
- name: Fetch code
uses: actions/checkout@v3
- name: "Install dependecies"
run: pip install bandit
- name: "Check with bandit"
run: bandit -r src/
tests:
runs-on: ubuntu-latest
needs: lint_and_format
strategy:
matrix:
python-version: ['3.10', '3.11']
steps:
- name: Fetch code
uses: actions/checkout@v3
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py', 'setup.cfg', 'pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: "Create virtual environment"
run: |
python -m venv .venv
shell: bash
- name: "Install dependencies"
run: |
source .venv/bin/activate
pip install -e ".[langgraph,asyncflow,dev]"
shell: bash
- name: Run python tests with coverage
env:
OPEN_ROUTER_API_KEY: ${{ secrets.OPEN_ROUTER_API_KEY }}
run: |
source .venv/bin/activate
pytest -vv -s \
--cov=flowgentic \
--cov-report=html:coverage_report \
--cov-report=term-missing \
--cov-report=term:skip-covered \
tests/
shell: bash
- name: "Show coverage summary"
if: always()
run: |
echo "=== Coverage Summary ==="
coverage report || echo "Coverage report not available"
- name: Upload results of test coverage
uses: actions/upload-artifact@v4
if: always()
with:
path: ./coverage_report/
name: codecoverage-py${{ matrix.python-version }}