Skip to content

Commit 8743b2f

Browse files
author
Neobernad
committed
2 parents 5eb0878 + 3fe7a93 commit 8743b2f

22 files changed

Lines changed: 2604 additions & 95 deletions

.github/CI_WORKFLOW.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# GitHub Actions CI Workflow
2+
3+
This document describes the continuous integration (CI) workflow for the evaluomeR package.
4+
5+
## Overview
6+
7+
The `.github/workflows/test.yaml` workflow automatically runs your R package tests whenever code is pushed or a pull request is created. This ensures code quality and prevents regressions before merging to main branches.
8+
9+
## Workflow Triggers
10+
11+
The workflow runs on the following events:
12+
13+
- **Push**: Any push to `main`, `master`, or `develop` branches
14+
- **Pull Request**: Any pull request targeting `main`, `master`, or `develop` branches
15+
- **Manual**: Manually triggered via GitHub Actions UI (workflow_dispatch)
16+
17+
## Test Matrix
18+
19+
Tests run across multiple R versions to ensure compatibility:
20+
21+
- **R 4.3** - Latest stable release from that series
22+
- **Latest R** - Most current R version available
23+
24+
All testing occurs on **Ubuntu Latest** runner.
25+
26+
## Workflow Steps
27+
28+
### 1. Checkout
29+
Clones your repository code.
30+
31+
### 2. Set up R
32+
Installs the specified R version using the official r-lib setup action.
33+
34+
### 3. Install System Dependencies
35+
Installs required system libraries:
36+
- `libcurl4-openssl-dev` - For HTTP communication
37+
- `libssl-dev` - For SSL/TLS support
38+
- `libxml2-dev` - For XML parsing
39+
40+
### 4. Install R Dependencies
41+
Automatically installs all package dependencies declared in `DESCRIPTION`:
42+
- **Depends**: SummarizedExperiment, MultiAssayExperiment, dplyr, cluster, fpc, randomForest, flexmix, RSKC, sparcl
43+
- **Imports**: All packages listed in the Imports field
44+
- **Extra packages**: devtools (for package installation)
45+
46+
### 5. Install Package
47+
Builds and installs your package locally using `devtools::install_local()`.
48+
49+
### 6. Run Tests
50+
Executes all test scripts in the `tests/` directory matching the pattern `test*.R`:
51+
- testARI.R
52+
- testATSC.R
53+
- testATSC_GoldStandard.R
54+
- testATSC_parallel.R
55+
- testAll.R
56+
- testAlpha_parallel.R
57+
- testAnalysis.R
58+
- testCBI.R
59+
- testCH_index.R
60+
- testDataPreprocessing.R
61+
- testK_optimo_parallel.R
62+
- testL1_clustering.R
63+
- testMetricsRelevancy.R
64+
- testPCA.R
65+
- testQuality.R
66+
- testQuality_parallel.R
67+
- testStability.R
68+
- testStability_parallel.R
69+
70+
Each test is sourced in sequence, with detailed output showing which test is running. If any test fails, the workflow exits with status 1 and reports the error.
71+
72+
### 7. Upload Artifacts
73+
Test results and scripts are uploaded as workflow artifacts for 30 days, allowing you to review test output even after the workflow completes.
74+
75+
## Viewing Results
76+
77+
### On GitHub
78+
1. Navigate to your repository
79+
2. Click the **Actions** tab
80+
3. Click on the workflow run to see detailed output
81+
4. Expand any step to see its console output
82+
5. Download artifacts from the "Artifacts" section
83+
84+
### Badges
85+
You can add a status badge to your README:
86+
87+
```markdown
88+
[![R Package Tests](https://github.com/neobernad/evaluomeR/actions/workflows/test.yaml/badge.svg)](https://github.com/neobernad/evaluomeR/actions/workflows/test.yaml)
89+
```
90+
91+
## Troubleshooting
92+
93+
### Tests Fail in CI but Pass Locally
94+
- Ensure your local R version matches one of the CI versions (R 4.3 or latest)
95+
- Check for platform-specific issues (paths, environment variables)
96+
- Verify all dependencies are correctly listed in DESCRIPTION
97+
98+
### Missing Dependencies
99+
- Add missing packages to DESCRIPTION under either `Depends` or `Imports`
100+
- For system packages, add them to the "Install system dependencies" step
101+
- Re-run the workflow after updating DESCRIPTION
102+
103+
### Long Test Execution Times
104+
- Consider splitting large parallel tests into separate workflows if needed
105+
- Optimize test code to reduce runtime
106+
- Check if tests are downloading large data files
107+
108+
## Future Enhancements
109+
110+
Possible improvements to the CI workflow:
111+
112+
1. **Code Coverage**: Add code coverage reports using `covr` package
113+
2. **R CMD Check**: Add `R CMD check` for comprehensive package validation
114+
3. **Platform Matrix**: Extend to include macOS and Windows runners
115+
4. **Documentation Builds**: Generate and validate vignettes/documentation
116+
5. **Performance Benchmarks**: Track test execution times over time
117+
118+
## Related Files
119+
120+
- `.github/workflows/test.yaml` - The main workflow definition
121+
- `DESCRIPTION` - Package metadata and dependencies
122+
- `tests/` - Directory containing all test scripts

