Skip to content

Commit

Permalink
[gha] Allowing to trigger workflow with extra packages to test (#2349)
Browse files Browse the repository at this point in the history
This allows for example to test dev version at rlib/evaluate for knitr 

```
gh workflow run knitr-examples.yaml -f extra-packages=github::r-lib/evaluate
gh workflow run R-CMD-check.yaml  -f extra-packages=github::r-lib/evaluate
```
  • Loading branch information
cderv authored Jun 6, 2024
1 parent 1db544b commit e1edd34
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ on:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
inputs:
extra-packages:
description: 'extra package to install for the runs (like a dev version of one of the deps) - comma separated'
required: false
type: string

name: R-CMD-check

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

name: ${{ matrix.config.os }} (${{ matrix.config.r }})${{ github.event.inputs.extra-packages && ' - with some extra packages'|| ''}}
strategy:
fail-fast: false
matrix:
Expand All @@ -39,7 +48,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -54,13 +63,19 @@ jobs:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX

- if: github.event.inputs.extra-packages
run: |
echo "::notice::Running with the following extra packages for pak: ${{ github.event.inputs.extra-packages }}"
shell: bash

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::rcmdcheck
gridSVG=?ignore-before-r=4.0.0
targets=?ignore-before-r=4.0.0
JuliaCall=?ignore-before-r=4.0.0
extra-packages: >
any::rcmdcheck,
gridSVG=?ignore-before-r=4.0.0,
targets=?ignore-before-r=4.0.0,
JuliaCall=?ignore-before-r=4.0.0,
${{ github.event.inputs.extra-packages }}
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/knitr-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@ on:
- main
- master
workflow_dispatch:
inputs:
extra-packages:
description: 'extra package to install for the runs (like a dev version of one of the deps) - comma separated'
required: false
type: string


name: Check knitr examples

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
run-examples:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})
name: ${{ matrix.config.os }} (${{ matrix.config.r }})${{ github.event.inputs.extra-packages && ' - with some extra packages'|| ''}}

strategy:
fail-fast: false
Expand All @@ -30,7 +40,7 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand All @@ -44,10 +54,18 @@ jobs:
# install full prebuilt version
TINYTEX_INSTALLER: TinyTeX

- name: Is this workflow running with extra package
if: github.event.inputs.extra-packages
run: |
echo "::notice::Running with the following extra packages for pak: ${{ github.event.inputs.extra-packages }}"
shell: bash

- uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: deps::.
extra-packages: XML
extra-packages: >
XML,
${{ github.event.inputs.extra-packages }}
- name: Retrieve knitr-examples
# On PR, it will checkout same branch if it exists there
Expand Down

0 comments on commit e1edd34

Please sign in to comment.