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
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Continuous integration

on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main

permissions:
contents: read

concurrency:
group: ci-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test-pr-not-slow:
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
Comment thread
jphaupt marked this conversation as resolved.
cache-dependency-path: pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]

- name: Run non-slow test suite (PR)
run: pytest -m "not slow" -q --durations=10

test-main-full:
if: github.event_name == 'push'
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: pip

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]

- name: Run full test suite (push to main)
run: pytest -q --durations=10
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "A simple CIPSI (Configuration Interaction with Perturbative Selec
readme = "README.md"
license = {text = "MIT"}
authors = [
{name = "J. Philip Haupt"}
{name = "Jacobus Philip Haupt"}
]
Comment thread
jphaupt marked this conversation as resolved.
requires-python = ">=3.9"
dependencies = [
Expand All @@ -34,6 +34,9 @@ testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
markers = [
"slow: computationally expensive tests excluded from default CI runs",
]

[tool.black]
line-length = 100
Expand Down
16 changes: 13 additions & 3 deletions tests/test_fci_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@
# ============================================================================

# List of systems to test. Comment out lines to skip specific systems.
TEST_SYSTEMS = [
FAST_SYSTEMS = [
"H2/sto-3g",
"HeH+/sto-3g",
"H3+/3-21g",
"Li/sto-3g",
"LiH/6-31gstar",
]

# systems whose tests take a little longer than desired (> 5 sec on my laptop),
# to be excluded from CI/CD by default
SLOW_SYSTEMS = ["LiH/6-31gstar"]

TEST_SYSTEMS = FAST_SYSTEMS + SLOW_SYSTEMS

SYSTEM_DATA_PARAMS = [
pytest.param(system, marks=pytest.mark.slow) if system in SLOW_SYSTEMS else system
for system in TEST_SYSTEMS
]

# Systems small enough (norb=2, 4 FCI dets) for full CIPSI convergence tests.
Expand Down Expand Up @@ -108,7 +118,7 @@ def assets_dir():
return test_dir.parent / "assets"


@pytest.fixture(scope="module", params=TEST_SYSTEMS)
@pytest.fixture(scope="module", params=SYSTEM_DATA_PARAMS)
def system_data(request, assets_dir):
"""
Load and cache all data for a test system.
Expand Down
Loading