Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
f8e19f3
Added authors and orcids
OllyButters Jul 21, 2025
c17fa3a
Title: Site -> Side
OllyButters Jul 21, 2025
918477c
Skip these tests on Apple M1 architecture, unresolved issue
villegar Jul 21, 2025
f02e492
Merge pull request #400 from OllyButters/v6.3.3-dev
StuartWheater Jul 21, 2025
f2f1231
Update version
StuartWheater Jul 21, 2025
a1f1178
Add CRAN release badge, title, installation instructions and references
villegar Jul 21, 2025
5582620
Correct title and citation for main package
villegar Jul 21, 2025
c5088ce
Add new workflow based on old azure-pipelines.yml file
villegar Jul 21, 2025
1a24b75
Update token variable name
villegar Jul 21, 2025
74a120b
Replace test_package call by test_local
villegar Jul 22, 2025
408a736
Use r-lib custom actions to setup deployment environment and customis…
villegar Jul 22, 2025
06daac3
Install missing package to run checks and tests
villegar Jul 22, 2025
4ead1cf
Add missing environment variable
villegar Jul 22, 2025
a4f0077
Add step with new approach to install devtools
villegar Jul 22, 2025
d66c37a
Add missing workind directory
villegar Jul 22, 2025
a8269e5
Simplify workflow removing unnecessary step
villegar Jul 22, 2025
f489302
Remove additional double quote mark
villegar Jul 22, 2025
7a81c04
Ammend wrong file path and add commands to check current file tree
villegar Jul 22, 2025
a21b0c4
Replace the location of testStatus for development purposes
villegar Jul 22, 2025
f5ac4bc
Update path ../logs >>> logs
villegar Jul 22, 2025
5d2c5cd
Update working directories
villegar Jul 22, 2025
4cfa058
Update git config command and paths to local files
villegar Jul 22, 2025
b872950
Rename workflow and update documentation
villegar Jul 22, 2025
0b8a9c6
Add recursive and verbose flags to cp command
villegar Jul 22, 2025
b8c437d
Simplify copying command for log files
villegar Jul 22, 2025
a51f681
Update user.name for git push
villegar Jul 23, 2025
d961ac0
Rename branchName >> BRANCH_NAME
villegar Jul 23, 2025
2c11650
Rename environment variables from cammel case to all upper case and a…
villegar Jul 23, 2025
b5eada4
Ammend token secret variable name and structure of files
villegar Jul 23, 2025
9a47b4d
Update location of symbolic link
villegar Jul 23, 2025
6680411
Test a new way to get GitHub authentication token
villegar Jul 23, 2025
4023d03
Revert to secrets.DATASHIELD_DEV for token
villegar Jul 23, 2025
152de9b
Change function call for tests: testthat::test_local >> testthat::tes…
villegar Jul 23, 2025
678940b
Add GHA workflow for deployment of package documentation website gene…
villegar Jul 23, 2025
8297d11
Update run tests step to remove direct calls to library
villegar Jul 23, 2025
d1e27c3
Fix quotation marks
villegar Jul 23, 2025
d755066
Revert changes with single/double quotes surrounding code snip
villegar Jul 23, 2025
674ad9b
Merge branch 'datashield:v6.3.3-dev' into v6.3.3-dev
villegar Jul 23, 2025
e41608d
Regenerate documentation with pkgdown::build_site()
villegar Jul 23, 2025
d22f91f
Merge conflicting changes
villegar Jul 23, 2025
fb2780a
Remove superfluous text
villegar Jul 23, 2025
db49482
Fix path for reporter output
villegar Jul 23, 2025
1a6a741
Update symbolic link
villegar Jul 23, 2025
771a91c
Add additional dependencies to run the parser for test results
villegar Jul 24, 2025
e8fed4d
Change working directory to prevent error message when calling git2r:…
villegar Jul 24, 2025
c61416b
Add additional packages to render test report in HTML format
villegar Jul 24, 2025
1c46394
Correct function call render >> quarto_render
villegar Jul 24, 2025
36c3160
Remove additional quotation marks
villegar Jul 24, 2025
dbc689c
Update command to render quarto report
villegar Jul 24, 2025
23a22bf
Fix location of input for quarto_render command
villegar Jul 24, 2025
f9b4ca7
Add line for debugging
villegar Jul 24, 2025
b6f86df
Set up local environment variables
villegar Jul 24, 2025
510422a
Add missing portion of path
villegar Jul 24, 2025
2c26a06
Rename DATETIME to WORKFLOW_ID and update path to logs: ../logs >> logs
villegar Jul 24, 2025
fdfca18
Revert path to match the working directory structure of the quarto_re…
villegar Jul 24, 2025
4078d70
Add missing dependencies and change output file for quarto_render
villegar Jul 24, 2025
5e779b8
Correct name of output file from quarto_render: index.html >> test_re…
villegar Jul 24, 2025
b025cf1
Replace symbolic link with copy of the latest render of the test repo…
villegar Jul 24, 2025
260419f
Test removing unused token
villegar Jul 24, 2025
f8a4141
Update token name
villegar Jul 24, 2025
f6c657c
Fix path to latest documentation directory
villegar Jul 25, 2025
32b9639
Update name of workflow
villegar Jul 25, 2025
56c19d2
Changes from villegar/v6.3.3-dev into v6.3.4-dev
StuartWheater Jul 25, 2025
b45cd42
Update branches and simplify schedules
villegar Jul 25, 2025
a9cfef5
Test changing token location
villegar Jul 25, 2025
891d9dd
Add contents writing permission
villegar Jul 25, 2025
55e7a37
Add test-coverage GHA workflow
villegar Jul 28, 2025
260f178
Add badge for test coverage
villegar Jul 28, 2025
5238e32
Role back to custom token for deploying changes to testStatus
villegar Jul 28, 2025
e3ff123
Merge pull request #403 from villegar/v6.3.4-dev
StuartWheater Jul 28, 2025
acdd3fb
Added 'carrot' privacy level
StuartWheater Aug 1, 2025
4bc866b
Fix typo in cbindDS.R
StuartWheater Aug 6, 2025
4706682
Update DATASHIELD
StuartWheater Aug 6, 2025
82b254b
Rework Options
StuartWheater Aug 6, 2025
21f85c9
Merge branch 'v6.3.4-dev' of github.com:datashield/dsBase into v6.3.4…
StuartWheater Aug 6, 2025
846c9a0
Switched to 'permissive'
StuartWheater Aug 6, 2025
8570bcf
Merge pull request #404 from StuartWheater/v6.3.4-dev-permissive
StuartWheater Aug 7, 2025
464c150
Added '.Random.seed' to 'utils::globalVariables'
StuartWheater Aug 8, 2025
36ea81b
Merge pull request #34 from StuartWheater/v6.3.4-dev
StuartWheater Aug 8, 2025
07e4dfb
Merge pull request #405 from StuartWheater/v6.3.4-dev
StuartWheater Aug 10, 2025
6915d92
Merge pull request #406 from StuartWheater/v6.3.4-dev-permissive
StuartWheater Aug 10, 2025
21bb210
Merge pull request #407 from datashield/v6.3.4-dev
StuartWheater Aug 12, 2025
ee47a80
Rework restoring '.Random.seed'
StuartWheater Aug 12, 2025
4690798
Merge branch 'v6.3.4-dev' of github.com:StuartWheater/dsBase into v6.…
StuartWheater Aug 12, 2025
745a0d9
Merge branch 'v6.3.4-dev-feat_carrot' into v6.3.4-dev
StuartWheater Aug 12, 2025
7ba21e7
Merge pull request #36 from StuartWheater/v6.3.4-dev
StuartWheater Aug 12, 2025
9ec0e49
Merge pull request #408 from StuartWheater/v6.3.4-dev-feat_carrot
StuartWheater Aug 12, 2025
bfd95ec
Merge pull request #409 from datashield/master
StuartWheater Aug 12, 2025
01c33cd
Merge pull request #411 from datashield/v6.3.4-dev-permissive
StuartWheater Aug 12, 2025
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
210 changes: 210 additions & 0 deletions .github/workflows/dsBase_test_suite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
################################################################################
# DataSHIELD GHA test suite - dsBase
# Adapted from `azure-pipelines.yml` by Roberto Villegas-Diaz
#
# Inside the root directory $(Pipeline.Workspace) will be a file tree like:
# /dsBase <- Checked out version of datashield/dsBase
# /dsBase/logs <- Where results of tests and logs are collated
# /testStatus <- Checked out version of datashield/testStatus
#
# As of Jul 2025 this takes ~ 9 mins to run.
################################################################################
name: dsBase tests' suite

