Skip to content

Commit decb693

Browse files
authored
Enhance Copilot instructions with validated build and configuration details (#158)
1 parent 50193fd commit decb693

2 files changed

Lines changed: 64 additions & 9 deletions

File tree

.github/copilot-instructions.md

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ TreeTools contains core functionality for tree and split manipulation, designed
9494
R -e "devtools::build_vignettes(install = FALSE)"
9595
```
9696

97+
### Key Dependencies
98+
**Critical**: TreeDist requires these packages to build successfully:
99+
- `ape` (>= 5.0) - Phylogenetic analysis package
100+
- `Rcpp` (>= 1.0.8) - C++ integration (must install before TreeTools)
101+
- `TreeTools` (>= 1.16) - Core tree manipulation (large dependency)
102+
- `Rdpack` (>= 0.7) - Bibliography and citation support
103+
- `shinyjs` - Interactive web applications
104+
- `colorspace` - Color space manipulation
105+
97106
## Validation
98107

99108
**CRITICAL: Always run the full test suite before proposing changes**
@@ -112,10 +121,34 @@ TreeTools contains core functionality for tree and split manipulation, designed
112121
```bash
113122
R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < memcheck/tests.R
114123
```
124+
**Note**: Memory check scripts available in `memcheck/` directory:
125+
- `memcheck/tests.R` - Run test suite with valgrind
126+
- `memcheck/all.R` - Run tests, examples, and build vignettes with memory checking
115127

116128
## Validation Scenarios
117129
After making code changes, validate functionality by testing core phylogenetic tree operations:
118130

131+
### Essential Pre-commit Validation Steps
132+
1. **Install core dependencies first**:
133+
```bash
134+
sudo R -e "install.packages(c('ape', 'colorspace', 'Rdpack', 'shinyjs', 'TreeTools'), repos='https://cran.r-project.org/', dependencies=TRUE)"
135+
```
136+
137+
2. **Basic build test** (quick validation):
138+
```bash
139+
R CMD build . --no-build-vignettes
140+
```
141+
142+
3. **Run linting** (expects GitHub Actions format):
143+
```bash
144+
R -e "lintr::lint_dir('.')"
145+
```
146+
147+
4. **Load package for testing**:
148+
```bash
149+
R -e "devtools::load_all()"
150+
```
151+
119152

120153
## Time Expectations & Critical Warnings
121154
- **R startup**: ~0.1 seconds
@@ -130,9 +163,9 @@ After making code changes, validate functionality by testing core phylogenetic t
130163

131164
## Repository Structure
132165
### Key Directories
133-
- `R/` - R source code (59 R files with 500+ exported functions)
134-
- `src/` - C++ source code requiring compilation (17 C++ files, SystemRequirements: C++17)
135-
- `tests/testthat/` - Test suite (61+ test files)
166+
- `R/` - R source code (31 R files with 500+ exported functions)
167+
- `src/` - C++ source code requiring compilation (14 C++ files, SystemRequirements: C++17)
168+
- `tests/testthat/` - Test suite (30+ test files)
136169
- `benchmark/` - Performance benchmarking (10+ benchmark files)
137170
- `man/` - Generated documentation (do not edit manually)
138171
- `vignettes/` - Package tutorials and documentation
@@ -142,9 +175,10 @@ After making code changes, validate functionality by testing core phylogenetic t
142175
### Important Files
143176
- `DESCRIPTION` - Package metadata, dependencies, and system requirements
144177
- `NAMESPACE` - Generated by roxygen2 (do not edit manually)
145-
- `.lintr` - Code style configuration (follows Google R style guide)
146178
- `NEWS.md` - Version history (update for user-facing changes)
147179
- `tests/testthat.R` - Test runner entry point
180+
- `inst/_pkgdown.yml` - template for online documentation.
181+
(Check that new functions are registered here, ideally using `@family`)
148182

149183
## Common Tasks
150184
### After Making Changes
@@ -179,9 +213,27 @@ After making code changes, validate functionality by testing core phylogenetic t
179213
- Missing or inadequate documentation
180214
- Missing test coverage for new code
181215

216+
### CI/CD Workflows Available
217+
- **R-CMD-check.yml**: Comprehensive checks on Windows, macOS, Ubuntu across R versions
218+
- **benchmark.yml**: Performance regression testing triggered on PRs
219+
- **memcheck.yml**: Memory checking with valgrind (runs `tests`, `examples`, `vignettes`)
220+
- **ASan.yml**: Address sanitizer checks
221+
- **pkgdown.yml**: Documentation site generation.
222+
- **revdepcheck.yml**: Downstream dependency validation
223+
182224
## Troubleshooting
183-
- If package won't build: check that all system dependencies are installed
184-
- If tests fail after C++ changes: rebuild package completely
185-
- If documentation is missing: run `devtools::document()`
186-
- If benchmarks fail: performance regressions may need investigation
187-
- Memory issues: use valgrind checking for C++ code validation
225+
### Common Build Issues
226+
- **Missing dependencies**: Install system packages first: `sudo apt install -y libcurl4-openssl-dev libssl-dev libxml2-dev libfontconfig1-dev libharfbuzz-dev libfribidi-dev`
227+
- **Rdpack warnings**: These are normal when `Rdpack` isn't installed but don't prevent building
228+
- **Package won't build**: Install core dependencies: `ape`, `colorspace`, `Rdpack`, `shinyjs`, `TreeTools`
229+
- **TreeTools installation fails**: This is a large dependency - allow 10+ minutes for compilation
230+
- **Tests fail after C++ changes**: rebuild package completely with `R CMD build .`
231+
- **Documentation warnings**: Run `devtools::document()` to regenerate documentation
232+
- **Benchmarks fail**: Performance regressions may need investigation
233+
- **Memory issues**: Use valgrind checking for C++ code validation
234+
235+
### System Requirements Validation
236+
- R version 4.0+ required (tested with R 4.3.3)
237+
- C++17 compiler support required
238+
- Minimum 2GB RAM recommended for building with dependencies
239+
- Allow 60+ minutes for full dependency installation from scratch

.lintr

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
linters: linters_with_defaults(
2+
object_name_linter(styles = c("CamelCase", "camelCase", "snake_case", "dotted.case"))
3+
)

0 commit comments

Comments
 (0)