Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
178 changes: 123 additions & 55 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,112 @@
version: 2

steps: &steps
steps:
- checkout
- run:
name: Install libraries
command: |
apt update \
&& apt install -y --no-install-recommends \
curl \
r-cran-devtools \
r-bioc-rhdf5 \
r-bioc-delayedarray \
pandoc \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-fonts-extra
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE, dependencies = TRUE)"
- run:
name: Check code style
command: |
R -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes"); if (!requireNamespace("styler", quietly = TRUE) || as.character(utils::packageVersion("styler")) != "1.11.0") remotes::install_version("styler", version = "1.11.0", upgrade = "never")'
R -e 'result <- styler::style_pkg(dry = "on", style = styler::tidyverse_style, strict = FALSE); if (!all(result[["changed"]] == FALSE)) { message("Code style check found files that would be reformatted. Run styler::style_pkg(style = styler::tidyverse_style) locally."); print(result[result[["changed"]], "file", drop = FALSE]) }'
- run:
name: Build package
command: R CMD build .
- run:
name: Check package
command: R CMD check *tar.gz
- run:
name: Calculate and upload code coverage
command: |
R -e 'if (!requireNamespace("covr", quietly = TRUE)) install.packages("covr")'
R -e 'cov <- covr::package_coverage(type = "tests"); covr::to_cobertura(cov, filename = "coverage.xml"); print(cov); cat(sprintf("Total coverage: %.2f%%\n", covr::percent_coverage(cov)))'
if command -v curl >/dev/null 2>&1; then
curl -Os https://uploader.codecov.io/latest/linux/codecov || echo "Codecov uploader download failed; continuing."
else
echo "curl not found; skipping Codecov upload."
fi
if [ -f codecov ]; then
chmod +x codecov
./codecov -f coverage.xml -n "circleci-r-tests" || echo "Codecov upload failed; continuing."
else
echo "Codecov uploader not available; skipping upload."
fi

setup_steps: &setup_steps
- checkout
- run:
name: Install libraries
command: |
apt update \
&& apt install -y --no-install-recommends \
curl \
r-cran-devtools \
r-bioc-rhdf5 \
r-bioc-delayedarray \
pandoc \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-fonts-extra
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE, dependencies = TRUE)"
- run:
name: Check code style
command: |
R -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes"); if (!requireNamespace("styler", quietly = TRUE) || as.character(utils::packageVersion("styler")) != "1.11.0") remotes::install_version("styler", version = "1.11.0", upgrade = "never")'
R -e 'result <- styler::style_pkg(dry = "on", style = styler::tidyverse_style, strict = FALSE); if (!all(result[["changed"]] == FALSE)) { message("Code style check found files that would be reformatted. Run styler::style_pkg(style = styler::tidyverse_style) locally."); print(result[result[["changed"]], "file", drop = FALSE]) }'
- run:
name: Build package
command: R CMD build .
- persist_to_workspace:
root: .
paths:
- "*.tar.gz"

jobs:
releaseJammy:
setup_and_build:
docker:
- image: rocker/r2u:jammy
steps: *setup_steps

check_package:
docker:
- image: rocker/r2u:jammy
steps:
- checkout
- run:
name: Install libraries
command: |
apt update \
&& apt install -y --no-install-recommends \
curl \
r-cran-devtools \
r-bioc-rhdf5 \
r-bioc-delayedarray \
pandoc \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-fonts-extra
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE, dependencies = TRUE)"
- attach_workspace:
at: .
- run:
name: Check package
command: R CMD check *tar.gz

calculate_coverage:
docker:
- image: rocker/r2u:jammy
<<: *steps
steps:
- checkout
- run:
name: Install libraries
command: |
apt update \
&& apt install -y --no-install-recommends \
curl \
r-cran-devtools \
r-bioc-rhdf5 \
r-bioc-delayedarray \
pandoc \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-fonts-extra
- run:
name: Install package dependencies
command: R -e "devtools::install_deps(dep = TRUE, dependencies = TRUE)"
- run:
name: Calculate and upload code coverage
command: |
R -e 'if (!requireNamespace("covr", quietly = TRUE)) install.packages("covr")'
R -e 'cov <- covr::package_coverage(type = "tests"); covr::to_cobertura(cov, filename = "coverage.xml"); print(cov); cat(sprintf("Total coverage: %.2f%%\\n", covr::percent_coverage(cov)))'
if command -v curl >/dev/null 2>&1; then
curl -Os https://uploader.codecov.io/latest/linux/codecov || echo "Codecov uploader download failed; continuing."
else
echo "curl not found; skipping Codecov upload."
fi
if [ -f codecov ]; then
chmod +x codecov
./codecov -f coverage.xml -n "circleci-r-tests" || echo "Codecov upload failed; continuing."
else
echo "Codecov uploader not available; skipping upload."
fi

build_and_deploy:
environment:
TZ: "/usr/share/zoneinfo/America/New_York"
docker:
- image: cimg/base:2020.09
# working_directory: tmp/src/modelarray_build # the code will be check-ed out to here
steps:
- checkout
- setup_remote_docker:
Expand Down Expand Up @@ -96,7 +143,7 @@ workflows:
version: 2
build_test_deploy:
jobs:
- releaseJammy:
- setup_and_build:
filters:
branches:
ignore:
Expand All @@ -105,16 +152,37 @@ workflows:
tags:
only: /.*/

- build_and_deploy:
- check_package:
requires:
- releaseJammy
- setup_and_build
filters:
branches:
only: main
ignore:
- gh-pages
- /^gh-pages.*/
tags: # make sure any `git tag` triggers the run
tags:
only: /.*/

- calculate_coverage:
requires:
- setup_and_build
filters:
branches:
ignore:
- gh-pages
- /^gh-pages.*/
tags:
only: /.*/

- build_and_deploy:
requires:
- check_package
- calculate_coverage
filters:
branches:
only: main
ignore:
- gh-pages
- /^gh-pages.*/
tags:
only: /.*/
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Imports:
rlang,
tibble,
tidyr
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
Suggests:
rmarkdown,
knitr,
Expand Down
18 changes: 18 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

S3method(print,h5summary)
export("%>%")
export(ModelArray)
export(ModelArray.gam)
Expand All @@ -8,13 +9,28 @@ export(ModelArray.wrap)
export(analyseOneElement.gam)
export(analyseOneElement.lm)
export(analyseOneElement.wrap)
export(analysisNames)
export(elementMetadata)
export(exampleElementData)
export(gen_gamFormula_contIx)
export(gen_gamFormula_fxSmooth)
export(h5summary)
export(mergeModelArrays)
export(nElements)
export(nInputFiles)
export(numElementsTotal)
export(results)
export(scalarNames)
export(scalars)
export(sources)
export(writeResults)
exportMethods(analysisNames)
exportMethods(elementMetadata)
exportMethods(exampleElementData)
exportMethods(nElements)
exportMethods(nInputFiles)
exportMethods(results)
exportMethods(scalarNames)
exportMethods(scalars)
exportMethods(show)
exportMethods(sources)
Expand All @@ -26,6 +42,7 @@ import(mgcv)
import(tibble)
importClassesFrom(DelayedArray,DelayedArray)
importFrom(DelayedArray,DelayedArray)
importFrom(DelayedArray,acbind)
importFrom(DelayedArray,realize)
importFrom(HDF5Array,HDF5ArraySeed)
importFrom(crayon,black)
Expand All @@ -51,3 +68,4 @@ importFrom(stats,lm)
importFrom(stats,p.adjust)
importFrom(stats,p.adjust.methods)
importFrom(stats,terms)
importFrom(utils,head)
Loading
Loading