on:
push:
branches: [master, v6.3.4-dev]
schedule:
- cron: '0 0 * * 0' # Weekly
- cron: '0 1 * * *' # Nightly

jobs:
dsBase_test_suite:
runs-on: ubuntu-latest
timeout-minutes: 120
permissions:
contents: write

# These should all be constant, except TEST_FILTER. This can be used to test
# subsets of test files in the testthat directory. Options are like:
# '*' <- Run all tests.
# 'asNumericDS*' <- Run all asNumericDS tests, i.e. all the arg, etc. tests.
# '*_smk_*' <- Run all the smoke tests for all functions.
env:
TEST_FILTER: '*'
_r_check_system_clock_: 0
WORKFLOW_ID: ${{ github.run_id }}-${{ github.run_attempt }}
PROJECT_NAME: dsBase
BRANCH_NAME: ${{ github.ref_name }}
REPO_OWNER: ${{ github.repository_owner }}
R_KEEP_PKG_SOURCE: yes

steps:
- name: Checkout dsBase
uses: actions/checkout@v4
with:
path: dsBase

- name: Checkout testStatus
uses: actions/checkout@v4
with:
repository: ${{ env.REPO_OWNER }}/testStatus
token: ${{ secrets.GH_TOKEN }}
ref: master
path: testStatus

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: release
http-user-agent: release
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::rcmdcheck
cran::devtools
cran::git2r
cran::RCurl
cran::readr
cran::magrittr
cran::xml2
cran::purrr
cran::dplyr
cran::stringr
cran::tidyr
cran::quarto
cran::knitr
cran::kableExtra
cran::rmarkdown
cran::downlit
needs: check

