From e9f2b2fcb4e22ecdeafd9eaffe639af2d4a8661f Mon Sep 17 00:00:00 2001 From: Franciszek Walkowiak Date: Mon, 23 Sep 2024 11:24:18 +0200 Subject: [PATCH 01/22] feat: setup binary package repository for different platforms --- action.yaml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index d8373ef..f7806a3 100644 --- a/action.yaml +++ b/action.yaml @@ -348,12 +348,32 @@ runs: - name: Set repositories run: | + echo "Runner OS: ${{ runner.os }}" + echo "Runner arch: ${{ runner.arch }}" + ppm_url="https://packagemanager.posit.co/cran" + if [ "${{ runner.os }}" == "Linux" ]; then + if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then + package_manager_url="$ppm_url/__linux__/rhel9/latest" + elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then + version_codename="$(cat /etc/*release | grep VERSION_CODENAME | cut -d'=' -f2)" + package_manager_url="$ppm_url/__linux__/$version_codename/latest" + else + echo "Detected unsupported distribution of Linux, please fix this. Details:" + cat /etc/*release + package_manager_url="$ppm_url/latest" + fi + elif [ "${{ runner.os }}" == "Windows" ]; then + package_manager_url="$ppm_url/latest/bin/windows" + else + package_manager_url="$ppm_url/latest" + fi + echo "package_manager_url=$package_manager_url" OS_CODENAME=$(lsb_release --codename --short | tail -1) cat > ${HOME}/.Rprofile < Date: Mon, 23 Sep 2024 11:28:11 +0200 Subject: [PATCH 02/22] fix: remove problematic command --- action.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yaml b/action.yaml index f7806a3..d8bd7a1 100644 --- a/action.yaml +++ b/action.yaml @@ -368,7 +368,6 @@ runs: package_manager_url="$ppm_url/latest" fi echo "package_manager_url=$package_manager_url" - OS_CODENAME=$(lsb_release --codename --short | tail -1) cat > ${HOME}/.Rprofile < Date: Mon, 23 Sep 2024 14:58:22 +0200 Subject: [PATCH 03/22] chore: test alternative repository names --- action.yaml | 53 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/action.yaml b/action.yaml index d8bd7a1..a1f7164 100644 --- a/action.yaml +++ b/action.yaml @@ -348,31 +348,40 @@ runs: - name: Set repositories run: | - echo "Runner OS: ${{ runner.os }}" - echo "Runner arch: ${{ runner.arch }}" - ppm_url="https://packagemanager.posit.co/cran" - if [ "${{ runner.os }}" == "Linux" ]; then - if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then - package_manager_url="$ppm_url/__linux__/rhel9/latest" - elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then - version_codename="$(cat /etc/*release | grep VERSION_CODENAME | cut -d'=' -f2)" - package_manager_url="$ppm_url/__linux__/$version_codename/latest" - else - echo "Detected unsupported distribution of Linux, please fix this. Details:" - cat /etc/*release - package_manager_url="$ppm_url/latest" - fi - elif [ "${{ runner.os }}" == "Windows" ]; then - package_manager_url="$ppm_url/latest/bin/windows" - else - package_manager_url="$ppm_url/latest" - fi - echo "package_manager_url=$package_manager_url" + # echo "Runner OS: ${{ runner.os }}" + # echo "Runner arch: ${{ runner.arch }}" + # ppm_url="https://packagemanager.posit.co/cran" + # if [ "${{ runner.os }}" == "Linux" ]; then + # if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then + # package_manager_url="$ppm_url/__linux__/rhel9/latest" + # elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then + # version_codename="$(cat /etc/*release | grep VERSION_CODENAME | cut -d'=' -f2)" + # package_manager_url="$ppm_url/__linux__/$version_codename/latest" + # else + # echo "Detected unsupported distribution of Linux, please fix this. Details:" + # cat /etc/*release + # package_manager_url="$ppm_url/latest" + # fi + # elif [ "${{ runner.os }}" == "Windows" ]; then + # package_manager_url="$ppm_url/latest/bin/windows" + # else + # package_manager_url="$ppm_url/latest" + # fi + # echo "package_manager_url=$package_manager_url" + # cat > ${HOME}/.Rprofile < ${HOME}/.Rprofile < Date: Tue, 24 Sep 2024 11:10:47 +0200 Subject: [PATCH 04/22] fix: use pkgcache::repo_resolve --- action.yaml | 86 ++++++++++++++++++++++++++--------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/action.yaml b/action.yaml index a1f7164..2c70d0e 100644 --- a/action.yaml +++ b/action.yaml @@ -74,6 +74,49 @@ runs: fi shell: bash + - name: Set repositories + run: | + # echo "Runner OS: ${{ runner.os }}" + # echo "Runner arch: ${{ runner.arch }}" + # ppm_url="https://packagemanager.posit.co/cran" + # if [ "${{ runner.os }}" == "Linux" ]; then + # if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then + # package_manager_url="$ppm_url/__linux__/rhel9/latest" + # elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then + # version_codename="$(cat /etc/*release | grep VERSION_CODENAME | cut -d'=' -f2)" + # package_manager_url="$ppm_url/__linux__/$version_codename/latest" + # else + # echo "Detected unsupported distribution of Linux, please fix this. Details:" + # cat /etc/*release + # package_manager_url="$ppm_url/latest" + # fi + # elif [ "${{ runner.os }}" == "Windows" ]; then + # package_manager_url="$ppm_url/latest/bin/windows" + # else + # package_manager_url="$ppm_url/latest" + # fi + # echo "package_manager_url=$package_manager_url" + # cat > ${HOME}/.Rprofile < ${HOME}/.Rprofile < ${HOME}/.Rprofile < ${HOME}/.Rprofile < Date: Tue, 24 Sep 2024 11:19:22 +0200 Subject: [PATCH 05/22] chore: cleanup old solution --- action.yaml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/action.yaml b/action.yaml index 2c70d0e..d1241a6 100644 --- a/action.yaml +++ b/action.yaml @@ -76,34 +76,6 @@ runs: - name: Set repositories run: | - # echo "Runner OS: ${{ runner.os }}" - # echo "Runner arch: ${{ runner.arch }}" - # ppm_url="https://packagemanager.posit.co/cran" - # if [ "${{ runner.os }}" == "Linux" ]; then - # if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then - # package_manager_url="$ppm_url/__linux__/rhel9/latest" - # elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then - # version_codename="$(cat /etc/*release | grep VERSION_CODENAME | cut -d'=' -f2)" - # package_manager_url="$ppm_url/__linux__/$version_codename/latest" - # else - # echo "Detected unsupported distribution of Linux, please fix this. Details:" - # cat /etc/*release - # package_manager_url="$ppm_url/latest" - # fi - # elif [ "${{ runner.os }}" == "Windows" ]; then - # package_manager_url="$ppm_url/latest/bin/windows" - # else - # package_manager_url="$ppm_url/latest" - # fi - # echo "package_manager_url=$package_manager_url" - # cat > ${HOME}/.Rprofile < ${HOME}/.Rprofile < Date: Tue, 24 Sep 2024 15:33:12 +0200 Subject: [PATCH 06/22] chore: update R command Co-authored-by: cicdguy <26552821+cicdguy@users.noreply.github.com> Signed-off-by: walkowif <59475134+walkowif@users.noreply.github.com> --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index d1241a6..49f5b99 100644 --- a/action.yaml +++ b/action.yaml @@ -76,7 +76,7 @@ runs: - name: Set repositories run: | - R -q -e 'if (!require("pkgcache")) install.packages("pkgcache")' + R -s -q -e 'if (!require("pkgcache")) install.packages("pkgcache")' cat > ${HOME}/.Rprofile < Date: Tue, 24 Sep 2024 18:02:57 +0200 Subject: [PATCH 07/22] feat: setup multiple repositories using pkgcache --- action.yaml | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/action.yaml b/action.yaml index d1241a6..b42eb30 100644 --- a/action.yaml +++ b/action.yaml @@ -49,6 +49,11 @@ inputs: description: Maximum number of iterations to resolve dependencies. required: false default: 10 + repository-list: + description: | + Comma-separated list of pkgcache-compatible repository names from which the dependencies will be downloaded. + required: false + default: "https://pharmaverse.r-universe.dev,PPM@latest" branding: icon: 'download' @@ -76,17 +81,24 @@ runs: - name: Set repositories run: | - R -q -e 'if (!require("pkgcache")) install.packages("pkgcache")' - cat > ${HOME}/.Rprofile < ${HOME}/.Rprofile < Date: Tue, 24 Sep 2024 18:12:12 +0200 Subject: [PATCH 08/22] fix: R flags --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 6e31df9..e11b191 100644 --- a/action.yaml +++ b/action.yaml @@ -81,7 +81,7 @@ runs: - name: Set repositories run: | - R -s -q -e < Date: Tue, 24 Sep 2024 18:27:22 +0200 Subject: [PATCH 09/22] fix: options(repos) --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index e11b191..47c508b 100644 --- a/action.yaml +++ b/action.yaml @@ -86,7 +86,7 @@ runs: repository_list <- unlist(strsplit( "${{ inputs.repository-list }}", split="," )) - vapply(repository_list, pkgcache::repo_resolve, character(1)) + options(repos = c(vapply(repository_list, pkgcache::repo_resolve, character(1)))) options("repos") RSCRIPT # cat > ${HOME}/.Rprofile < Date: Tue, 24 Sep 2024 18:36:58 +0200 Subject: [PATCH 10/22] fix: set options(repos) in .Rprofile --- action.yaml | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/action.yaml b/action.yaml index 47c508b..d7114eb 100644 --- a/action.yaml +++ b/action.yaml @@ -83,22 +83,15 @@ runs: run: | R -s -q < ${HOME}/.Rprofile < ${HOME}/.Rprofile < Date: Wed, 25 Sep 2024 10:36:40 +0200 Subject: [PATCH 11/22] chore: debug resolved repositories --- action.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/action.yaml b/action.yaml index d7114eb..a7e8ce3 100644 --- a/action.yaml +++ b/action.yaml @@ -90,6 +90,13 @@ runs: )) options(repos = c(vapply(repository_list, pkgcache::repo_resolve, character(1)))) EOF + R -s -q < Date: Wed, 25 Sep 2024 10:37:07 +0200 Subject: [PATCH 12/22] fix: typo --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index a7e8ce3..e1c239f 100644 --- a/action.yaml +++ b/action.yaml @@ -94,7 +94,7 @@ runs: repository_list <- unlist(strsplit( "${{ inputs.repository-list }}", split="," )) - cat("Resolved repositories:") + cat("Resolved repositories:\n") vapply(repository_list, pkgcache::repo_resolve, character(1)) RSCRIPT echo "Repositories written to ${HOME}/.Rprofile:" From 15bc0a244abd0056155dd55c7d1b4fca5ae2ef89 Mon Sep 17 00:00:00 2001 From: Franciszek Walkowiak Date: Wed, 25 Sep 2024 10:49:02 +0200 Subject: [PATCH 13/22] chore: print repos --- action.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yaml b/action.yaml index e1c239f..dfa4d30 100644 --- a/action.yaml +++ b/action.yaml @@ -82,6 +82,7 @@ runs: - name: Set repositories run: | R -s -q < ${HOME}/.Rprofile < Date: Wed, 25 Sep 2024 11:16:04 +0200 Subject: [PATCH 14/22] fix: options(repos) --- action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yaml b/action.yaml index dfa4d30..f71769e 100644 --- a/action.yaml +++ b/action.yaml @@ -83,20 +83,20 @@ runs: run: | R -s -q < ${HOME}/.Rprofile < Date: Wed, 25 Sep 2024 11:42:27 +0200 Subject: [PATCH 15/22] chore: ensure libcurl is installed --- action.yaml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/action.yaml b/action.yaml index f71769e..87fcad7 100644 --- a/action.yaml +++ b/action.yaml @@ -81,6 +81,20 @@ runs: - name: Set repositories run: | + # Installation of curl required by pkgcache fails because: + # Configuration failed because libcurl was not found. Try installing: + # * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc) + # * rpm: libcurl-devel (Fedora, CentOS, RHEL) + # Installation of libcurl is specifically needed for: ubuntu-clang, ubunut-gcc12, ubuntu-next + # ubuntu-release, donttest R-hub checks. + if [ "${{ runner.os }}" == "Linux" ]; then + if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then + apt-get update + apt-get install -yq libcurl4-openssl-dev + elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then + dnf install -y libcurl-devel + fi + fi R -s -q < Date: Wed, 25 Sep 2024 11:44:57 +0200 Subject: [PATCH 16/22] chore: swap installation instructions --- action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yaml b/action.yaml index 87fcad7..27466f9 100644 --- a/action.yaml +++ b/action.yaml @@ -89,10 +89,10 @@ runs: # ubuntu-release, donttest R-hub checks. if [ "${{ runner.os }}" == "Linux" ]; then if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then + dnf install -y libcurl-devel + elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then apt-get update apt-get install -yq libcurl4-openssl-dev - elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then - dnf install -y libcurl-devel fi fi R -s -q < Date: Wed, 25 Sep 2024 14:42:12 +0200 Subject: [PATCH 17/22] fix: install pkgcache with r-lib/actions/setup-r-dependencies --- action.yaml | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/action.yaml b/action.yaml index 27466f9..5047720 100644 --- a/action.yaml +++ b/action.yaml @@ -79,26 +79,20 @@ runs: fi shell: bash + - name: Install required packages + uses: r-lib/actions/setup-r-dependencies@v2 + with: + packages: "" + extra-packages: | + any::sessioninfo + any::pkgdepends + any::cli + any::desc + any::pkgcache + install-pandoc: false + - name: Set repositories run: | - # Installation of curl required by pkgcache fails because: - # Configuration failed because libcurl was not found. Try installing: - # * deb: libcurl4-openssl-dev (Debian, Ubuntu, etc) - # * rpm: libcurl-devel (Fedora, CentOS, RHEL) - # Installation of libcurl is specifically needed for: ubuntu-clang, ubunut-gcc12, ubuntu-next - # ubuntu-release, donttest R-hub checks. - if [ "${{ runner.os }}" == "Linux" ]; then - if [ -n "$(cat /etc/*release | grep ID | grep fedora)" ]; then - dnf install -y libcurl-devel - elif [ -n "$(cat /etc/*release | grep ID | grep ubuntu)" ]; then - apt-get update - apt-get install -yq libcurl4-openssl-dev - fi - fi - R -s -q < ${HOME}/.Rprofile < Date: Wed, 25 Sep 2024 15:17:19 +0200 Subject: [PATCH 18/22] fix: set default repository list Signed-off-by: walkowif <59475134+walkowif@users.noreply.github.com> --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 5047720..a462096 100644 --- a/action.yaml +++ b/action.yaml @@ -53,7 +53,7 @@ inputs: description: | Comma-separated list of pkgcache-compatible repository names from which the dependencies will be downloaded. required: false - default: "https://pharmaverse.r-universe.dev,PPM@latest" + default: "PPM@latest" branding: icon: 'download' From 8786283606603db3dc89d248c517b7c6a1943054 Mon Sep 17 00:00:00 2001 From: Franciszek Walkowiak Date: Wed, 25 Sep 2024 15:35:19 +0200 Subject: [PATCH 19/22] fix: remove default_cran_mirror --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 5047720..215aa45 100644 --- a/action.yaml +++ b/action.yaml @@ -97,7 +97,7 @@ runs: repository_list <- unlist(strsplit( "${{ inputs.repository-list }}", split="," )) - options(repos = c(vapply(repository_list, pkgcache::repo_resolve, character(1)), pkgcache::default_cran_mirror(), getOption("repos"))) + options(repos = c(vapply(repository_list, pkgcache::repo_resolve, character(1)), getOption("repos"))) EOF R -s -q < Date: Wed, 25 Sep 2024 15:36:43 +0200 Subject: [PATCH 20/22] chore: remove debug step --- action.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/action.yaml b/action.yaml index 46a577d..190a81c 100644 --- a/action.yaml +++ b/action.yaml @@ -368,12 +368,6 @@ runs: shell: bash run: rm utils.R - - name: Debug get repositories - run: | - cat("Resolved repositories loaded from .Rprofile:\n") - getOption("repos") - shell: Rscript {0} - - uses: r-lib/actions/setup-r-dependencies@v2 if: ${{ inputs.skip-install == 'false' }} with: From 717844db193bf25fc360679fe8fc7f93c0a848c3 Mon Sep 17 00:00:00 2001 From: walkowif <59475134+walkowif@users.noreply.github.com> Date: Thu, 26 Sep 2024 09:25:50 +0200 Subject: [PATCH 21/22] fix: use unique repos Co-authored-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Signed-off-by: walkowif <59475134+walkowif@users.noreply.github.com> --- action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yaml b/action.yaml index 190a81c..918380a 100644 --- a/action.yaml +++ b/action.yaml @@ -97,7 +97,7 @@ runs: repository_list <- unlist(strsplit( "${{ inputs.repository-list }}", split="," )) - options(repos = c(vapply(repository_list, pkgcache::repo_resolve, character(1)), getOption("repos"))) + options(repos = unique(c(vapply(repository_list, pkgcache::repo_resolve, character(1)), getOption("repos")))) EOF R -s -q < Date: Thu, 26 Sep 2024 09:29:21 +0200 Subject: [PATCH 22/22] chore: cleanup debug output --- action.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/action.yaml b/action.yaml index 918380a..bfbba84 100644 --- a/action.yaml +++ b/action.yaml @@ -99,12 +99,6 @@ runs: )) options(repos = unique(c(vapply(repository_list, pkgcache::repo_resolve, character(1)), getOption("repos")))) EOF - R -s -q <