Skip to content

Commit 3d8f753

Browse files
walkowifcicdguypawelru
authored
feat: add r-hub workflow (#232)
insightsengineering/idr-tasks#781 --------- Signed-off-by: walkowif <[email protected]> Co-authored-by: cicdguy <[email protected]> Co-authored-by: Pawel Rucki <[email protected]>
1 parent abf5405 commit 3d8f753

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed

.github/workflows/rhub.yaml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# This workflow is based on R-hub's generic GitHub Actions workflow file.
2+
# Its canonical location is at
3+
# https://github.com/r-hub/actions/blob/main/workflows/rhub.yaml
4+
5+
name: R-hub 🌐
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
config:
11+
description: 'A comma separated list of R-hub platforms to use.'
12+
type: string
13+
# These platforms correspond roughly to CRAN package checks.
14+
# More information: https://github.com/insightsengineering/idr-tasks/issues/781
15+
# All supported R-hub platforms can be viewed by running: rhub::rhub_platforms()
16+
# Container-based platforms (as opposed to VM-based Windows and macOS platforms)
17+
# can be also viewed here: https://r-hub.github.io/containers/containers.html
18+
# gcc14 = r-devel-linux-x86_64-fedora-gcc
19+
default: >-
20+
r-devel-linux-x86_64-debian-clang,
21+
r-devel-linux-x86_64-debian-gcc,
22+
gcc14,
23+
r-devel-windows-x86_64,
24+
r-patched-linux-x86_64,
25+
r-release-linux-x86_64,
26+
r-release-macos-arm64,
27+
r-release-macos-x86_64,
28+
r-release-windows-x86_64,
29+
r-oldrel-macos-arm64,
30+
r-oldrel-macos-x86_64,
31+
r-oldrel-windows-x86_64,
32+
linux,
33+
gcc13,
34+
noSuggests,
35+
donttest
36+
lookup-refs:
37+
description: |
38+
List of package references to be used for the feature branch.
39+
Multiple entries in new lines or separated by commas.
40+
required: false
41+
default: ""
42+
type: string
43+
44+
concurrency:
45+
group: r-hub-${{ github.event.pull_request.number || github.ref }}
46+
cancel-in-progress: true
47+
48+
jobs:
49+
setup:
50+
runs-on: ubuntu-latest
51+
outputs:
52+
containers: ${{ steps.rhub-setup.outputs.containers }}
53+
platforms: ${{ steps.rhub-setup.outputs.platforms }}
54+
55+
steps:
56+
- uses: r-hub/actions/setup@v1
57+
with:
58+
config: ${{ inputs.config }}
59+
id: rhub-setup
60+
61+
linux-containers:
62+
needs: setup
63+
if: ${{ needs.setup.outputs.containers != '[]' }}
64+
runs-on: ubuntu-latest
65+
name: ${{ matrix.config.label }}
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
config: ${{ fromJson(needs.setup.outputs.containers) }}
70+
container:
71+
image: ${{ matrix.config.container }}
72+
73+
steps:
74+
- uses: r-hub/actions/checkout@v1
75+
76+
- uses: r-hub/actions/platform-info@v1
77+
with:
78+
token: ${{ secrets.RHUB_TOKEN }}
79+
job-config: ${{ matrix.config.job-config }}
80+
81+
- name: Prepare DESCRIPTION file
82+
uses: insightsengineering/setup-r-dependencies@main
83+
with:
84+
lookup-refs: ${{ inputs.lookup-refs }}
85+
skip-install: true
86+
87+
- uses: r-hub/actions/setup-deps@v1
88+
with:
89+
token: ${{ secrets.RHUB_TOKEN }}
90+
job-config: ${{ matrix.config.job-config }}
91+
needs: DepsDev,DepsBranch
92+
93+
- uses: r-hub/actions/run-check@v1
94+
with:
95+
token: ${{ secrets.RHUB_TOKEN }}
96+
job-config: ${{ matrix.config.job-config }}
97+
98+
other-platforms:
99+
needs: setup
100+
if: ${{ needs.setup.outputs.platforms != '[]' }}
101+
runs-on: ${{ matrix.config.os }}
102+
name: ${{ matrix.config.label }}
103+
strategy:
104+
fail-fast: false
105+
matrix:
106+
config: ${{ fromJson(needs.setup.outputs.platforms) }}
107+
108+
steps:
109+
- uses: r-hub/actions/checkout@v1
110+
111+
- uses: r-hub/actions/setup-r@v1
112+
with:
113+
job-config: ${{ matrix.config.job-config }}
114+
token: ${{ secrets.RHUB_TOKEN }}
115+
116+
- uses: r-hub/actions/platform-info@v1
117+
with:
118+
token: ${{ secrets.RHUB_TOKEN }}
119+
job-config: ${{ matrix.config.job-config }}
120+
121+
- name: Setup R dependencies
122+
uses: insightsengineering/setup-r-dependencies@main
123+
with:
124+
lookup-refs: ${{ inputs.lookup-refs }}
125+
skip-install: true
126+
127+
- uses: r-hub/actions/setup-deps@v1
128+
with:
129+
job-config: ${{ matrix.config.job-config }}
130+
token: ${{ secrets.RHUB_TOKEN }}
131+
needs: DepsDev,DepsBranch
132+
133+
- uses: r-hub/actions/run-check@v1
134+
with:
135+
job-config: ${{ matrix.config.job-config }}
136+
token: ${{ secrets.RHUB_TOKEN }}

images/rhub-workflow.png

65.9 KB
Loading

workflows.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,9 @@ jobs:
237237
needs: release
238238
uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main
239239
```
240+
241+
## [`rhub.yaml`](./.github/workflows/rhub.yaml)
242+
243+
This is a workflow based on the [official R-hub workflow](https://github.com/r-hub/actions/blob/main/workflows/rhub.yaml) with the main goal being to `R CMD check` the package on different environments corresponding to the CRAN checks.
244+
245+
<img src="images/rhub-workflow.png" width="60%">

0 commit comments

Comments
 (0)