- name: Check man files up-to-date
run: |
orig_sum=$(find man -type f | sort -u | xargs cat | md5sum)
R -e "devtools::document()"
new_sum=$(find man -type f | sort -u | xargs cat | md5sum)
if [ "$orig_sum" != "$new_sum" ]; then
echo "Your committed manual files (man/*.Rd) are out of sync with the R files. Run devtools::document() locally then commit."
exit 1
else
echo "Documentation up-to-date."
fi
working-directory: dsBase
continue-on-error: true

- name: Run devtools::check
run: |
R -q -e "library('devtools'); devtools::check(args = c('--no-tests', '--no-examples'))" | tee ../check.Rout
grep -q "^0 errors" ../check.Rout && grep -q " 0 warnings" ../check.Rout && grep -q " 0 notes" ../check.Rout
working-directory: dsBase
continue-on-error: true

- name: Run tests with coverage & JUnit report
run: |
mkdir -p logs
R -q -e "devtools::reload();"
R -q -e '
write.csv(
covr::coverage_to_list(
covr::package_coverage(
type = c("none"),
code = c('"'"'
output_file <- file("test_console_output.txt");
sink(output_file);
sink(output_file, type = "message");
junit_rep <- testthat::JunitReporter$new(file = file.path(getwd(), "test_results.xml"));
progress_rep <- testthat::ProgressReporter$new(max_failures = 999999);
multi_rep <- testthat::MultiReporter$new(reporters = list(progress_rep, junit_rep));
testthat::test_package("${{ env.PROJECT_NAME }}", filter = "${{ env.TEST_FILTER }}", reporter = multi_rep, stop_on_failure = FALSE)'"'"'
)
)
),
"coveragelist.csv"
)'

mv coveragelist.csv logs/
mv test_* logs/
grep -q " FAIL 0 " logs/test_console_output.txt
working-directory: dsBase

- name: Check for JUnit errors
run: |
issue_count=$(sed 's/failures="0" errors="0"//' test_results.xml | grep -c errors= || true)
echo "Number of testsuites with issues: $issue_count"
sed 's/failures="0" errors="0"//' test_results.xml | grep errors= > issues.log || true
cat issues.log || true
exit $issue_count
working-directory: dsBase/logs

- name: Write versions to file
run: |
echo "branch:${{ env.BRANCH_NAME }}" > ${{ env.WORKFLOW_ID }}.txt
echo "os:$(lsb_release -ds)" >> ${{ env.WORKFLOW_ID }}.txt
echo "R:$(R --version | head -n1)" >> ${{ env.WORKFLOW_ID }}.txt
working-directory: dsBase/logs

- name: Parse results from testthat and covr
run: |
Rscript --verbose --vanilla ../testStatus/source/parse_test_report.R logs/
working-directory: dsBase

- name: Commit results to testStatus
# if: github.repository == 'villegar/dsBase' && github.event_name != 'pull_request'
run: |
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
git config --global user.name "$GITHUB_ACTOR"
cd testStatus
git checkout master
git pull

