From 9e85fcf9ada47c3b1f9e71955630547ea3bd154c Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 10:28:28 +0200 Subject: [PATCH 01/33] Adds a new subflow which checks the package against specific cran snapshot(s) --- .github/workflows/Check-package.yaml | 5 ++ .github/workflows/R-CMD-check-versions.yaml | 70 +++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/R-CMD-check-versions.yaml diff --git a/.github/workflows/Check-package.yaml b/.github/workflows/Check-package.yaml index 627d8cf..c3f395d 100644 --- a/.github/workflows/Check-package.yaml +++ b/.github/workflows/Check-package.yaml @@ -28,6 +28,11 @@ jobs: name: RMD check ๐Ÿ“ฆ uses: ./.github/workflows/R-CMD-check.yaml + # Runs R CMD check with specific version(s) of R and cran-snapshot + check-versions: + name: RMD check versions ๐Ÿ“œ + uses: ./.github/workflows/R-CMD-check-versions.yaml + # Runs unittests while capturing code:cov and uploads to Codecov io. See local subflow test: name: Test ๐Ÿงช diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml new file mode 100644 index 0000000..2cb2f45 --- /dev/null +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -0,0 +1,70 @@ +--- +# R-CMD check which allows you to lock the R version and date of the CRAN snapshot. +# This is particularly helpful for ensuring that the package works with internal systems. + on: + workflow_dispatch: + workflow_call: + permissions: read-all + + name: R-CMD-check-versions + + jobs: + R-CMD-check: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} (R ${{ matrix.config.r }}, ${{ matrix.config.date }}) + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - windows-latest + - ubuntu-latest + config: + - date: 2023-10-25 # Lock the date of the CRAN snapshot + r: 4.3.1 + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + use-public-rspm: false + + - name: Install curl + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt install libcurl4-openssl-dev + + - name: Install dependencies + run: > + options( + repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") + ) + + + install.packages(c("attachment", "rcmdcheck"), Ncpus = parallel::detectCores()-1) + + + attachment::att_from_description(field = c("Depends", "Imports", "Suggests")) |> + install.packages(Ncpus = parallel::detectCores()-1) + + shell: Rscript {0} + + - name: Session info + run: | + sessionInfo() + installed.packages()[,c("Package", "Version")] + + shell: Rscript {0} + + - uses: r-lib/actions/check-r-package@v2 + with: + args: 'c("--no-manual", "--as-cran")' + upload-snapshots: true + error-on: '"error"' + check-dir: '"check"' + upload-results: true From 72730295a256a39d1f6bf33931494300c3e27aed Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 10:50:08 +0200 Subject: [PATCH 02/33] tweaking the pipeline --- .github/workflows/Check-package.yaml | 8 +++--- .github/workflows/R-CMD-check-versions.yaml | 28 ++++++++++++++++++++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Check-package.yaml b/.github/workflows/Check-package.yaml index c3f395d..faa114d 100644 --- a/.github/workflows/Check-package.yaml +++ b/.github/workflows/Check-package.yaml @@ -23,10 +23,10 @@ jobs: name: License Check ๐Ÿƒ uses: insightsengineering/r.pkg.template/.github/workflows/licenses.yaml@main - # Runs R CMD check using the local R-CMD-check.yaml workflow - check: - name: RMD check ๐Ÿ“ฆ - uses: ./.github/workflows/R-CMD-check.yaml + # # Runs R CMD check using the local R-CMD-check.yaml workflow + # check: + # name: RMD check ๐Ÿ“ฆ + # uses: ./.github/workflows/R-CMD-check.yaml # Runs R CMD check with specific version(s) of R and cran-snapshot check-versions: diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 2cb2f45..610a11b 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -20,6 +20,8 @@ - windows-latest - ubuntu-latest config: + - date: 'latest' + r: 'release' - date: 2023-10-25 # Lock the date of the CRAN snapshot r: 4.3.1 env: @@ -39,13 +41,37 @@ run: | sudo apt install libcurl4-openssl-dev - - name: Install dependencies + + # Install package dependencies (if a specific date) + - name: Install dependencies ${{ matrix.config.date }} + if: matrix.config.date != 'latest' run: > options( repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) + install.packages(c("pak"), Ncpus = parallel::detectCores()-1) + + pak::pkg_install("rcmdcheck") + pak::pkg_install(".", dependencies=T, upgrade=T) + + + # attachment::att_from_description(field = c("Depends", "Imports", "Suggests")) |> + # install.packages(Ncpus = parallel::detectCores()-1) + + shell: Rscript {0} + + # Install package dependencies (if lastest) + - uses: r-lib/actions/setup-r-dependencies@v2 + if: matrix.config.date == 'latest' + with: + extra-packages: any::rcmdcheck + needs: check + + - name: Install dependencies latest + if: matrix.config.date == 'latest' + run: > install.packages(c("attachment", "rcmdcheck"), Ncpus = parallel::detectCores()-1) From c106c8b3c956874d7a42907f49e25a9a3175cceb Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 10:56:28 +0200 Subject: [PATCH 03/33] added concurrency --- .github/workflows/R-CMD-check-versions.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 610a11b..d6dd54c 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -4,6 +4,11 @@ on: workflow_dispatch: workflow_call: + + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + permissions: read-all name: R-CMD-check-versions @@ -51,7 +56,7 @@ ) - install.packages(c("pak"), Ncpus = parallel::detectCores()-1) + #install.packages(c("pak"), Ncpus = parallel::detectCores()-1) pak::pkg_install("rcmdcheck") pak::pkg_install(".", dependencies=T, upgrade=T) From 4ddbc163f34f855c64ee43a5e3319590beb390c5 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 11:06:53 +0200 Subject: [PATCH 04/33] . --- .github/workflows/R-CMD-check-versions.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index d6dd54c..559d436 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -25,8 +25,8 @@ - windows-latest - ubuntu-latest config: - - date: 'latest' - r: 'release' + # - date: 'latest' + # r: 'release' - date: 2023-10-25 # Lock the date of the CRAN snapshot r: 4.3.1 env: @@ -55,8 +55,7 @@ repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) - - #install.packages(c("pak"), Ncpus = parallel::detectCores()-1) + install.packages("pak") pak::pkg_install("rcmdcheck") pak::pkg_install(".", dependencies=T, upgrade=T) From 0d61205e8790fd31e5f1f4877e961af8826e7a2d Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 11:11:43 +0200 Subject: [PATCH 05/33] . --- .github/workflows/R-CMD-check-versions.yaml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 559d436..272d0e4 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -50,7 +50,7 @@ # Install package dependencies (if a specific date) - name: Install dependencies ${{ matrix.config.date }} if: matrix.config.date != 'latest' - run: > + run: | options( repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) @@ -73,16 +73,6 @@ extra-packages: any::rcmdcheck needs: check - - name: Install dependencies latest - if: matrix.config.date == 'latest' - run: > - install.packages(c("attachment", "rcmdcheck"), Ncpus = parallel::detectCores()-1) - - - attachment::att_from_description(field = c("Depends", "Imports", "Suggests")) |> - install.packages(Ncpus = parallel::detectCores()-1) - - shell: Rscript {0} - name: Session info run: | From 968176ae4d2ba2461557670b46e7df2ee2022c2e Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 11:53:11 +0200 Subject: [PATCH 06/33] switched away from pak --- .github/workflows/Check-package.yaml | 4 ++++ .github/workflows/R-CMD-check-versions.yaml | 15 +++++++-------- .github/workflows/Release-package.yaml | 4 ++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/Check-package.yaml b/.github/workflows/Check-package.yaml index faa114d..b6771d2 100644 --- a/.github/workflows/Check-package.yaml +++ b/.github/workflows/Check-package.yaml @@ -10,6 +10,10 @@ on: workflow_dispatch: workflow_call: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Check Package ๐Ÿ“ฆ jobs: diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 272d0e4..7a767cf 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -5,11 +5,7 @@ workflow_dispatch: workflow_call: - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - - permissions: read-all + permissions: read-all name: R-CMD-check-versions @@ -55,10 +51,13 @@ repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) - install.packages("pak") + install.packages("rcmdcheck") + install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) + + #install.packages("pak") - pak::pkg_install("rcmdcheck") - pak::pkg_install(".", dependencies=T, upgrade=T) + # pak::pkg_install("rcmdcheck") + # pak::pkg_install(".", dependencies=T, upgrade=T) # attachment::att_from_description(field = c("Depends", "Imports", "Suggests")) |> diff --git a/.github/workflows/Release-package.yaml b/.github/workflows/Release-package.yaml index fafaf60..b7518b4 100644 --- a/.github/workflows/Release-package.yaml +++ b/.github/workflows/Release-package.yaml @@ -10,6 +10,10 @@ workflow_dispatch: workflow_call: + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + name: Release Package ๐Ÿš€ jobs: From c38e1ea843c1ce1ddefac39b2966a9cacc6c4411 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 11:57:48 +0200 Subject: [PATCH 07/33] . --- .github/workflows/R-CMD-check-versions.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 7a767cf..bdb7b42 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -54,15 +54,6 @@ install.packages("rcmdcheck") install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) - #install.packages("pak") - - # pak::pkg_install("rcmdcheck") - # pak::pkg_install(".", dependencies=T, upgrade=T) - - - # attachment::att_from_description(field = c("Depends", "Imports", "Suggests")) |> - # install.packages(Ncpus = parallel::detectCores()-1) - shell: Rscript {0} # Install package dependencies (if lastest) From 5c32a20734792e87eba5c9e037c90eba630684e7 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 11:59:05 +0200 Subject: [PATCH 08/33] fixing typos --- .github/workflows/R-CMD-check-versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index bdb7b42..29d4af2 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -5,7 +5,7 @@ workflow_dispatch: workflow_call: - permissions: read-all + permissions: read-all name: R-CMD-check-versions From ea7e7e929e990148a5d75f056b634510acf0a756 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 12:00:49 +0200 Subject: [PATCH 09/33] fixing typos --- .github/workflows/R-CMD-check-versions.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 29d4af2..ef82b44 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -4,8 +4,6 @@ on: workflow_dispatch: workflow_call: - - permissions: read-all name: R-CMD-check-versions From 952b5a0fd51d4d093b710a0e95227c08da136fae Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 12:16:36 +0200 Subject: [PATCH 10/33] more fixing --- .github/workflows/R-CMD-check-versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index ef82b44..8a48ae8 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -49,7 +49,7 @@ repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) - install.packages("rcmdcheck") + install.packages(c("rcmdcheck", "knitr")) install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) shell: Rscript {0} From f78b2314b078b7403c0f7be36c38f0cfb84d92b7 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 12:28:54 +0200 Subject: [PATCH 11/33] . --- .github/workflows/R-CMD-check-versions.yaml | 5 +++-- .github/workflows/R-CMD-check.yaml | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 8a48ae8..1305267 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -49,8 +49,9 @@ repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) - install.packages(c("rcmdcheck", "knitr")) - install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) + install.packages(c("rcmdcheck")) + devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) + #install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) shell: Rscript {0} diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 0fdf02d..1a7864b 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -18,8 +18,8 @@ jobs: matrix: config: - {os: ubuntu-latest, r: 'release'} - - {os: windows-latest, r: 'release'} - - {os: macos-latest, r: 'release'} + #- {os: windows-latest, r: 'release'} + #- {os: macos-latest, r: 'release'} # - {os: ubuntu-latest, r: 'oldrel-1'} # - {os: ubuntu-latest, r: 'oldrel-2'} # - {os: ubuntu-latest, r: 'oldrel-3'} From 8839c5b3ce543cda71682c7089fa0c67996df741 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 12:33:27 +0200 Subject: [PATCH 12/33] . --- .github/workflows/R-CMD-check-versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 1305267..ade15b4 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -49,7 +49,7 @@ repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") ) - install.packages(c("rcmdcheck")) + install.packages(c("rcmdcheck", "devtools")) devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) #install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) From 21b280a56febc65e0f2561a1ca689ea38733dba3 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 12:56:50 +0200 Subject: [PATCH 13/33] changed to pak --- .github/workflows/R-CMD-check-versions.yaml | 183 ++++++++++++-------- 1 file changed, 107 insertions(+), 76 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index ade15b4..fb296cb 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -1,79 +1,110 @@ --- # R-CMD check which allows you to lock the R version and date of the CRAN snapshot. # This is particularly helpful for ensuring that the package works with internal systems. - on: - workflow_dispatch: - workflow_call: - - name: R-CMD-check-versions - - jobs: - R-CMD-check: - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} (R ${{ matrix.config.r }}, ${{ matrix.config.date }}) - strategy: - fail-fast: false - matrix: - os: - - macos-latest - - windows-latest - - ubuntu-latest - config: - # - date: 'latest' - # r: 'release' - - date: 2023-10-25 # Lock the date of the CRAN snapshot - r: 4.3.1 - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - R_KEEP_PKG_SOURCE: yes - - steps: - - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - use-public-rspm: false - - - name: Install curl - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt install libcurl4-openssl-dev - - - # Install package dependencies (if a specific date) - - name: Install dependencies ${{ matrix.config.date }} - if: matrix.config.date != 'latest' - run: | - options( - repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") - ) - - install.packages(c("rcmdcheck", "devtools")) - devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) - #install.packages(".", dependencies=T, upgrade=T, Ncpus = parallel::detectCores()-1) - - shell: Rscript {0} - - # Install package dependencies (if lastest) - - uses: r-lib/actions/setup-r-dependencies@v2 - if: matrix.config.date == 'latest' - with: - extra-packages: any::rcmdcheck - needs: check - - - - name: Session info - run: | - sessionInfo() - installed.packages()[,c("Package", "Version")] - - shell: Rscript {0} - - - uses: r-lib/actions/check-r-package@v2 - with: - args: 'c("--no-manual", "--as-cran")' - upload-snapshots: true - error-on: '"error"' - check-dir: '"check"' - upload-results: true + on: + workflow_dispatch: + workflow_call: + + name: R-CMD-check-versions + + jobs: + R-CMD-check: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} (R ${{ matrix.config.r }}, ${{ matrix.config.date }}) + strategy: + fail-fast: false + matrix: + os: + #- macos-latest + #- windows-latest + - ubuntu-latest + config: + - date: 'latest' + r: 'release' + - date: 2023-10-25 # Lock the date of the CRAN snapshot + r: 4.3.1 + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + use-public-rspm: false + + - name: Install curl + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt install libcurl4-openssl-dev + + + - name: Install pak (Windows) + if: runner.os != 'Windows' && matrix.config.date != 'latest' + run: | + # Install pak + cat("::group::Install pak\n") + lib <- Sys.getenv("R_LIB_FOR_PAK") + dir.create(lib, showWarnings = FALSE, recursive = TRUE) + install.packages("pak", lib = lib, repos = sprintf( + "https://r-lib.github.io/p/pak/%s/%s/%s/%s", + "stable", + .Platform$pkgType, + R.Version()$os, + R.Version()$arch + )) + cat("::endgroup::\n") + shell: Rscript {0} + + - name: Install pak (Unix) + if: runner.os != 'Windows' && matrix.config.date != 'latest' + run: | + # Install pak + echo "::group::Install pak" + if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi + $SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' + $SUDO R -q -e 'install.packages("pak", lib = Sys.getenv("R_LIB_FOR_PAK"), repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' + echo "::endgroup::" + shell: bash + + + # Install package dependencies (if a specific date) + - name: Install dependencies ${{ matrix.config.date }} + if: matrix.config.date != 'latest' + run: | + options( + repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") + ) + + install.packages(c("rcmdcheck", "devtools"), Ncpus = parallel::detectCores()-1) + + pak::pkg_install(".", dependencies = TRUE, upgrade = TRUE) + + #devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) + + shell: Rscript {0} + + # Install package dependencies (if lastest) + - uses: r-lib/actions/setup-r-dependencies@v2 + if: matrix.config.date == 'latest' + with: + extra-packages: any::rcmdcheck + needs: check + + + - name: Session info + run: | + sessionInfo() + installed.packages()[,c("Package", "Version")] + + shell: Rscript {0} + + - uses: r-lib/actions/check-r-package@v2 + with: + args: 'c("--no-manual", "--as-cran")' + upload-snapshots: true + error-on: '"error"' + check-dir: '"check"' + upload-results: true From a44500f32bff945a2e2f2afae064b46e409c2be1 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 12:58:55 +0200 Subject: [PATCH 14/33] . --- .github/workflows/R-CMD-check-versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index fb296cb..b869038 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -42,7 +42,7 @@ - name: Install pak (Windows) - if: runner.os != 'Windows' && matrix.config.date != 'latest' + if: runner.os == 'Windows' && matrix.config.date != 'latest' run: | # Install pak cat("::group::Install pak\n") From 10d0d965d0a49ef0dd122d3f24de15688b959ecb Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:01:10 +0200 Subject: [PATCH 15/33] . --- .github/workflows/R-CMD-check-versions.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index b869038..a55fdcc 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -35,13 +35,13 @@ r-version: ${{ matrix.config.r }} use-public-rspm: false - - name: Install curl - if: matrix.os == 'ubuntu-latest' - run: | - sudo apt install libcurl4-openssl-dev + # - name: Install curl () + # if: matrix.os == 'ubuntu-latest' && matrix.config.date != 'latest' + # run: | + # sudo apt install libcurl4-openssl-dev - - name: Install pak (Windows) + - name: Install pak (Windows + CRAN snapshot) if: runner.os == 'Windows' && matrix.config.date != 'latest' run: | # Install pak @@ -58,7 +58,7 @@ cat("::endgroup::\n") shell: Rscript {0} - - name: Install pak (Unix) + - name: Install pak (Unix + CRAN snapshot) if: runner.os != 'Windows' && matrix.config.date != 'latest' run: | # Install pak @@ -71,7 +71,7 @@ # Install package dependencies (if a specific date) - - name: Install dependencies ${{ matrix.config.date }} + - name: Install dependencies ${{ matrix.config.date }} (CRAN snapshot) if: matrix.config.date != 'latest' run: | options( From 5405458d97e2c3655d37ccd430aa090006c8ec0c Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:05:40 +0200 Subject: [PATCH 16/33] . --- .github/workflows/R-CMD-check-versions.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index a55fdcc..2dd7c67 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -10,7 +10,7 @@ jobs: R-CMD-check: runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} (R ${{ matrix.config.r }}, ${{ matrix.config.date }}) + name: ${{ matrix.os }} (R ${{ matrix.config.r }}, CRAN ${{ matrix.config.date }}) strategy: fail-fast: false matrix: @@ -46,9 +46,9 @@ run: | # Install pak cat("::group::Install pak\n") - lib <- Sys.getenv("R_LIB_FOR_PAK") - dir.create(lib, showWarnings = FALSE, recursive = TRUE) - install.packages("pak", lib = lib, repos = sprintf( + #lib <- Sys.getenv("R_LIB_FOR_PAK") + #dir.create(lib, showWarnings = FALSE, recursive = TRUE) + install.packages("pak", repos = sprintf( "https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, @@ -64,8 +64,8 @@ # Install pak echo "::group::Install pak" if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi - $SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' - $SUDO R -q -e 'install.packages("pak", lib = Sys.getenv("R_LIB_FOR_PAK"), repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' + #$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' + $SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' echo "::endgroup::" shell: bash From 5b948447fa7ee61688c92b91b3d7d5fb4a960457 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:08:08 +0200 Subject: [PATCH 17/33] . --- .github/workflows/R-CMD-check-versions.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 2dd7c67..e42647a 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -56,7 +56,7 @@ R.Version()$arch )) cat("::endgroup::\n") - shell: Rscript {0} + shell: Rscript {0} - name: Install pak (Unix + CRAN snapshot) if: runner.os != 'Windows' && matrix.config.date != 'latest' @@ -67,7 +67,7 @@ #$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' $SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' echo "::endgroup::" - shell: bash + shell: bash # Install package dependencies (if a specific date) From 85770bb832ca538200a1f7480170a7914bc35c07 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:08:57 +0200 Subject: [PATCH 18/33] . --- .github/workflows/R-CMD-check-versions.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index e42647a..b761a2d 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -56,7 +56,7 @@ R.Version()$arch )) cat("::endgroup::\n") - shell: Rscript {0} + shell: Rscript {0} - name: Install pak (Unix + CRAN snapshot) if: runner.os != 'Windows' && matrix.config.date != 'latest' @@ -67,7 +67,7 @@ #$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' $SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' echo "::endgroup::" - shell: bash + shell: bash # Install package dependencies (if a specific date) From 58afca7ecf744e9ae0b6f9e4d2d1a36583bb5ec8 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:09:54 +0200 Subject: [PATCH 19/33] . --- .github/workflows/R-CMD-check-versions.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index b761a2d..c1aee15 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -35,12 +35,6 @@ r-version: ${{ matrix.config.r }} use-public-rspm: false - # - name: Install curl () - # if: matrix.os == 'ubuntu-latest' && matrix.config.date != 'latest' - # run: | - # sudo apt install libcurl4-openssl-dev - - - name: Install pak (Windows + CRAN snapshot) if: runner.os == 'Windows' && matrix.config.date != 'latest' run: | From 355b14e974bbe8de49749e158b12fa2a0f6cee2b Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:48:38 +0200 Subject: [PATCH 20/33] custom R dependency loader --- .github/workflows/R-CMD-check-versions.yaml | 111 ++++++++++++-------- 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index c1aee15..d144ee6 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -35,57 +35,86 @@ r-version: ${{ matrix.config.r }} use-public-rspm: false - - name: Install pak (Windows + CRAN snapshot) - if: runner.os == 'Windows' && matrix.config.date != 'latest' + - name: Determine the CRAN image to use + id: cran-image run: | - # Install pak - cat("::group::Install pak\n") - #lib <- Sys.getenv("R_LIB_FOR_PAK") - #dir.create(lib, showWarnings = FALSE, recursive = TRUE) - install.packages("pak", repos = sprintf( - "https://r-lib.github.io/p/pak/%s/%s/%s/%s", - "stable", - .Platform$pkgType, - R.Version()$os, - R.Version()$arch - )) - cat("::endgroup::\n") - shell: Rscript {0} - - - name: Install pak (Unix + CRAN snapshot) - if: runner.os != 'Windows' && matrix.config.date != 'latest' + if ("${{ matrix.config.date }}" == "latest") { + echo "::set-output name=image::https://packagemanager.posit.co/cran" + } else { + echo "::set-output name=image::https://packagemanager.posit.co/cran/${{ matrix.config.date }}" + } + shell: bash + + - name: Debug image run: | - # Install pak - echo "::group::Install pak" - if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi - #$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' - $SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' - echo "::endgroup::" + echo ${{ steps.cran-image.outputs.image }} shell: bash + - uses: ./.github/actions/setup-r-dependencies.yaml + with: + cache: true + dependency_repo: ${{ steps.cran-image.outputs.image }} + working-directory: ${{ github.workspace }} + extra-packages: any::rcmdcheck + - # Install package dependencies (if a specific date) - - name: Install dependencies ${{ matrix.config.date }} (CRAN snapshot) - if: matrix.config.date != 'latest' - run: | - options( - repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") - ) + # - name: Install curl + # if: matrix.os == 'ubuntu-latest' && matrix.config.date != 'latest' + # run: | + # sudo apt install libcurl4-openssl-dev - install.packages(c("rcmdcheck", "devtools"), Ncpus = parallel::detectCores()-1) + # - name: Install pak (Windows + CRAN snapshot) + # if: runner.os == 'Windows' && matrix.config.date != 'latest' + # run: | + # # Install pak + # cat("::group::Install pak\n") + # #lib <- Sys.getenv("R_LIB_FOR_PAK") + # #dir.create(lib, showWarnings = FALSE, recursive = TRUE) + # install.packages("pak", repos = sprintf( + # "https://r-lib.github.io/p/pak/%s/%s/%s/%s", + # "stable", + # .Platform$pkgType, + # R.Version()$os, + # R.Version()$arch + # )) + # cat("::endgroup::\n") + # shell: Rscript {0} + + # - name: Install pak (Unix + CRAN snapshot) + # if: runner.os != 'Windows' && matrix.config.date != 'latest' + # run: | + # # Install pak + # echo "::group::Install pak" + # if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi + # #$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' + # $SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' + # echo "::endgroup::" + # shell: bash - pak::pkg_install(".", dependencies = TRUE, upgrade = TRUE) - #devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) + # # Install package dependencies (if a specific date) + # - name: Install dependencies ${{ matrix.config.date }} (CRAN snapshot) + # if: matrix.config.date != 'latest' + # run: | + # options( + # repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") + # ) - shell: Rscript {0} + # #install.packages(c("rcmdcheck", "devtools"), Ncpus = parallel::detectCores()-1) - # Install package dependencies (if lastest) - - uses: r-lib/actions/setup-r-dependencies@v2 - if: matrix.config.date == 'latest' - with: - extra-packages: any::rcmdcheck - needs: check + # pak::pkg_install(".", dependencies = TRUE, upgrade = TRUE) + + # #devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) + + # shell: Rscript {0} + + # # Install package dependencies (if lastest) + # - name: Install dependencies (CRAN latest) + # if: matrix.config.date == 'latest' + # uses: r-lib/actions/setup-r-dependencies@v2 + # with: + # extra-packages: any::rcmdcheck + # needs: check - name: Session info From 63dc36b034d97d7e22d5b07abfc57139b933ca15 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:51:46 +0200 Subject: [PATCH 21/33] . --- .github/workflows/R-CMD-check-versions.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index d144ee6..f3c101d 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -38,11 +38,11 @@ - name: Determine the CRAN image to use id: cran-image run: | - if ("${{ matrix.config.date }}" == "latest") { + if [ "${{ matrix.config.date }}" == "latest" ]; then echo "::set-output name=image::https://packagemanager.posit.co/cran" - } else { + else echo "::set-output name=image::https://packagemanager.posit.co/cran/${{ matrix.config.date }}" - } + fi shell: bash - name: Debug image @@ -50,7 +50,8 @@ echo ${{ steps.cran-image.outputs.image }} shell: bash - - uses: ./.github/actions/setup-r-dependencies.yaml + - name: Install R dependencies (custom) + uses: ./.github/actions/setup-r-dependencies.yaml with: cache: true dependency_repo: ${{ steps.cran-image.outputs.image }} From 659ea8461d73454a32a68e0c8131a5f76df91883 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 13:56:05 +0200 Subject: [PATCH 22/33] added custom R install --- .github/actions/setup-r-dependencies.yaml | 220 ++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 .github/actions/setup-r-dependencies.yaml diff --git a/.github/actions/setup-r-dependencies.yaml b/.github/actions/setup-r-dependencies.yaml new file mode 100644 index 0000000..312b140 --- /dev/null +++ b/.github/actions/setup-r-dependencies.yaml @@ -0,0 +1,220 @@ +name: 'setup-r-dependencies' +description: 'Action to setup installation tools and install R dependencies' +author: 'Jim Hester (modified by Henrik Spiegelhauer)' +inputs: + cache: + description: 'A boolean value indicating whether packages should be cached from one to the other' + required: true + default: true + cache-version: + description: 'The version of the cache, change this from the default (1) to start over with a fresh cache. Ignored if cache: false' + required: true + default: 1 + extra-packages: + description: 'Any extra packages to install outside of the packages listed in the dependencies' + needs: + description: 'Any extra Config/Needs fields which need to be included when installing dependencies' + packages: + description: 'Which package(s) to install.' + default: 'deps::., any::sessioninfo' + pak-version: + description: 'Which pak version to use. Possible values are "stable", "rc" and "devel".' + default: 'stable' + working-directory: + description: 'Using the working-directory keyword, you can specify the working directory of where "pkg_deps" command searches for dependencies in the "DESCRIPTION" file.' + default: '.' + dependencies: + description: 'Types of dependencies to install. Must be an R expression. Note that it often needs to be quoted in YAML, see the README for details.' + default: '"all"' + dependency_repo: + description: 'Overwrite the default CRAN-like reposity' + default: 'NULL' + upgrade: + description: 'Whether to install the latest available versions of the dependencies. Must be an R expression. See the README for details if you need quoting.' + default: 'FALSE' + lockfile-create-lib: + description: 'The package library to consider when creating the pak lockfile. This is passed to the `lib` argument of `pak::lockfile_create()`. Defaults to an empty library, for reproducibility. Must be an R expression. Note that it often needs to be quoted in YAML, see the README for details.' + default: 'NULL' + install-pandoc: + description: 'Whether to install pandoc. By default it is installed if it is not on the PATH and the local package suggests or depends on the rmarkdown package.' + pandoc-version: + description: 'Pandoc version to install.' + default: '3.1.11' +runs: + using: "composite" + steps: + - name: Set site library path + run: | + # Set site library path + cat("::group::Set site library path\n") + if (Sys.getenv("RENV_PROJECT") != "") { + message("renv project detected, no need to set R_LIBS_SITE") + cat(sprintf("R_LIB_FOR_PAK=%s\n", .libPaths()[1]), file = Sys.getenv("GITHUB_ENV"), append = TRUE) + q("no") + } + lib <- Sys.getenv("R_LIBS_SITE") + if (lib == "") { + lib <- file.path(dirname(.Library), "site-library") + cat(sprintf("R_LIBS_SITE=%s\n", lib), file = Sys.getenv("GITHUB_ENV"), append = TRUE) + cat(sprintf("R_LIB_FOR_PAK=%s\n", lib), file = Sys.getenv("GITHUB_ENV"), append = TRUE) + message("Setting R_LIBS_SITE to ", lib) + } else { + message("R_LIBS_SITE is already set to ", lib) + cat(sprintf("R_LIB_FOR_PAK=%s\n", strsplit(lib, .Platform$path.sep)[[1]][[1]]), file = Sys.getenv("GITHUB_ENV"), append = TRUE) + } + cat("::endgroup::\n") + shell: Rscript {0} + + - name: Install pak (Windows) + if: runner.os == 'Windows' + run: | + # Install pak + cat("::group::Install pak\n") + lib <- Sys.getenv("R_LIB_FOR_PAK") + dir.create(lib, showWarnings = FALSE, recursive = TRUE) + install.packages("pak", lib = lib, repos = sprintf( + "https://r-lib.github.io/p/pak/%s/%s/%s/%s", + "${{ inputs.pak-version }}", + .Platform$pkgType, + R.Version()$os, + R.Version()$arch + )) + cat("::endgroup::\n") + shell: Rscript {0} + + - name: Install pak (Unix) + if: runner.os != 'Windows' + run: | + # Install pak + echo "::group::Install pak" + if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi + $SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' + $SUDO R -q -e 'install.packages("pak", lib = Sys.getenv("R_LIB_FOR_PAK"), repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "${{ inputs.pak-version }}", .Platform$pkgType, R.Version()$os, R.Version()$arch))' + echo "::endgroup::" + shell: bash + + - name: Query dependencies + id: install + run: | + # Override the default CRAN-like repository + if ("${{ inputs.dependency_repo }}" != "NULL") { + options(repos = c(CRAN = "${{ inputs.dependency_repo }}")) + } + + # Dependency resolution + cat("::group::Dependency resolution\n") + cat("os-version=", sessionInfo()$running, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) + r_version <- + if (grepl("development", R.version.string)) { + pdf(tempfile()) + ge_ver <- attr(recordPlot(), "engineVersion") + dev.off() + paste0("R version ", getRversion(), " (ge:", ge_ver, "; iid:", .Internal(internalsID()), ")") + } else { + R.version.string + } + cat("r-version=", r_version, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) + needs <- sprintf("Config/Needs/%s", strsplit("${{ inputs.needs }}", "[[:space:],]+")[[1]]) + deps <- strsplit("${{ inputs.packages }}", "[[:space:],]+")[[1]] + extra_deps <- strsplit("${{ inputs.extra-packages }}", "[[:space:],]+")[[1]] + dir.create(".github", showWarnings=FALSE) + Sys.setenv("PKGCACHE_HTTP_VERSION" = "2") + library(pak, lib.loc = Sys.getenv("R_LIB_FOR_PAK")) + pak::lockfile_create( + c(deps, extra_deps), + lockfile = ".github/pkg.lock", + upgrade = (${{ inputs.upgrade }}), + dependencies = c(needs, (${{ inputs.dependencies }})), + lib = ${{ inputs.lockfile-create-lib }} + ) + cat("::endgroup::\n") + cat("::group::Show Lockfile\n") + writeLines(readLines(".github/pkg.lock")) + cat("::endgroup::\n") + shell: Rscript {0} + working-directory: ${{ inputs.working-directory }} + + - name: Restore R package cache + if: inputs.cache == 'true' + uses: actions/cache@v4 + with: + path: | + ${{ env.R_LIBS_USER }}/* + !${{ env.R_LIBS_USER }}/pak + key: ${{ format('{0}-{1}-{2}-{3}', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version, inputs.dependency_repo, hashFiles(format('{0}/.github/pkg.lock', inputs.working-directory ))) }} + restore-keys: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{inputs.cache-version }}- + + - name: Install dependencies + run: | + # Override the default CRAN-like repository + if ("${{ inputs.dependency_repo }}" != "NULL") { + options(repos = c(CRAN = "${{ inputs.dependency_repo }}")) + } + + # Install/Update packages + cat("::group::Install/update packages\n") + Sys.setenv("PKGCACHE_HTTP_VERSION" = "2") + library(pak, lib.loc = Sys.getenv("R_LIB_FOR_PAK")) + pak::lockfile_install(".github/pkg.lock") + ## Clean up lock file + unlink(".github/pkg.lock") + cat("::endgroup::\n") + shell: Rscript {0} + working-directory: ${{ inputs.working-directory }} + + - name: Check whether pandoc needs to be installed + id: check-pandoc + run: | + cat("::group::Check if package needs pandoc\n") + o <- '${{ inputs.install-pandoc }}' + if (! o %in% c('true', 'false')) { + if (Sys.which("pandoc") != "") { + o <- 'false' + } else if (file.exists("DESCRIPTION")) { + deptypes <- list(direct = "all", indirect = character()) + deps <- pak::pkg_deps(".", dependencies = deptypes) + if ("rmarkdown" %in% deps$package) { + o <- 'true' + } else { + o <- 'false' + } + } else { + o <- 'false' + } + } + cat("install=", o, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE) + cat("::endgroup::\n") + shell: Rscript {0} + working-directory: ${{ inputs.working-directory }} + + - name: Install pandoc if needed + if: ${{ steps.check-pandoc.outputs.install == 'true' }} + uses: r-lib/actions/setup-pandoc@v2 + with: + pandoc-version: ${{ inputs.pandoc-version }} + + - name: Session info + run: | + # Session info + cat("::group::Session info\n") + if (requireNamespace("sessioninfo", quietly = TRUE)) { + if (packageVersion("sessioninfo") >= "1.2.1") { + sessioninfo::session_info(pkgs = "installed", include_base = TRUE) + } else { + options(width = 200) + sessioninfo::session_info(rownames(installed.packages()), include_base=TRUE) + } + } else { + sessionInfo() + } + cat("::endgroup::\n") + shell: Rscript {0} + working-directory: ${{ inputs.working-directory }} + + - name: Don't use tar 1.30 from Rtools35 to store the cache + if: runner.os == 'Windows' + shell: bash + run: | + if command -v /c/Rtools/bin/tar && /c/Rtools/bin/tar --version | grep -q 'tar (GNU tar) 1.30' + then echo 'C:/Program Files/Git/usr/bin' >> $GITHUB_PATH + fi From dacee78e89ff34cc137276c3185651badd0d61ac Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 15:26:38 +0200 Subject: [PATCH 23/33] updated action check --- .../action.yaml} | 0 .github/workflows/R-CMD-check-versions.yaml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/actions/{setup-r-dependencies.yaml => setup-r-dependencies/action.yaml} (100%) diff --git a/.github/actions/setup-r-dependencies.yaml b/.github/actions/setup-r-dependencies/action.yaml similarity index 100% rename from .github/actions/setup-r-dependencies.yaml rename to .github/actions/setup-r-dependencies/action.yaml diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index f3c101d..b443b4e 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -51,7 +51,7 @@ shell: bash - name: Install R dependencies (custom) - uses: ./.github/actions/setup-r-dependencies.yaml + uses: ./.github/actions/setup-r-dependencies with: cache: true dependency_repo: ${{ steps.cran-image.outputs.image }} From 0bc95bca1a3c74a5a2585351cf1cab8ac64ddccd Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 15:41:07 +0200 Subject: [PATCH 24/33] . --- .github/workflows/R-CMD-check-versions.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index b443b4e..0781c73 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -39,9 +39,9 @@ id: cran-image run: | if [ "${{ matrix.config.date }}" == "latest" ]; then - echo "::set-output name=image::https://packagemanager.posit.co/cran" + echo "image=https://cloud.r-project.org" >> $GITHUB_OUTPUT else - echo "::set-output name=image::https://packagemanager.posit.co/cran/${{ matrix.config.date }}" + echo "image=https://packagemanager.posit.co/cran/${{ matrix.config.date }}" >> $GITHUB_OUTPUT fi shell: bash From 795e980e606c812b96c8a80cf82dbaafb5f6cf51 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 16:01:04 +0200 Subject: [PATCH 25/33] minor changes --- .../actions/setup-r-dependencies/action.yaml | 4 +- .github/workflows/R-CMD-check-versions.yaml | 60 ------------------- 2 files changed, 2 insertions(+), 62 deletions(-) diff --git a/.github/actions/setup-r-dependencies/action.yaml b/.github/actions/setup-r-dependencies/action.yaml index 312b140..65925c0 100644 --- a/.github/actions/setup-r-dependencies/action.yaml +++ b/.github/actions/setup-r-dependencies/action.yaml @@ -141,8 +141,8 @@ runs: path: | ${{ env.R_LIBS_USER }}/* !${{ env.R_LIBS_USER }}/pak - key: ${{ format('{0}-{1}-{2}-{3}', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version, inputs.dependency_repo, hashFiles(format('{0}/.github/pkg.lock', inputs.working-directory ))) }} - restore-keys: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{inputs.cache-version }}- + key: ${{ format('{0}-{1}-{2}-{3}-{5}', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version, inputs.dependency_repo, hashFiles(format('{0}/.github/pkg.lock', inputs.working-directory ))) }} + restore-keys: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{inputs.cache-version }}-${{inputs.dependency_repo }}- - name: Install dependencies run: | diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 0781c73..3a5ebff 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -57,66 +57,6 @@ dependency_repo: ${{ steps.cran-image.outputs.image }} working-directory: ${{ github.workspace }} extra-packages: any::rcmdcheck - - - # - name: Install curl - # if: matrix.os == 'ubuntu-latest' && matrix.config.date != 'latest' - # run: | - # sudo apt install libcurl4-openssl-dev - - # - name: Install pak (Windows + CRAN snapshot) - # if: runner.os == 'Windows' && matrix.config.date != 'latest' - # run: | - # # Install pak - # cat("::group::Install pak\n") - # #lib <- Sys.getenv("R_LIB_FOR_PAK") - # #dir.create(lib, showWarnings = FALSE, recursive = TRUE) - # install.packages("pak", repos = sprintf( - # "https://r-lib.github.io/p/pak/%s/%s/%s/%s", - # "stable", - # .Platform$pkgType, - # R.Version()$os, - # R.Version()$arch - # )) - # cat("::endgroup::\n") - # shell: Rscript {0} - - # - name: Install pak (Unix + CRAN snapshot) - # if: runner.os != 'Windows' && matrix.config.date != 'latest' - # run: | - # # Install pak - # echo "::group::Install pak" - # if which sudo >/dev/null; then SUDO="sudo -E --preserve-env=PATH env"; else SUDO=""; fi - # #$SUDO R -q -e 'dir.create(Sys.getenv("R_LIB_FOR_PAK"), recursive = TRUE, showWarnings = FALSE)' - # $SUDO R -q -e 'install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/%s/%s/%s/%s", "stable", .Platform$pkgType, R.Version()$os, R.Version()$arch))' - # echo "::endgroup::" - # shell: bash - - - # # Install package dependencies (if a specific date) - # - name: Install dependencies ${{ matrix.config.date }} (CRAN snapshot) - # if: matrix.config.date != 'latest' - # run: | - # options( - # repos = c(CRAN = "https://packagemanager.posit.co/cran/${{ matrix.config.date }}") - # ) - - # #install.packages(c("rcmdcheck", "devtools"), Ncpus = parallel::detectCores()-1) - - # pak::pkg_install(".", dependencies = TRUE, upgrade = TRUE) - - # #devtools::install(".", dependencies = TRUE, upgrade = TRUE, Ncpus = parallel::detectCores()-1) - - # shell: Rscript {0} - - # # Install package dependencies (if lastest) - # - name: Install dependencies (CRAN latest) - # if: matrix.config.date == 'latest' - # uses: r-lib/actions/setup-r-dependencies@v2 - # with: - # extra-packages: any::rcmdcheck - # needs: check - - name: Session info run: | From 6da1514b1024330868d8ba8be79bf51fe5c8f774 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 16:14:21 +0200 Subject: [PATCH 26/33] Added badges to rmd --- README.Rmd | 11 +++++++++++ README.md | 14 +++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.Rmd b/README.Rmd index 40899b3..c34aaab 100644 --- a/README.Rmd +++ b/README.Rmd @@ -3,6 +3,17 @@ always_allow_html: true --- + + +[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)] +(https://app.codecov.io/gh/hta-pharma/ramnog?branch=main) + +[![Check Package ๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) +[![Release Package ๐Ÿš€](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml) + + + + # ramnog ramnog website # R packages for AMNOG analyses ramnog website diff --git a/README.md b/README.md index 9a7c246..4e2702e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,16 @@ + + +\[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)\] +() + +[![Check Package +๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) +[![Release Package +๐Ÿš€](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml) + + + # ramnog ramnog website # R packages for AMNOG analyses ramnog website @@ -13,7 +25,7 @@ To get started, check out the [Quick Start](articles/ramnog.html) guide # Packages - +
From e01ee4eb1f22da64056ba50e6b5ea1848c70b555 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 16:25:56 +0200 Subject: [PATCH 27/33] Cleanup --- .github/actions/setup-r-dependencies/action.yaml | 4 ++-- .github/workflows/R-CMD-check-versions.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-r-dependencies/action.yaml b/.github/actions/setup-r-dependencies/action.yaml index 65925c0..30dee9e 100644 --- a/.github/actions/setup-r-dependencies/action.yaml +++ b/.github/actions/setup-r-dependencies/action.yaml @@ -141,8 +141,8 @@ runs: path: | ${{ env.R_LIBS_USER }}/* !${{ env.R_LIBS_USER }}/pak - key: ${{ format('{0}-{1}-{2}-{3}-{5}', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version, inputs.dependency_repo, hashFiles(format('{0}/.github/pkg.lock', inputs.working-directory ))) }} - restore-keys: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{inputs.cache-version }}-${{inputs.dependency_repo }}- + key: ${{ format('{0}-{1}-{2}-{3}', steps.install.outputs.os-version, steps.install.outputs.r-version, inputs.cache-version, inputs.dependency_repo, hashFiles(format('{0}/.github/pkg.lock', inputs.working-directory ))) }} + restore-keys: ${{ steps.install.outputs.os-version }}-${{ steps.install.outputs.r-version }}-${{inputs.cache-version }}-${{inputs.dependency_repo }} - name: Install dependencies run: | diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 3a5ebff..f89b50d 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -15,8 +15,8 @@ fail-fast: false matrix: os: - #- macos-latest - #- windows-latest + - macos-latest + - windows-latest - ubuntu-latest config: - date: 'latest' From bc54d8e61154bbde1d1b8d4d59edbd7951a13c32 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 16:27:18 +0200 Subject: [PATCH 28/33] fixed badge --- README.Rmd | 5 +---- README.md | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/README.Rmd b/README.Rmd index c34aaab..588bdd4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -5,13 +5,10 @@ -[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)] -(https://app.codecov.io/gh/hta-pharma/ramnog?branch=main) - +[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)](https://app.codecov.io/gh/hta-pharma/ramnog?branch=main) [![Check Package ๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) [![Release Package ๐Ÿš€](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml) - # ramnog ramnog website diff --git a/README.md b/README.md index 4e2702e..f320f16 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ -\[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)\] -() - +[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)](https://app.codecov.io/gh/hta-pharma/ramnog?branch=main) [![Check Package ๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) [![Release Package From 057461d0ad6627e73ae1545ff49f509deccd8930 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Tue, 16 Apr 2024 16:45:59 +0200 Subject: [PATCH 29/33] Fixed badges --- README.Rmd | 9 +++++---- README.md | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.Rmd b/README.Rmd index 588bdd4..f674b87 100644 --- a/README.Rmd +++ b/README.Rmd @@ -5,10 +5,11 @@ -[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)](https://app.codecov.io/gh/hta-pharma/ramnog?branch=main) -[![Check Package ๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) -[![Release Package ๐Ÿš€](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml) - +[![Check Package +๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) +[![Release Package +๐Ÿš€](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml) +[![codecov.io](https://img.shields.io/codecov/c/gh/hta-pharma/ramnog?style=plastic&label=codecov.io)]((https://app.codecov.io/github/hta-pharma/ramnog?branch=main)) # ramnog ramnog website diff --git a/README.md b/README.md index f320f16..42d5fa3 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ -[![codecov.io](https://app.codecov.io/gh/hta-pharma/ramnog/coverage.svg?branch=main)](https://app.codecov.io/gh/hta-pharma/ramnog?branch=main) [![Check Package ๐Ÿ“ฆ](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Check-package.yaml) [![Release Package ๐Ÿš€](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml/badge.svg)](https://github.com/hta-pharma/ramnog/actions/workflows/Release-package.yaml) - +[![codecov.io](https://img.shields.io/codecov/c/gh/hta-pharma/ramnog?style=plastic&label=codecov.io)]((https://app.codecov.io/github/hta-pharma/ramnog?branch=main)) # ramnog ramnog website From 38496260f0bb649f5c90144d64163082d5d811c7 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Thu, 18 Apr 2024 07:52:24 +0200 Subject: [PATCH 30/33] Removed KableExtra version minimum req --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 279f647..49e1d1f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,7 @@ Suggests: usethis, rmarkdown, testthat (>= 3.0.0), - kableExtra (>= 1.4), + kableExtra, testr, tidyr, pharmaverseadam From 22fc2f4102e5fdd70862589315985f3ee4831761 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Thu, 18 Apr 2024 08:10:49 +0200 Subject: [PATCH 31/33] removed output:TOC=TRUE from ep_overview to overcome bug in KableExtra<1.4 --- vignettes/ep_overview.Rmd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vignettes/ep_overview.Rmd b/vignettes/ep_overview.Rmd index f2e5726..5a46c3c 100644 --- a/vignettes/ep_overview.Rmd +++ b/vignettes/ep_overview.Rmd @@ -1,8 +1,6 @@ --- title: "Endpoint Specification" -output: - rmarkdown::html_vignette: - toc: true +output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Endpoint Specification} %\VignetteEncoding{UTF-8} From 8f6c94f114f0424f880190f093a2f8e30b979fdf Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Thu, 18 Apr 2024 12:02:03 +0200 Subject: [PATCH 32/33] Changed action reference --- .github/workflows/R-CMD-check-versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index f89b50d..6158324 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -51,7 +51,7 @@ shell: bash - name: Install R dependencies (custom) - uses: ./.github/actions/setup-r-dependencies + uses: hta-pharma/ramnog/setup-r-dependencies@main with: cache: true dependency_repo: ${{ steps.cran-image.outputs.image }} From 52c2b64ca0876b5c67f5014ec688e529a2bee3d2 Mon Sep 17 00:00:00 2001 From: "Henrik Sparre Spiegelhauer (HSPU)" Date: Thu, 18 Apr 2024 12:04:57 +0200 Subject: [PATCH 33/33] . --- .github/workflows/R-CMD-check-versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-check-versions.yaml b/.github/workflows/R-CMD-check-versions.yaml index 6158324..4c552ae 100644 --- a/.github/workflows/R-CMD-check-versions.yaml +++ b/.github/workflows/R-CMD-check-versions.yaml @@ -51,7 +51,7 @@ shell: bash - name: Install R dependencies (custom) - uses: hta-pharma/ramnog/setup-r-dependencies@main + uses: hta-pharma/ramnog/.github/actions/setup-r-dependencies@main with: cache: true dependency_repo: ${{ steps.cran-image.outputs.image }}