Skip to content

Commit 21f85c9

Browse files
committed
Merge branch 'v6.3.4-dev' of github.com:datashield/dsBase into v6.3.4-dev
2 parents 82b254b + e3ff123 commit 21f85c9

8 files changed

Lines changed: 474 additions & 24 deletions

File tree

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
################################################################################
2+
# DataSHIELD GHA test suite - dsBase
3+
# Adapted from `azure-pipelines.yml` by Roberto Villegas-Diaz
4+
#
5+
# Inside the root directory $(Pipeline.Workspace) will be a file tree like:
6+
# /dsBase <- Checked out version of datashield/dsBase
7+
# /dsBase/logs <- Where results of tests and logs are collated
8+
# /testStatus <- Checked out version of datashield/testStatus
9+
#
10+
# As of Jul 2025 this takes ~ 9 mins to run.
11+
################################################################################
12+
name: dsBase tests' suite
13+
14+
on:
15+
push:
16+
branches: [master, v6.3.4-dev]
17+
schedule:
18+
- cron: '0 0 * * 0' # Weekly
19+
- cron: '0 1 * * *' # Nightly
20+
21+
jobs:
22+
dsBase_test_suite:
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 120
25+
permissions:
26+
contents: write
27+
28+
# These should all be constant, except TEST_FILTER. This can be used to test
29+
# subsets of test files in the testthat directory. Options are like:
30+
# '*' <- Run all tests.
31+
# 'asNumericDS*' <- Run all asNumericDS tests, i.e. all the arg, etc. tests.
32+
# '*_smk_*' <- Run all the smoke tests for all functions.
33+
env:
34+
TEST_FILTER: '*'
35+
_r_check_system_clock_: 0
36+
WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}
37+
PROJECT_NAME: dsBase
38+
BRANCH_NAME: ${{ github.ref_name }}
39+
REPO_OWNER: ${{ github.repository_owner }}
40+
R_KEEP_PKG_SOURCE: yes
41+
42+
steps:
43+
- name: Checkout dsBase
44+
uses: actions/checkout@v4
45+
with:
46+
path: dsBase
47+
48+
- name: Checkout testStatus
49+
uses: actions/checkout@v4
50+
with:
51+
repository: ${{ env.REPO_OWNER }}/testStatus
52+
token: ${{ secrets.GH_TOKEN }}
53+
ref: master
54+
path: testStatus
55+
56+
- uses: r-lib/actions/setup-pandoc@v2
57+
58+
- uses: r-lib/actions/setup-r@v2
59+
with:
60+
r-version: release
61+
http-user-agent: release
62+
use-public-rspm: true
63+
64+
- uses: r-lib/actions/setup-r-dependencies@v2
65+
with:
66+
extra-packages: |
67+
any::rcmdcheck
68+
cran::devtools
69+
cran::git2r
70+
cran::RCurl
71+
cran::readr
72+
cran::magrittr
73+
cran::xml2
74+
cran::purrr
75+
cran::dplyr
76+
cran::stringr
77+
cran::tidyr
78+
cran::quarto
79+
cran::knitr
80+
cran::kableExtra
81+
cran::rmarkdown
82+
cran::downlit
83+
needs: check
84+
85+
- name: Check man files up-to-date
86+
run: |
87+
orig_sum=$(find man -type f | sort -u | xargs cat | md5sum)
88+
R -e "devtools::document()"
89+
new_sum=$(find man -type f | sort -u | xargs cat | md5sum)
90+
if [ "$orig_sum" != "$new_sum" ]; then
91+
echo "Your committed manual files (man/*.Rd) are out of sync with the R files. Run devtools::document() locally then commit."
92+
exit 1
93+
else
94+
echo "Documentation up-to-date."
95+
fi
96+
working-directory: dsBase
97+
continue-on-error: true
98+
99+
- name: Run devtools::check
100+
run: |
101+
R -q -e "library('devtools'); devtools::check(args = c('--no-tests', '--no-examples'))" | tee ../check.Rout
102+
grep -q "^0 errors" ../check.Rout && grep -q " 0 warnings" ../check.Rout && grep -q " 0 notes" ../check.Rout
103+
working-directory: dsBase
104+
continue-on-error: true
105+
106+
- name: Run tests with coverage & JUnit report
107+
run: |
108+
mkdir -p logs
109+
R -q -e "devtools::reload();"
110+
R -q -e '
111+
write.csv(
112+
covr::coverage_to_list(
113+
covr::package_coverage(
114+
type = c("none"),
115+
code = c('"'"'
116+
output_file <- file("test_console_output.txt");
117+
sink(output_file);
118+
sink(output_file, type = "message");
119+
junit_rep <- testthat::JunitReporter$new(file = file.path(getwd(), "test_results.xml"));
120+
progress_rep <- testthat::ProgressReporter$new(max_failures = 999999);
121+
multi_rep <- testthat::MultiReporter$new(reporters = list(progress_rep, junit_rep));
122+
testthat::test_package("${{ env.PROJECT_NAME }}", filter = "${{ env.TEST_FILTER }}", reporter = multi_rep, stop_on_failure = FALSE)'"'"'
123+
)
124+
)
125+
),
126+
"coveragelist.csv"
127+
)'
128+
129+
mv coveragelist.csv logs/
130+
mv test_* logs/
131+
grep -q " FAIL 0 " logs/test_console_output.txt
132+
working-directory: dsBase
133+
134+
- name: Check for JUnit errors
135+
run: |
136+
issue_count=$(sed 's/failures="0" errors="0"//' test_results.xml | grep -c errors= || true)
137+
echo "Number of testsuites with issues: $issue_count"
138+
sed 's/failures="0" errors="0"//' test_results.xml | grep errors= > issues.log || true
139+
cat issues.log || true
140+
exit $issue_count
141+
working-directory: dsBase/logs
142+
143+
- name: Write versions to file
144+
run: |
145+
echo "branch:${{ env.BRANCH_NAME }}" > ${{ env.WORKFLOW_ID }}.txt
146+
echo "os:$(lsb_release -ds)" >> ${{ env.WORKFLOW_ID }}.txt
147+
echo "R:$(R --version | head -n1)" >> ${{ env.WORKFLOW_ID }}.txt
148+
working-directory: dsBase/logs
149+
150+
- name: Parse results from testthat and covr
151+
run: |
152+
Rscript --verbose --vanilla ../testStatus/source/parse_test_report.R logs/
153+
working-directory: dsBase
154+
155+
- name: Commit results to testStatus
156+
# if: github.repository == 'villegar/dsBase' && github.event_name != 'pull_request'
157+
run: |
158+
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
159+
git config --global user.name "$GITHUB_ACTOR"
160+
cd testStatus
161+
git checkout master
162+
git pull
163+
164+
mkdir -p logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
165+
mkdir -p docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
166+
mkdir -p docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/latest/
167+
# clear the latest directory
168+
rm -rf docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/latest/*
169+
170+
# Copy logs to new logs directory location
171+
cp -rv ../dsBase/logs/* logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
172+
cp -rv ../dsBase/logs/${{ env.WORKFLOW_ID }}.txt logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
173+
174+
# Create symbolic links
175+
ln -sf ${{ env.WORKFLOW_ID }}/ logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/.LATEST
176+
# ln -sf docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/ docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/latest
177+
178+
R -e 'input_dir <- file.path("../logs", Sys.getenv("PROJECT_NAME"), Sys.getenv("BRANCH_NAME"), Sys.getenv("WORKFLOW_ID")); quarto::quarto_render("source/test_report.qmd", execute_params = list(input_dir = input_dir))'
179+
mv source/test_report.html docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/index.html
180+
cp -r docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/* docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/latest
181+
182+
git add .
183+
git commit -m "Auto test for ${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }} @ ${{ env.WORKFLOW_ID }}"
184+
git push
185+
186+
env:
187+
PROJECT_NAME: ${{ env.PROJECT_NAME }}
188+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
189+
WORKFLOW_ID: ${{ env.WORKFLOW_ID }}
190+
191+
- name: Dump environment info
192+
run: |
193+
echo -e "\n#############################"
194+
echo -e "ls /: ######################"
195+
ls -al .
196+
echo -e "\n#############################"
197+
echo -e "lscpu: ######################"
198+
lscpu
199+
echo -e "\n#############################"
200+
echo -e "memory: #####################"
201+
free -m
202+
echo -e "\n#############################"
203+
echo -e "env: ########################"
204+
env
205+
echo -e "\n#############################"
206+
echo -e "R sessionInfo(): ############"
207+
R -e 'sessionInfo()'
208+
sudo apt install tree -y
209+
tree .
210+

.github/workflows/pkgdown.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
14+
15+
jobs:
16+
pkgdown:
17+
runs-on: ubuntu-latest
18+
# Only restrict concurrency for non-PR jobs
19+
concurrency:
20+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: r-lib/actions/setup-pandoc@v2
29+
30+
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: any::pkgdown, local::.
37+
needs: website
38+
39+
- name: Build site
40+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41+
shell: Rscript {0}
42+
43+
- name: Deploy to GitHub pages 🚀
44+
if: github.event_name != 'pull_request'
45+
uses: JamesIves/github-pages-deploy-action@v4.5.0
46+
with:
47+
clean: false
48+
branch: gh-pages
49+
folder: docs
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
11+
12+
jobs:
13+
test-coverage:
14+
runs-on: ubuntu-latest
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: r-lib/actions/setup-r@v2
22+
with:
23+
use-public-rspm: true
24+
25+
- uses: r-lib/actions/setup-r-dependencies@v2
26+
with:
27+
extra-packages: any::covr, any::xml2
28+
needs: coverage
29+
30+
- name: Test coverage
31+
run: |
32+
cov <- covr::package_coverage(
33+
quiet = FALSE,
34+
clean = FALSE,
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
36+
)
37+
print(cov)
38+
covr::to_cobertura(cov)
39+
shell: Rscript {0}
40+
41+
- uses: codecov/codecov-action@v5
42+
with:
43+
# Fail if error if not on PR, or if on PR and token is given
44+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
45+
files: ./cobertura.xml
46+
plugins: noop
47+
disable_search: true
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
50+
- name: Show testthat output
51+
if: always()
52+
run: |
53+
## --------------------------------------------------------------------
54+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
55+
shell: bash
56+
57+
- name: Upload test results
58+
if: failure()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: coverage-test-failures
62+
path: ${{ runner.temp }}/package

README.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,36 @@
1-
dsBase
2-
======
1+
## dsBase: 'DataSHIELD' Server Side Base Functions
32

4-
DataSHIELD server side base R library.
3+
[![License](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
4+
[![](https://www.r-pkg.org/badges/version/dsBase?color=black)](https://cran.r-project.org/package=dsBase)
5+
[![R build
6+
status](https://github.com/datashield/dsBase/workflows/R-CMD-check/badge.svg)](https://github.com/datashield/dsBase/actions)
7+
[![Codecov test coverage](https://codecov.io/gh/datashield/dsBase/graph/badge.svg)](https://app.codecov.io/gh/datashield/dsBase)
58

6-
[![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html)
9+
## Installation
710

8-
About
9-
=====
11+
You can install the released version of dsBase from
12+
[CRAN](https://cran.r-project.org/package=dsBase) with:
13+
14+
``` r
15+
install.packages("dsBase")
16+
```
17+
18+
And the development version from
19+
[GitHub](https://github.com/datashield/dsBase/) with:
20+
<!-- You can install the development version from [GitHub](https://github.com/) with: -->
21+
22+
``` r
23+
install.packages("remotes")
24+
remotes::install_github("datashield/dsBase", "<BRANCH>")
25+
26+
# Install v6.4.0 with the following
27+
remotes::install_github("datashield/dsBase", "v6.4.0-dev")
28+
```
29+
30+
For a full list of development branches, checkout https://github.com/datashield/dsBase/branches
31+
32+
33+
## About
1034

1135
DataSHIELD is a software package which allows you to do non-disclosive federated analysis on sensitive data. Our website (https://www.datashield.org) has in depth descriptions of what it is, how it works and how to install it. A key point to highlight is that DataSHIELD has a client-server infrastructure, so the dsBase package (https://github.com/datashield/dsBase) needs to be used in conjuction with the dsBaseClient package (https://github.com/datashield/dsBaseClient) - trying to use one without the other makes no sense.
1236

@@ -18,3 +42,30 @@ Detailed instructions on how to install DataSHIELD are at https://wiki.datashiel
1842
| obiba CRAN | Where you probably should install DataSHIELD from. |
1943
| releases | Stable releases. |
2044
| master branch | Mostly in sync with the latest release, changes rarely. |
45+
46+
## References
47+
48+
[1] Burton P, Wilson R, Butters O, Ryser-Welch P, Westerberg A, Abarrategui L, Villegas-Diaz R,
49+
Avraam D, Marcon Y, Bishop T, Gaye A, Escribà Montagut X, Wheater S (2025). _dsBase: 'DataSHIELD' Server Side Base Functions_. R
50+
package version 6.3.3. <https://doi.org/10.32614/CRAN.package.dsBase>.
51+
52+
[2] Gaye A, Marcon Y, Isaeva J, LaFlamme P, Turner A, Jones E, Minion J, Boyd A, Newby C, Nuotio
53+
M, Wilson R, Butters O, Murtagh B, Demir I, Doiron D, Giepmans L, Wallace S, Budin-Ljøsne I,
54+
Oliver Schmidt C, Boffetta P, Boniol M, Bota M, Carter K, deKlerk N, Dibben C, Francis R,
55+
Hiekkalinna T, Hveem K, Kvaløy K, Millar S, Perry I, Peters A, Phillips C, Popham F, Raab G,
56+
Reischl E, Sheehan N, Waldenberger M, Perola M, van den Heuvel E, Macleod J, Knoppers B,
57+
Stolk R, Fortier I, Harris J, Woffenbuttel B, Murtagh M, Ferretti V, Burton P (2014).
58+
“DataSHIELD: taking the analysis to the data, not the data to the analysis.” _International
59+
Journal of Epidemiology_, *43*(6), 1929-1944. <https://doi.org/10.1093/ije/dyu188>.
60+
61+
[3] Wilson R, W. Butters O, Avraam D, Baker J, Tedds J, Turner A, Murtagh M, R. Burton P (2017).
62+
“DataSHIELD – New Directions and Dimensions.” _Data Science Journal_, *16*(21), 1-21.
63+
<https://doi.org/10.5334/dsj-2017-021>.
64+
65+
[4] Avraam D, Wilson R, Aguirre Chan N, Banerjee S, Bishop T, Butters O, Cadman T, Cederkvist L,
66+
Duijts L, Escribà Montagut X, Garner H, Gonçalves G, González J, Haakma S, Hartlev M,
67+
Hasenauer J, Huth M, Hyde E, Jaddoe V, Marcon Y, Mayrhofer M, Molnar-Gabor F, Morgan A,
68+
Murtagh M, Nestor M, Nybo Andersen A, Parker S, Pinot de Moira A, Schwarz F,
69+
Strandberg-Larsen K, Morris AvSwertz, Welten M, Wheater S, Burton P (2024). “DataSHIELD:
70+
mitigating disclosure risk in a multi-site federated analysis platform.” _Bioinformatics
71+
Advances_, *5*(1), 1-21. <https://doi.org/10.1093/bioadv/vbaf046>.

0 commit comments

Comments
 (0)