Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Label configuration for actions/labeler
# Maps labels to file path glob patterns

# Core evaluation framework
evaluation:
- changed-files:
- any-glob-to-any-file:
- "rag_evaluation/**"

metrics:
- changed-files:
- any-glob-to-any-file:
- "rag_evaluation/metrics/**"

data-ingestion:
- changed-files:
- any-glob-to-any-file:
- "rag_evaluation/data_ingestion/**"

# DocGPT subproject
docgpt:
- changed-files:
- any-glob-to-any-file:
- "systems/docgpt/**"

# Tests
tests:
- changed-files:
- any-glob-to-any-file:
- "tests/**"
- "systems/docgpt/tests/**"

# Documentation
documentation:
- changed-files:
- any-glob-to-any-file:
- "*.md"
- "docs/**"
- "examples/**"

# CI/CD
ci:
- changed-files:
- any-glob-to-any-file:
- ".github/**"

# Dependencies
dependencies:
- changed-files:
- any-glob-to-any-file:
- "requirements.txt"
- "pyproject.toml"
- "setup.py"
- "setup.cfg"
- "systems/docgpt/pyproject.toml"
- "systems/docgpt/uv.lock"

# Configuration
config:
- changed-files:
- any-glob-to-any-file:
- "*.toml"
- "*.cfg"
- "*.ini"
- "*.yml"
- "*.yaml"
- ".flake8"
- ".pre-commit-config.yaml"

# Docker
docker:
- changed-files:
- any-glob-to-any-file:
- "**/Dockerfile"
- "**/docker-compose*.yml"
- "**/.docker/**"
87 changes: 87 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Auto Label PRs

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
pull-requests: write
contents: read

jobs:
label-by-files:
name: Label by Changed Files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Label PR by files changed
uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml

label-by-size:
name: Label by PR Size
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Label PR by size
uses: actions/github-script@v7
with:
script: |
const { data: files } = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
per_page: 100,
});

let totalChanges = 0;
for (const file of files) {
totalChanges += file.additions + file.deletions;
}

let sizeLabel = '';
if (totalChanges < 10) {
sizeLabel = 'size/XS';
} else if (totalChanges < 50) {
sizeLabel = 'size/S';
} else if (totalChanges < 200) {
sizeLabel = 'size/M';
} else if (totalChanges < 500) {
sizeLabel = 'size/L';
} else {
sizeLabel = 'size/XL';
}

// Remove existing size labels
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

for (const label of currentLabels) {
if (label.name.startsWith('size/')) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: label.name,
});
}
}

// Add new size label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [sizeLabel],
});

console.log(`PR has ${totalChanges} changes → labeled as ${sizeLabel}`);
108 changes: 108 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]

permissions:
contents: read

jobs:
lint:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff mypy

- name: Run Ruff linter
run: ruff check . --output-format=github

- name: Run Ruff formatter check
run: ruff format --check .

type-check:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mypy
pip install -r requirements.txt || true

- name: Run mypy
run: mypy rag_evaluation/ --ignore-missing-imports

test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
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 }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -r requirements.txt || true

- name: Run tests
run: |
pytest tests/ -v --tb=short --cov=rag_evaluation --cov-report=term-missing --cov-report=xml

- name: Upload coverage report
if: matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml

test-docgpt:
name: Test DocGPT
runs-on: ubuntu-latest
defaults:
run:
working-directory: systems/docgpt
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Install dependencies
run: uv sync --dev

- name: Run DocGPT tests
run: uv run pytest tests/ -v --tb=short || echo "No tests found yet"
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CodeQL Security Analysis

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
schedule:
# Run weekly on Monday at 8:00 UTC
- cron: "0 8 * * 1"

permissions:
security-events: write
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [python]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: +security-extended

- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{ matrix.language }}"
24 changes: 24 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Dependency Review

on:
pull_request:
branches: [main, master]

permissions:
contents: read
pull-requests: write

jobs:
dependency-review:
name: Review Dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Dependency Review
uses: actions/dependency-review-action@v4
with:
fail-on-severity: high
comment-summary-in-pr: always
deny-licenses: GPL-3.0, AGPL-3.0
Loading
Loading