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
46 changes: 46 additions & 0 deletions .github/workflows/tables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# .github/workflows/tables.yml
name: test-and-tables

on:
push:
branches: [main]
pull_request:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: pip install -r requirements.txt
- run: python -m pytest -q tests

tables:
needs: test
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- run: pip install -r requirements.txt
- run: python scripts/generate_tables.py
- name: Commit regenerated tables if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add tables
if git diff --cached --quiet; then
echo "Tables unchanged."
else
git commit -m "Regenerate tables [skip ci]"
git push
fi
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=2.0
scipy>=1.11
pandas>=2.0
numpy==2.4.4
scipy==1.17.1
pandas==3.0.2
pytest>=7
2 changes: 1 addition & 1 deletion scripts/generate_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def to_md(df: pd.DataFrame, pct_cols=None, decimals=2) -> str:


def save(name, df, pct_cols=None, note=""):
df.to_csv(os.path.join(OUT, name + ".csv"))
df.round(6).to_csv(os.path.join(OUT, name + ".csv")) # rounded to avoid float-noise diffs
with open(os.path.join(OUT, name + ".md"), "w") as f:
f.write(f"# {name}\n\n{note}\n\n" + to_md(df, pct_cols) + "\n")
print("wrote", name)
Expand Down
Loading