Skip to content

Commit c987733

Browse files
committed
Add R-hub workflow
1 parent 86de558 commit c987733

File tree

2 files changed

+136
-24
lines changed

2 files changed

+136
-24
lines changed

.github/workflows/build.yaml

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
on: [push, pull_request]
1+
on: [push, pull_request, workflow_dispatch]
22

33
name: build
44

@@ -20,22 +20,33 @@ jobs:
2020
- { os: macOS-latest, r: 'release' }
2121
- { os: windows-latest, r: 'release' }
2222
- { os: windows-latest, r: 'oldrel' }
23-
- { os: ubuntu-20.04, r: 'devel', http-user-agent: 'release' }
24-
- { os: ubuntu-20.04, r: 'release', release: true }
25-
- { os: ubuntu-20.04, r: 'oldrel-1' }
26-
- { os: ubuntu-20.04, r: 'oldrel-2' }
27-
- { os: ubuntu-20.04, r: 'oldrel-3' }
28-
- { os: ubuntu-20.04, r: 'oldrel-4' }
23+
- { os: ubuntu-22.04, r: 'devel', http-user-agent: 'release' }
24+
- { os: ubuntu-22.04, r: 'release', release: true }
25+
- { os: ubuntu-22.04, r: 'oldrel-1' }
26+
- { os: ubuntu-22.04, r: 'oldrel-2' }
27+
- { os: ubuntu-22.04, r: 'oldrel-3' }
28+
- { os: ubuntu-22.04, r: 'oldrel-4' }
2929

3030
env:
3131
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3232
R_KEEP_PKG_SOURCE: yes
3333

3434
steps:
35-
- uses: actions/checkout@v3
35+
- uses: actions/checkout@v4
3636

3737
- uses: r-lib/actions/setup-pandoc@v2
3838

39+
- name: Configure pak and setup-r action to use manylinux_2_28
40+
if: startsWith(matrix.config.os, 'ubuntu') && matrix.config.r != 'devel'
41+
run: |
42+
# Override PPM repo and do not autodetect the distro (setup-r action env var)
43+
echo "RSPM=https://p3m.dev/cran/__linux__/manylinux_2_28/latest" >> $GITHUB_ENV
44+
# Configure pak to use the same PPM repo when checking for the latest packages
45+
echo "PKG_CRAN_MIRROR=${RSPM}" >> $GITHUB_ENV
46+
# Disable automatic system requirements installation since it is unnecessary (pak env var)
47+
# Temporarily reenabled to build terra from source
48+
# echo "PKG_SYSREQS=FALSE" >> $GITHUB_ENV
49+
3950
- uses: r-lib/actions/setup-r@v2
4051
with:
4152
r-version: ${{ matrix.config.r }}
@@ -44,10 +55,10 @@ jobs:
4455

4556
- uses: r-lib/actions/setup-r-dependencies@v2
4657
with:
47-
# Temporarily install htmlwidgets >= 1.6.0 for tests
58+
# leaflet needs terra, which does not support R <= 4.0
4859
extra-packages: |
4960
any::rcmdcheck
50-
htmlwidgets?source
61+
leaflet=?ignore-before-r=4.1.0
5162
5263
- uses: r-lib/actions/check-r-package@v2
5364

@@ -60,7 +71,7 @@ jobs:
6071
if: matrix.config.release
6172
uses: r-lib/actions/setup-r-dependencies@v2
6273
with:
63-
extra-packages: any::pkgdown, local::.
74+
extra-packages: local::., [email protected]
6475

6576
- name: Build pkgdown site
6677
if: matrix.config.release
@@ -79,9 +90,20 @@ jobs:
7990
echo "NETLIFY_ALIAS=${version_alias}-${github_sha_short}" >> $GITHUB_ENV
8091
fi
8192
93+
- name: Rebuild pkgdown site search index for GitHub Pages
94+
if: matrix.config.release && github.ref == 'refs/heads/main'
95+
run: Rscript pkgdown/build-search-gh.R
96+
97+
- name: Deploy pkgdown site to GitHub Pages
98+
if: matrix.config.release && github.ref == 'refs/heads/main'
99+
uses: JamesIves/[email protected]
100+
with:
101+
branch: gh-pages
102+
folder: docs
103+
82104
- name: Deploy pkgdown site to Netlify
83105
if: matrix.config.release
84-
uses: nwtgck/actions-netlify@v1.2
106+
uses: nwtgck/actions-netlify@v3.0
85107
with:
86108
publish-dir: './docs'
87109
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -92,26 +114,21 @@ jobs:
92114
env:
93115
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
94116
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
95-
timeout-minutes: 1
96-
97-
- name: Deploy pkgdown site to GitHub Pages
98-
if: matrix.config.release && github.ref == 'refs/heads/main'
99-
uses: JamesIves/[email protected]
100-
with:
101-
branch: gh-pages
102-
folder: docs
117+
timeout-minutes: 5
118+
# Work around Netlify error of "Error: Unprocessable Entity" even though the deployment succeeds
119+
continue-on-error: true
103120

