Skip to content

Commit c1ea31f

Browse files
committed
ci: enforce migration and release quality gates
1 parent 0f106b6 commit c1ea31f

7 files changed

Lines changed: 1214 additions & 14 deletions

File tree

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ indent_style = tab
1818
[*.sh]
1919
indent_size = 2
2020

21+
[*.py]
22+
max_line_length = 100
23+
24+
[*.tsv]
25+
indent_style = tab
26+
trim_trailing_whitespace = false
27+
2128
# Keep test fixtures byte-exact
2229
[tests/fixtures/**]
2330
trim_trailing_whitespace = false

.github/workflows/ci.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,34 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18+
quality:
19+
name: Static quality and data integrity
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- uses: actions/setup-python@v5
26+
with:
27+
python-version: "3.10"
28+
cache: pip
29+
cache-dependency-path: requirements*.txt
30+
- run: python -m pip install -r requirements-dev.txt
31+
- name: Install shell quality tooling
32+
run: sudo apt-get update && sudo apt-get install -y shellcheck
33+
- name: Python format, lint, and types
34+
run: |
35+
ruff format --check rewardharness src scripts examples tests vanilla
36+
ruff check rewardharness src scripts examples tests vanilla
37+
mypy rewardharness
38+
- name: Rating and shell integrity
39+
run: |
40+
python scripts/check_rating_integrity.py
41+
python scripts/check_migration_coverage.py
42+
pip-audit -r requirements.txt
43+
for file in scripts/*.sh scripts/lib/*.sh; do bash -n "$file"; done
44+
shellcheck scripts/*.sh scripts/lib/*.sh
45+
1846
test:
1947
name: Test on Python ${{ matrix.python-version }}
2048
runs-on: ubuntu-latest
@@ -38,11 +66,11 @@ jobs:
3866
python -m pip install --upgrade pip
3967
python -m pip install -r requirements-dev.txt
4068
41-
- name: Run test suite
42-
run: python -m pytest tests/ -v --tb=short
69+
- name: Run test suite with coverage
70+
run: python -m pytest tests/ -v --tb=short --cov=rewardharness --cov-report=term-missing
4371

4472
- name: Smoke-test library inspection
45-
run: python examples/inspect_library.py
73+
run: python -m rewardharness.cli inspect
4674

4775
package:
4876
name: Validate distribution
@@ -65,6 +93,12 @@ jobs:
6593
python -m build
6694
python -m twine check dist/*
6795
96+
- name: Test wheel installation
97+
run: |
98+
python -m venv /tmp/rewardharness-wheel
99+
/tmp/rewardharness-wheel/bin/pip install dist/*.whl
100+
/tmp/rewardharness-wheel/bin/rewardharness inspect
101+
68102
- name: Upload distributions
69103
uses: actions/upload-artifact@v4
70104
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ build/
1515
.mypy_cache/
1616
.ruff_cache/
1717
.coverage
18+
.coverage.*
19+
htmlcov/
20+
.migration-coverage.json
1821
.tox/
1922

2023
# Experiment outputs (large; not in public release)

Makefile

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help install install-dev check test release-check demo evolve benchmark reproduce clean
1+
.PHONY: help install install-dev check test quality release-check demo evolve benchmark reproduce clean
22

33
# Default target: show available commands
44
help:
@@ -9,11 +9,12 @@ help:
99
@echo " make install Install Python dependencies (core only) nothing"
1010
@echo " make install-dev Install test and release tooling nothing"
1111
@echo " make test Run the test suite nothing (no GPU/net)"
12+
@echo " make quality Run lint, types, data integrity, and shell checks dev dependencies"
1213
@echo " make release-check Build and validate wheel + source distribution nothing"
1314
@echo " make check Preflight: verify env vars / creds / endpoints nothing (probes only)"
1415
@echo " make demo 1-iter smoke test from examples/seed_library Gemini + vLLM (or HF)"
1516
@echo " make benchmark K=2/3/4 accuracy on EditReward-Bench (read-only) Gemini + vLLM"
16-
@echo " make evolve Evolve src/library/ for 200 iters → results/my_run/ Gemini + vLLM"
17+
@echo " make evolve Evolve packaged library for 200 iters → results/my_run/ Gemini + vLLM"
1718
@echo " make reproduce End-to-end EditReward-Bench reproduction (~4-6 h) Gemini + 4 GPUs"
1819
@echo " make clean Remove caches and generated artifacts nothing"
1920
@echo ""
@@ -24,43 +25,54 @@ help:
2425
@echo "See .env.example for the full list."
2526

2627
install:
27-
pip install -r requirements.txt
28+
python -m pip install -r requirements.txt
2829

2930
install-dev:
30-
pip install -r requirements-dev.txt
31+
python -m pip install -r requirements-dev.txt
3132

3233
check:
3334
python scripts/check_env.py
3435

3536
test:
36-
python -m pytest tests/ -v
37+
python -m pytest tests/ -v --cov=rewardharness --cov-report=term-missing
3738

38-
release-check:
39+
quality:
40+
ruff format --check rewardharness src scripts examples tests vanilla
41+
ruff check rewardharness src scripts examples tests vanilla
42+
mypy rewardharness
43+
python scripts/check_rating_integrity.py
44+
python scripts/check_migration_coverage.py
45+
pip-audit -r requirements.txt
46+
@for file in scripts/*.sh scripts/lib/*.sh; do bash -n "$$file"; done
47+
@if command -v shellcheck >/dev/null 2>&1; then shellcheck scripts/*.sh scripts/lib/*.sh; \
48+
else echo "shellcheck not installed; bash syntax checks completed"; fi
49+
50+
release-check: quality test
3951
python -m build
4052
python -m twine check dist/*
4153

4254
demo:
43-
python scripts/run_evolution.py \
55+
rewardharness evolve \
4456
--config configs/default.yaml \
4557
--library-dir examples/seed_library \
4658
--results-dir results/demo/ \
4759
--max-iters 1
4860

4961
evolve:
50-
python scripts/run_evolution.py \
62+
rewardharness evolve \
5163
--config configs/default.yaml \
5264
--results-dir results/my_run/ \
5365
--max-iters 200
5466

5567
benchmark:
56-
python scripts/run_benchmark.py \
68+
rewardharness benchmark \
5769
--config configs/default.yaml
58-
# Defaults to the paper-evolved library shipped at src/library/ and reports
70+
# Defaults to the paper-evolved library shipped as package resources and reports
5971
# K=2/3/4 accuracy on EditReward-Bench. The paper's headline 45.7% / 47.4%
6072
# average is mean(K=2, K=3, K=4, GenAI-Bench) — for the GenAI-Bench column
6173
# you need a separate eval pass (see OUTPUTS.md §"After make benchmark").
6274
# To benchmark a different library — e.g. one you evolved yourself or the
63-
# small examples/seed_library/ — call run_benchmark.py directly with
75+
# small examples/seed_library/ — call the CLI with
6476
# --library-dir <path>.
6577

6678
reproduce:

0 commit comments

Comments
 (0)