Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci updates #408

Merged
merged 12 commits into from
May 10, 2024
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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,8 @@ vignettes/flags.png
vignettes/group.png
vignettes/sites.png
vignettes/thres.png
^docker$
vignettes/update_data.Rmd



65 changes: 39 additions & 26 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
image: code.usgs.gov:5001/water/wsc/umid/docker_images:latest

workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH

stages:
- getready
- build
- check
- test
- end
Expand All @@ -24,56 +27,64 @@ variables:
CONNECT_SERVER: $CONNECT_SERVER
PAGES_OUTDIR: "$CI_PROJECT_DIR/public"

cache:
key: ${CI_JOB_NAME}
paths:
- $R_LIBS_USER

getready:
stage: getready
build-image:
stage: build
image: ${DEVOPS_REGISTRY}usgs/docker:20
services:
- name: ${DEVOPS_REGISTRY}usgs/docker:20-dind
alias: docker
rules:
- changes:
- docker/Dockerfile
- .gitlab-ci.yml
script:
- mkdir -p $R_LIBS_USER
- mkdir -p $APT_CACHE
- echo "options(Ncpus=$(nproc --all), repos=c(CRAN='$CRAN'))" >> $R_PROFILE
- Rscript -e "install.packages(c( 'connectapi'))"
- Rscript -e "devtools::install_deps()"
cache:
paths:
- $R_LIBS_USER
artifacts:
paths:
- $R_LIBS_USER
- echo ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin $CI_REGISTRY
- docker pull ${CI_REGISTRY_IMAGE}:latest || true
- cd docker
- docker build
--cache-from ${CI_REGISTRY_IMAGE}:latest
-t ${CI_REGISTRY_IMAGE}:BUILD_${CI_COMMIT_SHORT_SHA}
-t ${CI_REGISTRY_IMAGE}:latest
.
# If this is building a git tag, create the corresponding docker tag
- if [ -n "${CI_COMMIT_TAG}" ]; then docker tag ${CI_REGISTRY_IMAGE}:BUILD_${CI_COMMIT_SHORT_SHA} ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}; fi
- docker push --all-tags ${CI_REGISTRY_IMAGE}


buildcheck:
stage: check
image: ${CI_REGISTRY_IMAGE}:latest
dependencies:
- build-image
script:
- mkdir -p $BUILD_LOGS_DIR
- apt-get update
- apt-get -o dir::cache::archives=${APT_CACHE} install -y --no-install-recommends qpdf pandoc pandoc-citeproc
- R CMD build . --no-build-vignettes --no-manual
- R -e 'devtools::check(document = FALSE, args = "--no-tests", error_on = "error", check_dir = Sys.getenv("BUILD_LOGS_DIR"))'
artifacts:
expire_in: 1 week
paths:
- $BUILD_LOGS_DIR

unittests:
stage: test
image: ${CI_REGISTRY_IMAGE}:latest
dependencies:
- getready
- build-image
- buildcheck
script:
- R -e 'library(testthat); options(testthat.output_file = file.path(Sys.getenv("CI_PROJECT_DIR"), "test-out.xml")); devtools::test(reporter = "junit")'
artifacts:
when: always
expire_in: 1 week
paths:
- test-out.xml
reports:
junit: test-out.xml

covertests:
stage: test
image: ${CI_REGISTRY_IMAGE}:latest
dependencies:
- getready
- build-image
- buildcheck
script:
- R -e 'x <- covr::package_coverage(); covr::to_cobertura(x); x; '
Expand All @@ -82,10 +93,12 @@ covertests:
coverage_report:
coverage_format: cobertura
path: cobertura.xml
expire_in: 1 week
coverage: '/Coverage: \d+.\d+\%/'

pages:
stage: end
image: ${CI_REGISTRY_IMAGE}:latest
only:
- main
script:
Expand Down
29 changes: 29 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM code.chs.usgs.gov:5001/ctek/docker/r-lang/r-base:4.4

# Necessary R libraries
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
pandoc-citeproc \
r-cran-devtools \
r-cran-tidyverse \
r-cran-checkmate \
r-cran-openxlsx \
r-cran-here \
r-cran-shinydashboard \
r-cran-shiny \
r-cran-readxl \
r-cran-rcolorbrewer \
r-cran-shinyace \
r-cran-rmarkdown \
r-cran-knitr \
r-cran-connectapi \
r-cran-dt \
r-cran-leaflet \
r-cran-rmarkdown \
r-cran-shinycssloaders \
r-cran-covr \
r-cran-tcpl \
r-cran-rsconnect \
&& rm -rf /var/lib/apt/lists/*



Binary file modified vignettes/OWC_custom_bench.xlsx
Binary file not shown.
Binary file modified vignettes/atrazineDose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 18 additions & 16 deletions vignettes/dose_curves.Rmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: "Concentration-Response Curves"
date: "`r format(Sys.time(), '%d %B, %Y')`"
output:
rmarkdown::html_vignette:
toc: true
Expand Down Expand Up @@ -71,21 +70,24 @@ ep <- "NVS_ENZ_hPDE4A1"
cas <- "1912-24-9"

chem_info <- tcplLoadChem(field = 'casn', val = cas)

assay_info <- tcplLoadAcid(fld = "acnm", val = ep)

mc3 <- tcplLoadData(lvl = 3, type = "mc",
fld = c("acid","spid"),
val = list(assay_info$acid,
chem_info$spid))

## Load mc tables from levels of interest
mc4 <- tcplLoadData(lvl = 4, type = "mc",
fld = c("spid", "aeid"),
val = list(chem_info$spid,
unique(mc3$aeid)))

tcplPlotM4ID(mc4, lvl = 5)
assay_info <- tcplLoadAeid(fld = "acnm", val = ep)

mc5 <- tcplLoadData(lvl = 5, type = "mc",
fld = c("aeid","spid"),
val = list(assay_info$aeid,
chem_info$spid))

plot_out <- tcplPlot(lvl = 5,
fld = c("spid","aeid"), # fields to query on
val = list(mc5$spid, # sample id's
mc5$aeid # assay endpoint id's
),
by = "aeid", # parameter to divide files
multi = FALSE, # multiple plots per page - output 6 per page if TRUE
verbose = TRUE, # output all details if TRUE
output = "console") # prefix of the filename

plot_out

```

Expand Down
Loading