.github/workflows/pkgdown.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: pkgdown
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Pages
25+
uses: actions/configure-pages@v4
26+
27+
- name: Set up R
28+
uses: r-lib/actions/setup-r@v2
29+
30+
- name: Install system dependencies
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
34+
35+
- name: Install dependencies
36+
uses: r-lib/actions/setup-r-dependencies@v2
37+
with:
38+
extra-packages: |
39+
any::pak
40+
any::pkgdown
41+
42+
- name: Install package
43+
run: |
44+
pak::pak("local::.")
45+
shell: Rscript {0}
46+
47+
- name: Build site
48+
run: |
49+
pkgdown::clean_site(force = TRUE)
50+
pkgdown::build_site()
51+
shell: Rscript {0}
52+
53+
- name: Upload artifact
54+
uses: actions/upload-pages-artifact@v3
55+
with:
56+
path: ./docs
57+
58+
deploy:
59+
environment:
60+
name: github-pages
61+
url: ${{ steps.deployment.outputs.page_url }}
62+
runs-on: ubuntu-latest
63+
needs: build
64+
steps:
65+
- name: Deploy to GitHub Pages
66+
id: deployment
67+
uses: actions/deploy-pages@v4

.github/workflows/test.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: R Package Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master, develop ]
6+
pull_request:
7+
branches: [ main, master, develop ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest]
20+
r-version: ['4.3', 'latest']
21+
22+
env:
23+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
R_KEEP_PKG_SOURCE: yes
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- name: Set up R
30+
uses: r-lib/actions/setup-r@v2
31+
with:
32+
r-version: ${{ matrix.r-version }}
33+
34+
- name: Install system dependencies
35+
if: runner.os == 'Linux'
36+
run: |
37+
sudo apt-get update
38+
sudo apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
39+
40+
- name: Install R dependencies
41+
uses: r-lib/actions/setup-r-dependencies@v2
42+
with:
43+
extra-packages: |
44+
any::pak
45+
any::testthat
46+
47+
- name: Install package
48+
run: |
49+
pak::pak("local::.")
50+
shell: Rscript {0}
51+
52+
- name: Run tests
53+
run: |
54+
test_files <- list.files("tests", pattern = "^test.*\\.R$", full.names = TRUE)
55+
if (length(test_files) == 0) {
56+
cat("No test files found\n")
57+
quit(save = "no", status = 0)
58+
}
59+
60+
for (test_file in test_files) {
61+
cat("\n=====================================\n")
62+
cat("Running:", test_file, "\n")
63+
cat("=====================================\n")
64+
tryCatch(
65+
source(test_file),
66+
error = function(e) {
67+
cat("ERROR in", test_file, ":\n")
68+
print(e)
69+
quit(save = "no", status = 1)
70+
}
71+
)
72+
}
73+
cat("\nAll tests completed successfully!\n")
74+
shell: Rscript {0}
75+
76+
- name: Upload test results
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: test-results-${{ matrix.os }}-r${{ matrix.r-version }}
81+
path: tests/
82+
retention-days: 30

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ notebooks/local/.ipynb_checkpoints/
3333
.gitmodules
3434
.hgtags
3535
.project
36+
.RDataTmp
3637
.seed
3738
.settings
3839
.tm_properties

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Imports:
4545
FactoMineR (>= 2.11),
4646
factoextra (>= 1.0.7),
4747
nFactors (>= 2.4.1.1)
48-
Suggests: BiocStyle, knitr, rmarkdown, magrittr
48+
Suggests: BiocStyle, knitr, rmarkdown, magrittr, pkgdown
4949
VignetteBuilder: knitr
5050
RdMacros: Rdpack
5151
RoxygenNote: 7.3.2

R/internalClusterboot.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,9 @@ compare_with_gold_standard <- function(data, gold_standard, clustermethod, datat
602602
}
603603

604604
c1 <- clustermethod(data, ...)
605-
606-
randresult <- fossil::rand.index(gold_standard, c1$partition)
605+
606+
#randresult <- fossil::rand.index(gold_standard, c1$partition)
607+
randresult <- mclust::adjustedRandIndex(gold_standard, c1$partition)
607608

608609
#message("Gold standard")
609610
#message(gold_standard)

0 commit comments

Comments
 (0)