mkdir -p logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
mkdir -p docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
mkdir -p docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/latest/
# clear the latest directory
rm -rf docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/latest/*

# Copy logs to new logs directory location
cp -rv ../dsBase/logs/* logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/
cp -rv ../dsBase/logs/${{ env.WORKFLOW_ID }}.txt logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/

# Create symbolic links
ln -sf ${{ env.WORKFLOW_ID }}/ logs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/.LATEST
# ln -sf docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/ docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/latest

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))'
mv source/test_report.html docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/index.html
cp -r docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/${{ env.WORKFLOW_ID }}/* docs/${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }}/latest

git add .
git commit -m "Auto test for ${{ env.PROJECT_NAME }}/${{ env.BRANCH_NAME }} @ ${{ env.WORKFLOW_ID }}"
git push

env:
PROJECT_NAME: ${{ env.PROJECT_NAME }}
BRANCH_NAME: ${{ env.BRANCH_NAME }}
WORKFLOW_ID: ${{ env.WORKFLOW_ID }}

- name: Dump environment info
run: |
echo -e "\n#############################"
echo -e "ls /: ######################"
ls -al .
echo -e "\n#############################"
echo -e "lscpu: ######################"
lscpu
echo -e "\n#############################"
echo -e "memory: #####################"
free -m
echo -e "\n#############################"
echo -e "env: ########################"
env
echo -e "\n#############################"
echo -e "R sessionInfo(): ############"
R -e 'sessionInfo()'
sudo apt install tree -y
tree .

49 changes: 49 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
62 changes: 62 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v5
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
27 changes: 21 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
Package: dsBase
Title: 'DataSHIELD' Server Site Base Functions
Title: 'DataSHIELD' Server Side Base Functions
Description: Base 'DataSHIELD' functions for the server side. 'DataSHIELD' is a software package which allows
you to do non-disclosive federated analysis on sensitive data. 'DataSHIELD' analytic functions have
been designed to only share non disclosive summary statistics, with built in automated output
checking based on statistical disclosure control. With data sites setting the threshold values for
the automated output checks. For more details, see 'citation("dsBase")'.
Version: 6.3.3
Version: 6.3.4-9000
Authors@R: c(person(given = "Paul",
family = "Burton",
role = c("aut")),
role = c("aut"),
comment = c(ORCID = "0000-0001-5799-9634")),
person(given = "Rebecca",
family = "Wilson",
role = c("aut")),
role = c("aut"),
comment = c(ORCID = "0000-0003-2294-593X")),
person(given = "Olly",
family = "Butters",
role = c("aut")),
role = c("aut"),
comment = c(ORCID = "0000-0003-0354-8461")),
person(given = "Patricia",
family = "Ryser-Welch",
role = c("aut")),
role = c("aut"),
comment = c(ORCID = "0000-0002-0070-0264")),
person(given = "Alex",
family = "Westerberg",
role = c("aut")),
Expand All @@ -37,6 +41,17 @@ Authors@R: c(person(given = "Paul",
role = c("aut"),
email = "yannick.marcon@obiba.org",
comment = c(ORCID = "0000-0003-0138-2023")),
person(given = "Tom",
family = "Bishop",
role = c("aut")),
person(given = "Amadou",
family = "Gaye",
role = c("aut"),
comment = c(ORCID = "0000-0002-1180-2792")),
person(given = "Xavier",
family = "Escribà-Montagut",
role = c("aut"),
comment = c(ORCID = "0000-0003-2888-8948")),
person(given = "Stuart",
family = "Wheater",
role = c("aut", "cre"),
Expand Down
2 changes: 1 addition & 1 deletion R/BooleDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
BooleDS <- function(V1.name=NULL, V2.name=NULL, Boolean.operator.n=NULL, na.assign.text, numeric.output=TRUE){

# Check Permissive Privacy Control Level.
dsBase::checkPermissivePrivacyControlLevel(c('permissive', 'banana'))
dsBase::checkPermissivePrivacyControlLevel(c('permissive', 'banana', 'carrot'))

#########################################################################
# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS #
Expand Down
7 changes: 5 additions & 2 deletions R/blackBoxDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ blackBoxDS <- function(input.var.name=NULL,
########################################################

# back-up current .Random.seed and revert on.exit
old_seed <- .Random.seed
on.exit(.Random.seed <- old_seed, add = TRUE)
if (exists(x = ".Random.seed", envir = globalenv())) {
assign(x = "old_seed", value = .Random.seed, envir = parent.frame());
on.exit({ assign(x = ".Random.seed", value = old_seed, envir = globalenv()); remove("old_seed", envir = parent.frame()) }, add = TRUE)
} else
on.exit(if (exists(x = ".Random.seed", envir = globalenv())) remove(".Random.seed", envir = globalenv()), add = TRUE)

input.var <- eval(parse(text=input.var.name), envir = parent.frame())

Expand Down
Loading
Loading