-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add Makefile, dev tooling, and GitHub Actions CI #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
22e5148
:hammer: add Makefile and dev tooling (ruff, coverage, pre-commit)
spChalk 05d7f92
:art: apply ruff formatting to existing code
spChalk 3e94327
ci: fail lint on unformatted code
spChalk af2dac2
build: restrict package to Python 3.11
spChalk 98bd379
ci: add GitHub Actions workflow
spChalk 300e391
docs: reflect Python 3.11-only support and add CI badge
spChalk 1ad17b2
ci: upload coverage via GitHub's code coverage API
spChalk a294bed
ci: revert to orgoro/coverage (GitHub Code Quality not enabled)
spChalk 4aa1296
chore: require Python 3.12 and update CI/docs
spChalk 00d469e
test: add minimal placeholder smoke test
spChalk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'app/**' | ||
| - 'tests/**' | ||
| - 'pyproject.toml' | ||
| - 'Makefile' | ||
| - '.github/workflows/ci.yaml' | ||
| pull_request: | ||
| branches: ['**'] | ||
| paths: | ||
| - 'app/**' | ||
| - 'tests/**' | ||
| - 'pyproject.toml' | ||
| - 'Makefile' | ||
| - '.github/workflows/ci.yaml' | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: | ||
| group: 'ci-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| timeout-minutes: 10 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v8.3.2 | ||
| with: | ||
| version: "0.11.28" | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync | ||
|
|
||
| - name: Lint | ||
| run: make lint | ||
|
|
||
| test: | ||
| name: Test | ||
| timeout-minutes: 15 | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v7 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.12' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v8.3.2 | ||
| with: | ||
| version: "0.11.28" | ||
|
|
||
| - name: Install dependencies | ||
| run: uv sync | ||
|
|
||
| - name: Test | ||
| run: make test | ||
|
|
||
| - name: Upload coverage artifacts | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: coverage | ||
| path: | | ||
| coverage.xml | ||
| coverage/ | ||
| if-no-files-found: error | ||
|
|
||
| - name: Coverage | ||
| if: github.event_name == 'pull_request' | ||
| uses: orgoro/coverage@v3.3.1 | ||
| with: | ||
| coverageFile: coverage.xml | ||
| token: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| # Ruff version. | ||
| rev: v0.15.22 | ||
| hooks: | ||
| # Run the linter. | ||
| - id: ruff-check | ||
| args: [ --fix ] | ||
| # Run the formatter. | ||
| - id: ruff-format |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| .PHONY: help install-uv install-dev install lint lint-fix test clean | ||
|
|
||
| help: | ||
| @echo "Available targets:" | ||
| @echo " install-uv Install uv (if not already present)" | ||
| @echo " install-dev Install development dependencies" | ||
| @echo " install Install production dependencies" | ||
| @echo " lint Run ruff check and format check" | ||
| @echo " lint-fix Run ruff check --fix and apply formatting" | ||
| @echo " test Run unit tests with coverage" | ||
| @echo " clean Remove test/coverage artifacts" | ||
|
|
||
| install-uv: | ||
| curl -LsSf https://astral.sh/uv/0.11.28/install.sh | sh | ||
|
|
||
| install-dev: install-uv | ||
| uv sync | ||
| uv run pre-commit install | ||
|
|
||
| install: install-uv | ||
| uv sync --no-dev | ||
| uv run pre-commit install | ||
|
|
||
| lint: | ||
| uv run ruff check app tests | ||
| uv run ruff format app tests --check | ||
|
|
||
| lint-fix: | ||
| uv run ruff check app tests --fix | ||
| uv run ruff format app tests | ||
|
|
||
| test: | ||
| uv run coverage run -m unittest discover -s tests -t . -p "test_*.py" | ||
| uv run coverage report -m | ||
| uv run coverage html -d coverage | ||
| uv run coverage xml | ||
|
|
||
| clean: | ||
| rm -rf .coverage coverage coverage.xml .ruff_cache | ||
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,44 @@ | ||
| from app.bots.admin.admin_bot import AdminBot | ||
|
|
||
|
|
||
| CATEGORIES = { | ||
| 'greeting': {'description': "The user is just greeting the assistant or similar.", 'tool_choice': None}, | ||
| 'recruiting': {'description': "Requests about recruitment at EPFL, including PhD students, postdocs, researchers or any other EPFL staff member.", 'tool_choice': 'any'}, | ||
| 'contract-management': {'description': "Requests about the EPFL work contract for all kind of staff members.", 'tool_choice': 'any'}, | ||
| 'internal-processes': {'description': "Requests about internal processes at EPFL, like mandatory trainings or electing people for management positions.", 'tool_choice': 'any'}, | ||
| 'equipment': {'description': "Requests about equipment or material at EPFL, like purchasing some piece of equipment for research in a lab or regulations on office material.", 'tool_choice': 'any'}, | ||
| 'absences': {'description': "Requests about absences at EPFL, including paid leaves (holidays, medical leaves, maternity or paternity leaves, accidents, etc.) unpaid leaves, teleworking or other absences.", 'tool_choice': 'any'}, | ||
| 'epfl-presidency': {'description': "Explicit requests about the presidency of EPFL.", 'tool_choice': 'any'}, | ||
| 'epfl-vice-presidencies': {'description': "Explicit requests about the vice-presidencies of EPFL.", 'tool_choice': 'any'}, | ||
| 'unrelated': {'description': "The user's request is completely unrelated to EPFL Polylex or EPFL laws and regulations.", 'tool_choice': None}, | ||
| "greeting": {"description": "The user is just greeting the assistant or similar.", "tool_choice": None}, | ||
| "recruiting": { | ||
| "description": "Requests about recruitment at EPFL, including PhD students, postdocs, researchers or any other EPFL staff member.", | ||
| "tool_choice": "any", | ||
| }, | ||
| "contract-management": { | ||
| "description": "Requests about the EPFL work contract for all kind of staff members.", | ||
| "tool_choice": "any", | ||
| }, | ||
| "internal-processes": { | ||
| "description": "Requests about internal processes at EPFL, like mandatory trainings or electing people for management positions.", | ||
| "tool_choice": "any", | ||
| }, | ||
| "equipment": { | ||
| "description": "Requests about equipment or material at EPFL, like purchasing some piece of equipment for research in a lab or regulations on office material.", | ||
| "tool_choice": "any", | ||
| }, | ||
| "absences": { | ||
| "description": "Requests about absences at EPFL, including paid leaves (holidays, medical leaves, maternity or paternity leaves, accidents, etc.) unpaid leaves, teleworking or other absences.", | ||
| "tool_choice": "any", | ||
| }, | ||
| "epfl-presidency": {"description": "Explicit requests about the presidency of EPFL.", "tool_choice": "any"}, | ||
| "epfl-vice-presidencies": { | ||
| "description": "Explicit requests about the vice-presidencies of EPFL.", | ||
| "tool_choice": "any", | ||
| }, | ||
| "unrelated": { | ||
| "description": "The user's request is completely unrelated to EPFL Polylex or EPFL laws and regulations.", | ||
| "tool_choice": None, | ||
| }, | ||
| } | ||
|
|
||
|
|
||
| class LexBot(AdminBot): | ||
| name = 'lex' | ||
| index = 'lex' | ||
| groups = ['graph-chatbot-admins', 'graph-rag-vip', 'graph-rag-lex'] | ||
| name = "lex" | ||
| index = "lex" | ||
| groups = ["graph-chatbot-admins", "graph-rag-vip", "graph-rag-lex"] | ||
|
|
||
| tool_name = 'search_lex' | ||
| tool_name = "search_lex" | ||
|
|
||
| CATEGORIES = CATEGORIES |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: flowless 0 tests ran 🔥