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

remove unwanted deps on renv.lock #180

Merged
merged 5 commits into from
Jan 17, 2024
Merged
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
27 changes: 20 additions & 7 deletions .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,35 @@ jobs:
R_KEEP_PKG_SOURCE: true
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
R_REPOS: "https://cran.r-project.org"
DEPS_IGNORE: >-
pharmaversesdtm,
pharmaverseadam,
admiral,
admiraldev,
admiralophtha,
admiralonco,
admiralvaccine,
staged.dependencies

# DEPS_IGNORE: env variable to ignore package when building renv.lock (step Upload dependencies artifact)
# (improvments ideas : get this list of deps to ignore from staged.dependencies yml file)
dgrassellyb marked this conversation as resolved.
Show resolved Hide resolved
dgrassellyb marked this conversation as resolved.
Show resolved Hide resolved

steps:
##################### BEGIN boilerplate steps #####################
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v5.4
uses: tj-actions/branch-names@v8

- name: Checkout repo (PR) 🛎
uses: actions/checkout@v3
uses: actions/checkout@v4
if: |
github.event_name == 'pull_request'
with:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
if: |
github.event_name != 'pull_request'
with:
Expand Down Expand Up @@ -100,14 +112,15 @@ jobs:
dir.create("/workspace/tmp")
library(dplyr)
installed_packages <- as.data.frame(installed.packages())
packages_to_remove <- Sys.getenv("DEPS_IGNORE", "")
packages_to_remove <- unlist(strsplit(packages_to_remove, ","))
installed_packages <- installed_packages %>% filter(LibPath != "/usr/local/lib/R/library") %>% # remove pre-built deps
filter(!Package %in% packages_to_remove)
# save deps as csv file
write.csv(installed_packages, "/workspace/tmp/deps-${{ matrix.r_version }}.csv", row.names = FALSE)
# create also renv.lock file
setwd("/workspace/tmp")

installed_packages <- as.data.frame(installed.packages())
installed_packages <- installed_packages %>% filter(LibPath != "/usr/local/lib/R/library")

renv_lock <- list(
"R" = list(
"Version" = paste(R.version$major, R.version$minor, sep=".")
Expand Down Expand Up @@ -152,7 +165,7 @@ jobs:
# Write the list to a JSON file (renv.lock)
writeLines(jsonlite::toJSON(renv_lock, pretty = TRUE, auto_unbox = TRUE), "renv-${{ matrix.r_version }}.lock")
print("generated renv.lock content")
system("cat renv.lock")
system("cat renv-${{ matrix.r_version }}.lock")
shell: Rscript {0}

- name: Upload deps.csv and renv.lock artifacts
Expand Down
Loading