Skip to content
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

Run tests in CI, add code coverage #28

Merged
merged 1 commit into from
Mar 11, 2025
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
65 changes: 0 additions & 65 deletions .github/workflows/poetry-build.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Builds the `hfppl` poetry environment and runs all tests
# Adapted from: https://github.com/marketplace/actions/install-poetry-action

name: Codebase tests

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

jobs:
build:
runs-on: ParallelHoss
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install project
run: poetry install --no-interaction

- name: Run tests
run: |
eval $(poetry env activate)
pytest -v --cov=hfppl --cov-report=json

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: false
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.json
slug: probcomp/hfppl
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
coverage.json

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# LLaMPPL + HuggingFace

[![docs](https://github.com/probcomp/hfppl/actions/workflows/docs.yml/badge.svg)](https://probcomp.github.io/hfppl)
[![Tests](https://github.com/probcomp/hfppl/actions/workflows/pytest.yml/badge.svg)](https://github.com/probcomp/hfppl/actions/workflows/pytest.yml)
[![codecov](https://codecov.io/gh/probcomp/hfppl/graph/badge.svg?token=414EHUC2P3)](https://codecov.io/gh/probcomp/hfppl)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming that token isn't intended to be secure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep that's correct, this is what codecov sends us to copy-paste.




LLaMPPL is a research prototype for language model probabilistic programming: specifying language generation tasks by writing probabilistic programs that combine calls to LLMs, symbolic program logic, and probabilistic conditioning. To solve these tasks, LLaMPPL uses a specialized sequential Monte Carlo inference algorithm. This technique, SMC steering, is described in [our recent workshop abstract](https://arxiv.org/abs/2306.03081).

Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
coverage:
status:
project:
default:
target: auto
threshold: 3%
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protobuf = "^5.27.2"
nltk = {version = "^3.8.1", optional = true}
pre-commit = "^3.7.1"
ipykernel = "^6.29.5"
genlm-backend = { git = "https://github.com/chi-collective/genlm-backend.git" }
genlm-backend = "^0.0.1"

[tool.poetry.group.vllm]
optional = true
Expand All @@ -31,6 +31,8 @@ vllm = "^0.6.6"
[tool.poetry.group.dev.dependencies]
pytest = "*"
pytest-benchmark = "*"
pytest-cov = "*"
pytest-xdist = "^3.2.0"
black = "^23.12.1"
pre-commit = "^3.6.0"
jupyterlab = "^4.0.9"
Expand Down