From 15b568de1b6d86c529eb83253c1953920676f4cb Mon Sep 17 00:00:00 2001 From: Christophe Dervieux Date: Mon, 10 Jun 2024 11:26:31 +0200 Subject: [PATCH] [gha] Allow to check quarto R code with a specific R package version --- .github/workflows/test-smokes-parallel.yml | 6 ++++++ .github/workflows/test-smokes.yml | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-smokes-parallel.yml b/.github/workflows/test-smokes-parallel.yml index 82e95b7d80..b9333f43c6 100644 --- a/.github/workflows/test-smokes-parallel.yml +++ b/.github/workflows/test-smokes-parallel.yml @@ -9,6 +9,11 @@ on: required: true default: 10 type: number + extra-r-packages: + description: "extra R package to install for the tests runs (like a dev version of one of the deps) - comma separated, passed to renv::install" + required: false + type: string + default: "" pull_request: branches: - main @@ -82,3 +87,4 @@ jobs: uses: ./.github/workflows/test-smokes.yml with: buckets: ${{ matrix.buckets.files }} + extra-r-packages: ${{ inputs.extra-r-packages }} diff --git a/.github/workflows/test-smokes.yml b/.github/workflows/test-smokes.yml index 5a9eb9bf41..cabab09468 100644 --- a/.github/workflows/test-smokes.yml +++ b/.github/workflows/test-smokes.yml @@ -13,6 +13,11 @@ on: required: false type: boolean default: false + extra-r-packages: + description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install" + required: false + type: string + default: "" workflow_dispatch: inputs: buckets: @@ -25,12 +30,17 @@ on: required: false type: boolean default: false + extra-r-packages: + description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install" + required: false + type: string + default: "" schedule: - cron: "0 6 * * *" jobs: run-smokes: - name: Run smoke (${{ matrix.os }})${{ matrix.time-test && ' with timed file' || ''}} + name: Run smoke (${{ matrix.os }})${{ matrix.time-test && ' with timed file' || ''}}${{ inputs.extra-r-packages && ' - with some extra R packages'|| ''}} strategy: fail-fast: false matrix: @@ -101,7 +111,7 @@ jobs: key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2-${{ hashFiles('tests/renv.lock') }} restore-keys: | ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-renv-2- - save-always: true + save-always: ${{ inputs.extra-r-packages == '' }} # don't save cache if we have extra R packages - name: Install missing system deps if: runner.os == 'Linux' @@ -121,6 +131,10 @@ jobs: # Use r-universe to avoid github api calls try(install.packages('knitr', repos = 'https://yihui.r-universe.dev')) try(install.packages('rmarkdown', repos = 'https://rstudio.r-universe.dev')) + if ('${{ inputs.extra-r-packages }}' != '') { + cat(sprintf("::notice::Running with the following extra R packages for pak: %s\n", "${{ inputs.extra-r-packages }}")) + renv::install(strsplit("${{ inputs.extra-r-packages }}", split = ",")[[1]]) + } shell: Rscript {0} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}