-
Notifications
You must be signed in to change notification settings - Fork 10
PROTEUS ecosystem-wide testing infrastructure & CI/CD enhancements #579
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
Closed
Closed
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
8dcac9f
Initial commit with some start on test directory restructuring
timlichtenberg a45c633
Refactor CI workflow for improved testing and compatibility across Pyβ¦
timlichtenberg 8bd6722
Update CI workflow to trigger on pushes/PRs to dev branch for improveβ¦
timlichtenberg 804acb7
Add test branch to CI workflow triggers for testing
timlichtenberg 1081f77
Trigger CI after MORS and aragog NumPy 2.0 fixes
timlichtenberg 86339ef
Install local MORS and aragog in CI to test NumPy 2.0 fixes
timlichtenberg c048960
Clone MORS and aragog repos explicitly in CI
timlichtenberg 48be087
Test Aragog fix branch tl/deprecation_fixes_line138 in CI
timlichtenberg 7782f14
Trigger CI: test aragog output.py fix
timlichtenberg 9a78f58
Trigger CI: test comprehensive aragog NumPy 2.0 fixes
timlichtenberg a1f5441
Fix NumPy 2.0 compatibility in PROTEUS: convert numpy scalar to floatβ¦
timlichtenberg 25f932e
Fix NumPy 2.0 logging conversions in interior wrapper
timlichtenberg 52de500
CI: temporarily run only Ubuntu Python 3.13 (commented macOS/3.12)
timlichtenberg 41fafbd
Fix NumPy 2.0: convert array outputs to scalars in interior wrapper
timlichtenberg 1b0544f
Fix coverage: align pytest --cov path with package name
timlichtenberg 71ba172
fix: Remove pytest-cov options conflicting with coverage run command
timlichtenberg d016472
ci: Update aragog clone to use main branch
timlichtenberg a89f94b
perf: Add caching for SOCRATES binaries and AGNI Julia depot
timlichtenberg ee81d7c
fix: Correct cache restore/save order for SOCRATES and AGNI
timlichtenberg 6aa423f
test: Trigger CI to test cache restoration
timlichtenberg 7e3aeb8
fix: Implement hash-based cache invalidation for SOCRATES and AGNI
timlichtenberg 9597e32
feat: Conditional free disk space step (Option A optimization)
timlichtenberg cfadff8
fix: Clone SOCRATES and AGNI before cache restore for hash-based keys
timlichtenberg 315c6c2
docs: Update testing infrastructure with ecosystem deployment guide aβ¦
timlichtenberg ac0d3ce
docs: Add CALLIOPE Phase 2 improvements to testing infrastructure guide
timlichtenberg 491a0c3
feat: Add coverage ratcheting mechanism and rename workflow/docs files
timlichtenberg 5d11f05
ci: Run full matrix nightly at 2am
timlichtenberg 47edb82
ci: fix workflow run commands
timlichtenberg 431e708
ci: gate macOS job to schedule
timlichtenberg c8fc8c9
feat: Add PROTEUS Copilot guidelines for testing standards, code qualβ¦
timlichtenberg 67f6703
refactor: Update Copilot guidelines to improve test infrastructure orβ¦
timlichtenberg 4eef3eb
docs: Enhance PROTEUS Ecosystem Copilot Guidelines with installation β¦
timlichtenberg 3137ce9
Changed to C lang
timlichtenberg 8e9b013
refactor: Update coverage requirements and testing documentation for β¦
timlichtenberg c0b97a2
docs: Update coverage recommendations in test quality gate and infrasβ¦
timlichtenberg a22b84f
change directory for copilot-instructions.md
timlichtenberg 0f571e9
ci: finalize test infra fixes
timlichtenberg 3a1f2d1
ci: Implement second round of Copilot review fixes
timlichtenberg 8155e59
ci: Implement third round of Copilot review fixes (15 issues)
timlichtenberg 0e0fdfa
ci: Fix long line lengths in ci_tests.yml cache keys (lines 152, 397)
timlichtenberg dbfb9ae
ci: Fix long AGNI cache key lines (lines 171, 236, 429, 493)
timlichtenberg 1dae6ab
fix: Implement all Copilot review feedback (Priority 1, 2, 3)
timlichtenberg 7c66722
docs: Update tools/README.md with comprehensive descriptions of all aβ¦
timlichtenberg 6ff875e
docs: Update testing documentation for accurate pytest-cov vs coveragβ¦
timlichtenberg 922eb67
ci: build socrates and init agni
timlichtenberg c7d728a
ci: generate socrates julia wrappers
timlichtenberg ac029f3
Switch CI to Python 3.12 and developer install pathway
timlichtenberg b459136
ci: Add test_infrastructure.md compliance enhancements
timlichtenberg 1c6ad5b
fix: Resolve critical workflow issues for CI test execution
timlichtenberg 8f797d8
fix: Remove Unicode emoji from validation script for CI compatibility
timlichtenberg ae85486
CI: fast-fail test structure
timlichtenberg 9a3df89
Fix: Skip integration tests in validation (orphaned test dir)
timlichtenberg e65d9d2
Fix: Use arithmetic expansion instead of (( )) for set -e compatibility
timlichtenberg 8b59e65
Fix: Address Copilot review comments - YAML cache key formatting & TOβ¦
timlichtenberg ca3081b
Update docs/test_infrastructure.md
timlichtenberg 9885aef
Update src/proteus/cli.py
timlichtenberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| name: Test Coverage Improvement | ||
| about: Track test coverage improvements for specific folders | ||
| title: 'Improve test coverage for [FOLDER]' | ||
| labels: 'testing, enhancement' | ||
| assignees: '' | ||
| --- | ||
|
|
||
| ## Folder | ||
| <!-- e.g., proteus.config, proteus.interior, etc. --> | ||
|
|
||
| ## Current Coverage | ||
| <!-- Run: pytest --cov=src/proteus/[folder] --cov-report=term-missing --> | ||
| ``` | ||
| Current: X% | ||
| Target: Y% | ||
| ``` | ||
|
|
||
| ## Uncovered Lines | ||
| <!-- From coverage report --show-missing --> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be useful to have the workflow run this command automatically. |
||
| ``` | ||
| file.py: 10, 25-30, 45 | ||
| ``` | ||
|
|
||
| ## Test Strategy | ||
|
|
||
| ### Unit Tests Needed | ||
| - [ ] Function: `function_name()` (lines X-Y) | ||
| - [ ] Function: `another_function()` (lines X-Y) | ||
| - [ ] Class: `ClassName` (lines X-Y) | ||
|
|
||
| ### Integration Tests Needed | ||
| - [ ] Integration point: description | ||
| - [ ] Workflow: description | ||
|
|
||
| ### Edge Cases | ||
| - [ ] Error handling for X | ||
| - [ ] Boundary conditions for Y | ||
| - [ ] Invalid input handling | ||
|
|
||
| ## Implementation Plan | ||
|
|
||
| 1. [ ] Create test file: `tests/[folder]/test_[feature].py` | ||
| 2. [ ] Add fixtures in `conftest.py` (if needed) | ||
| 3. [ ] Write unit tests | ||
| 4. [ ] Write integration tests | ||
| 5. [ ] Run locally: `pytest tests/[folder]/` | ||
| 6. [ ] Verify coverage: `pytest --cov=src/proteus/[folder] --cov-report=html` | ||
| 7. [ ] Update documentation | ||
|
|
||
| ## Success Criteria | ||
| - [ ] Coverage increases to target % | ||
| - [ ] All new tests pass | ||
| - [ ] No regressions in existing tests | ||
| - [ ] CI pipeline passes | ||
|
|
||
| ## Notes | ||
| <!-- Additional context, challenges, or considerations --> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # PROTEUS Ecosystem Copilot Guidelines | ||
|
|
||
| You are an expert Scientific Software Engineer working on the PROTEUS ecosystem. | ||
|
|
||
| ## Ecosystem Structure | ||
|
|
||
| PROTEUS is a coupled atmosphere-interior framework with a modular architecture: | ||
|
|
||
| - **[PROTEUS](https://github.com/FormingWorlds/PROTEUS)** (main repository): Core coupling framework and orchestration | ||
| - **[AGNI](https://github.com/nichollsh/AGNI)**: Radiative-convective atmospheric energy module (Julia) | ||
| - **[SOCRATES](https://github.com/nichollsh/SOCRATES)**: Spectral radiative transfer code (Fortran) | ||
| - **[CALLIOPE](https://github.com/FormingWorlds/CALLIOPE)**: Volatile in-/outgassing and thermodynamics module (Python) | ||
| - **[JANUS](https://github.com/FormingWorlds/JANUS)**: 1D convective atmosphere module (Python) | ||
| - **[MORS](https://github.com/FormingWorlds/MORS)**: Stellar evolution module (Python) | ||
| - **[ARAGOG](https://github.com/FormingWorlds/aragog)**: Interior thermal evolution module based on T-P formalism (Python) | ||
| - **[SPIDER](https://github.com/djbower/spider)**: Interior thermal evolution module based on T-S formalism (C) | ||
| - **[VULCAN](https://github.com/FormingWorlds/VULCAN)**: Atmospheric chemistry module (Python) | ||
| - **[ZEPHYRUS](https://github.com/FormingWorlds/ZEPHYRUS)**: Atmospheric escape module (Python) | ||
| - **[Love.jl](https://github.com/FormingWorlds/Love.jl)**: Tidal evolution module (Julia) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to Obliqua when appropriate. |
||
|
|
||
| **Important:** Each module is maintained in its own GitHub repository but is typically cloned/installed within the PROTEUS directory structure for integrated development. When working on any module in the ecosystem, apply these guidelines consistently. | ||
|
|
||
| ## Scope of These Guidelines | ||
|
|
||
| **These guidelines apply to ALL Python modules in the PROTEUS ecosystem.** Whether you are working in: | ||
| - The main PROTEUS repository | ||
| - A standalone module (CALLIOPE, JANUS, MORS, etc.) | ||
| - Tests for any ecosystem component | ||
|
|
||
| Follow the same standards for testing, coverage, code quality, and infrastructure. | ||
|
|
||
| ## Installation & Dependencies | ||
|
|
||
| For installation instructions and dependency management across the ecosystem: | ||
| - **Main installation guide:** `docs/installation.md` - Standard user and developer installation procedures | ||
| - **Local machine setup:** `docs/local_machine_guide.md` - Platform-specific setup (macOS, Linux, Windows) | ||
| - **Cluster setup:** `docs/kapteyn_cluster_guide.md` - HPC cluster configuration (see also `habrok_cluster_guide.md`, `snellius_cluster_guide.md`) | ||
|
|
||
| When helping with installation or dependency issues, always reference these guides first. The `proteus install-all` command handles most submodule installations automatically. However, whenever possible, prefer the developer installation steps outlined in the installation guide for editable installs. | ||
|
|
||
| ## 1. Test Infrastructure & Organization | ||
| - **Structure:** Tests MUST mirror the source code structure exactly. For every file in `src/<package>/`, create a corresponding `tests/<package>/test_<filename>.py`. | ||
| - **Example:** `src/proteus/config/_config.py` β `tests/config/test_config.py` | ||
| - **Discovery:** Use `pytest --collect-only` to verify test discovery before writing tests. | ||
| - **Tools:** Run `bash tools/validate_test_structure.sh` to check if tests mirror source structure. | ||
| - **Documentation:** See `docs/test_infrastructure.md` for full testing infrastructure details. | ||
|
|
||
| ## 2. Testing Standards (pytest) | ||
| - **Framework:** Use `pytest` exclusively in the `tests/` directory. | ||
| - **Coverage Tool:** Two equivalent approaches are supported: | ||
| - Local: `pytest --cov` (uses pytest-cov plugin, convenient) | ||
| - CI/Local: `coverage run -m pytest` (matches CI exactly, compatible with ratcheting) | ||
| - Choose based on preference; both work correctly. | ||
| - **Speed:** Unit tests must run in <100ms. Aggressively mock heavy simulations, I/O, and external APIs using `unittest.mock`. | ||
| - **Integration:** Mark slow tests (full simulation loops) with `@pytest.mark.slow`. | ||
| - **Markers:** Use pytest markers: `@pytest.mark.unit` for unit tests, `@pytest.mark.integration` for integration tests. | ||
| - **Floats:** NEVER use `==` for floats. Use `pytest.approx(val, rel=1e-5)` or `np.testing.assert_allclose`. | ||
| - **Physics:** Ensure inputs are physically valid (e.g., T > 0K) unless testing error handling. | ||
|
|
||
| ## 3. Coverage Requirements | ||
| - **Threshold:** Check `pyproject.toml` [tool.coverage.report] `fail_under` for current threshold. | ||
| - **Automatic Ratcheting:** Coverage threshold automatically increases on main branch via `tools/update_coverage_threshold.py` (never decreases). See CALLIOPE for reference implementation. | ||
| - **Reports:** Run `pytest --cov --cov-report=html` and inspect `htmlcov/index.html` for gaps. | ||
| - **Analysis:** Use `bash tools/coverage_analysis.sh` to identify low-coverage modules needing tests. | ||
| - **Quality Gate:** All PRs must pass the coverage threshold defined in CI (see `.github/workflows/proteus_test_quality_gate.yml`). | ||
|
|
||
| ## 4. Code Quality & Style | ||
| - **Linting:** Follow `ruff` standards. Line length < 92 chars, max indentation 3 levels. | ||
|
timlichtenberg marked this conversation as resolved.
timlichtenberg marked this conversation as resolved.
|
||
| - **Type Hints:** Use standard Python type hints. | ||
| - **Docstrings:** Include brief docstrings describing the physical scenario. | ||
|
|
||
| ## 5. Safety & Determinism | ||
| - **Randomness:** Explicitly set seeds (e.g., `np.random.seed(42)`) in tests. | ||
| - **Files:** Do not generate tests that produce large output files (unless explicitly instructed); use `tempfile` or mocks. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change these labels to match our existing ones.