104121
build-node:
105122
runs-on: ubuntu-latest
106123

107124
name: Node.js
108125

109126
steps:
110-
- uses: actions/checkout@v3
127+
- uses: actions/checkout@v4
111128

112-
- uses: actions/setup-node@v3
129+
- uses: actions/setup-node@v4
113130
with:
114-
node-version: '16'
131+
node-version: '22'
115132
cache: 'npm'
116133

117134
- name: Install dependencies
@@ -124,4 +141,4 @@ jobs:
124141
run: npm run lint
125142

126143
- name: Upload coverage to Codecov
127-
uses: codecov/codecov-action@v3
144+
uses: codecov/codecov-action@v4

.github/workflows/rhub.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
2+
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
3+
# You can update this file to a newer version using the rhub2 package:
4+
#
5+
# rhub::rhub_setup()
6+
#
7+
# It is unlikely that you need to modify this file manually.
8+
9+
name: R-hub
10+
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"
11+
12+
on:
13+
workflow_dispatch:
14+
inputs:
15+
config:
16+
description: 'A comma separated list of R-hub platforms to use.'
17+
type: string
18+
default: 'linux,windows,macos'
19+
name:
20+
description: 'Run name. You can leave this empty now.'
21+
type: string
22+
id:
23+
description: 'Unique ID. You can leave this empty now.'
24+
type: string
25+
26+
jobs:
27+
28+
setup:
29+
runs-on: ubuntu-latest
30+
outputs:
31+
containers: ${{ steps.rhub-setup.outputs.containers }}
32+
platforms: ${{ steps.rhub-setup.outputs.platforms }}
33+
34+
steps:
35+
# NO NEED TO CHECKOUT HERE
36+
- uses: r-hub/actions/setup@v1
37+
with:
38+
config: ${{ github.event.inputs.config }}
39+
id: rhub-setup
40+
41+
linux-containers:
42+
needs: setup
43+
if: ${{ needs.setup.outputs.containers != '[]' }}
44+
runs-on: ubuntu-latest
45+
name: ${{ matrix.config.label }}
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
config: ${{ fromJson(needs.setup.outputs.containers) }}
50+
container:
51+
image: ${{ matrix.config.container }}
52+
53+
steps:
54+
- uses: r-hub/actions/checkout@v1
55+
- uses: r-hub/actions/platform-info@v1
56+
with:
57+
token: ${{ secrets.RHUB_TOKEN }}
58+
job-config: ${{ matrix.config.job-config }}
59+
- uses: r-hub/actions/setup-deps@v1
60+
with:
61+
token: ${{ secrets.RHUB_TOKEN }}
62+
job-config: ${{ matrix.config.job-config }}
63+
- uses: r-hub/actions/run-check@v1
64+
with:
65+
token: ${{ secrets.RHUB_TOKEN }}
66+
job-config: ${{ matrix.config.job-config }}
67+
68+
other-platforms:
69+
needs: setup
70+
if: ${{ needs.setup.outputs.platforms != '[]' }}
71+
runs-on: ${{ matrix.config.os }}
72+
name: ${{ matrix.config.label }}
73+
strategy:
74+
fail-fast: false
75+
matrix:
76+
config: ${{ fromJson(needs.setup.outputs.platforms) }}
77+
78+
steps:
79+
- uses: r-hub/actions/checkout@v1
80+
- uses: r-hub/actions/setup-r@v1
81+
with:
82+
job-config: ${{ matrix.config.job-config }}
83+
token: ${{ secrets.RHUB_TOKEN }}
84+
- uses: r-hub/actions/platform-info@v1
85+
with:
86+
token: ${{ secrets.RHUB_TOKEN }}
87+
job-config: ${{ matrix.config.job-config }}
88+
- uses: r-hub/actions/setup-deps@v1
89+
with:
90+
job-config: ${{ matrix.config.job-config }}
91+
token: ${{ secrets.RHUB_TOKEN }}
92+
- uses: r-hub/actions/run-check@v1
93+
with:
94+
job-config: ${{ matrix.config.job-config }}
95+
token: ${{ secrets.RHUB_TOKEN }}

0 commit comments

Comments
 (0)