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
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Tests, schema validation and dry-runs on every pull request and every push to main (#22).
# Nothing here touches the network: the suite and the dry-runs run from committed fixtures.
name: CI

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.12"]
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
# The default looks for requirements.txt; this repo has one file per module.
cache-dependency-path: requirements-*.txt

- name: Install every module's requirements
# The same glob scripts/setup_env.sh uses, so a module that adds a requirements file
# is picked up here too. jinja2 is listed explicitly until M6 has its own file (#76).
run: |
python -m pip install --upgrade pip
python -m pip install $(for f in requirements-*.txt; do echo "-r $f"; done) \
"jinja2>=3.1,<4" pytest ruff

- name: Lint (errors only)
# Syntax errors and undefined names, not style: a style rule nobody agreed to would
# fail every open PR on day one.
run: ruff check --select E9,F63,F7,F82 s2f tests

- name: Unit tests, including schema validation of the committed fixtures
run: python -m pytest -q

- name: Every module's --dry-run completes from fixtures
run: |
for module in m2_triage m3_fold m6_report full_report; do
echo "::group::$module --dry-run"
python -m "s2f.$module" --run "$RUNNER_TEMP/dry/$module" --dry-run
echo "::endgroup::"
done
4 changes: 2 additions & 2 deletions s2f/m6_report/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import argparse
import json
from datetime import UTC, datetime
from datetime import datetime, timezone
from pathlib import Path

from jinja2 import Environment, FileSystemLoader, StrictUndefined
Expand Down Expand Up @@ -76,7 +76,7 @@ def main(argv: list[str] | None = None) -> int:
"report",
{
"rendered_path": str(out_path),
"rendered_at": datetime.now(UTC).isoformat(timespec="seconds"),
"rendered_at": datetime.now(timezone.utc).isoformat(timespec="seconds"),
"counts": built.counts,
"sections": status,
},
Expand Down
4 changes: 2 additions & 2 deletions s2f/m6_report/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from __future__ import annotations

from dataclasses import dataclass, field
from datetime import UTC, datetime
from datetime import datetime, timezone
from typing import Any

#: Sections the report knows how to show, in the order `docs/06-m6-report.md` lays out.
Expand Down Expand Up @@ -140,7 +140,7 @@ def _protein_row(protein: dict[str, Any], structure: dict[str, Any] | None) -> d

def build(report: dict[str, Any], *, top: int = 25) -> ReportView:
"""Build the whole view. Missing sections become 'not run', never empty successes."""
view = ReportView(generated_at=datetime.now(UTC).isoformat(timespec="seconds"))
view = ReportView(generated_at=datetime.now(timezone.utc).isoformat(timespec="seconds"))

run = report.get("run") or {}
view.run_id = str(run.get("run_id") or "—")
Expand Down
Loading