Skip to content

Commit

Permalink
Run in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bschilder committed Nov 17, 2023
1 parent 4ca6ac5 commit 4ba980b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/rworkflows_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ jobs:
run_docker: ${{ true }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
free_diskspace: ${{ true }}
miniforge_variant: false
miniforge_variant: ${{ false }}
run_debug: ${{ true }}
16 changes: 11 additions & 5 deletions R/dependencies_linux.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#' Linux OS environment.
#' Includes all dependencies listed by \link[remotes]{system_requirements},
#' in addition to user-specified dependencies via \code{extra}.
#' @param prefix Prefix to prepend to the command.
#' Set to \code{NULL} to return a character vector of dependencies instead.
#' @param prefix Prefix to prepend to the command.
#' @param extra Additional dependencies to install.
#' @param verbose Print messages.
#' @inheritParams remotes::system_requirements
Expand Down Expand Up @@ -41,8 +42,13 @@ dependencies_linux <- function(os = "ubuntu",
os_release = os_release,
...)
)
deps <- unique(c(deps,extra))
cmd <- paste(prefix,paste(deps,collapse = " "))
messager(cmd,v=verbose)
cat(cmd)
deps <- sort(unique(c(deps,extra)))
#### Return ####
if(is.null(prefix)){
return(deps)
} else {
cmd <- paste(prefix,paste(deps,collapse = " "))
messager(cmd,v=verbose)
cat(cmd)
}
}
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ inputs:
(e.g. {{ secrets.PAT_GITHUB }}) which allows access to private
repositories. Read here for more details:
https://docs.github.com/en/actions/security-guides/automatic-token-authentication.
required: true
cache_version:
description: >
Which cache version to use.
Expand Down Expand Up @@ -159,6 +160,11 @@ inputs:
description: >
Free up additional disk space by deleting non-essential sofwares.
default: false
run_debug:
description: >
Whether to enable interactive debug mode using the
[tmate action](https://github.com/mxschmitt/action-tmate).
default: false

runs:
using: 'composite'
Expand All @@ -169,6 +175,10 @@ runs:
with:
github_token: ${{ inputs.GITHUB_TOKEN }}
comment_on_pr: false

- name: 🪲 Setup interactive debugging
if: inputs.run_debug == 'true'
uses: mxschmitt/action-tmate@v3

- name: 💾 Free Disk Space
if: inputs.free_diskspace == 'true' && runner.os == 'Linux'
Expand Down
5 changes: 4 additions & 1 deletion inst/templates/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ RUN Rscript -e 'if(!require("remotes")) install.packages("remotes"); \
#### --Step 3--: Install system dependencies ####
RUN sysreqs=$(Rscript -e 'rworkflows::dependencies_linux(package="rworkflows")') && \
sudo -s eval "$sysreqs"
#### --Step 2--: Create a buildzone folder ####
# Cleanup unnecessary apt files
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
#### --Step 4--: Create a buildzone folder ####
# BiocCheck requires the buildzone to have the same name as the R package
ARG PKG
RUN echo $PKG
Expand Down
1 change: 1 addition & 0 deletions man/dependencies_linux.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/testthat/test-dependencies_linux.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ test_that("dependencies_linux works", {
dependencies_linux(package="rworkflows")
)
testthat::expect_true(grepl("^apt-get update",cmd))

#### prefix=NULL ####
deps <- dependencies_linux(package="rworkflows", prefix=NULL)
testthat::expect_true(length(deps)>10)
})

0 comments on commit 4ba980b

Please sign in to comment.