You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a7198d0
Browse filesBrowse the repository at this point in the historyBrowse files
[backport] Replace renv with a rig project for the R test environment (#15318)
* Replace renv with a rig project for the R test environment
Setting up the test R environment in several worktrees at once could
hang for tens of minutes: concurrent cold renv::restore() runs sharing
one renv cache stalled for over 28 minutes, and every R started under
tests/ paid for the renv autoloader. The tests/ R environment is now a
rig project, so rig proj sync installs packages from a lock file without
running R or renv's shared lock.
- Replace DESCRIPTION, renv.lock and renv/ with tests/rproj.toml and
tests/rproj.lock, solved for Windows, macOS arm64, Linux x86_64 and
source
- Point QUARTO_R at tests/.rvenv/bin in run-tests and drop the
per-fixture .Rprofile that activated renv
- Make configure-test-env run rig proj sync, then install dev rmarkdown
and knitr into the project library
- Install a pinned rig in CI and sync with --locked so a stale lock
fails the job; remove the renv cache and renv::status() steps
(cherry picked from commit ccc1cf6)
* Install R before syncing in configure-test-env
In rig's admin mode, rig proj sync installs a missing R by re-running
the whole command elevated, so the project library under tests/.rvenv
ends up owned by root (r-lib/rig#503, fixed in rig's development
version but not in 0.11.1). Setting up the test environment on a
machine without the locked R then leaves a library the later dev
rmarkdown and knitr installs cannot write to, and they fall back to
the locked versions.
Install R with rig add first, which does nothing when that version is
already installed, then run rig proj sync --no-install-r as the calling
user. This is the sequence the CI workflow already uses. Both
configure-test-env.sh and configure-test-env.ps1 get it, since rig
elevates the same way on Windows.
Verified the already-installed path on Windows with both scripts. The
missing-R path was not exercised.
(cherry picked from commit 9777eda)
Copy file name to clipboardExpand all lines: .github/workflows/test-ff-matrix.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ on:
4
4
workflow_call:
5
5
inputs:
6
6
extra-r-packages:
7
-
description: "Comma-separated R packages to pass to renv::install"
7
+
description: "Comma-separated R packages to pass to rig pkg install (see test-smokes.yml)"
8
8
required: false
9
9
type: string
10
10
default: ""
@@ -46,7 +46,7 @@ on:
46
46
workflow_dispatch:
47
47
inputs:
48
48
extra-r-packages:
49
-
description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install"
49
+
description: "extra R packages installed on top of tests/rproj.lock (like a dev version of one of the deps) - comma separated, passed to rig pkg install: pkg, owner/repo[@ref], gitlab::group/project, url::https://...; pkg@1.2.3 means exactly 1.2.3"
Copy file name to clipboardExpand all lines: .github/workflows/test-smokes-parallel.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ on:
10
10
default: 10
11
11
type: number
12
12
extra-r-packages:
13
-
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"
13
+
description: "extra R packages installed on top of tests/rproj.lock (like a dev version of one of the deps) - comma separated, passed to rig pkg install: pkg, owner/repo[@ref], gitlab::group/project, url::https://...; pkg@1.2.3 means exactly 1.2.3"
Copy file name to clipboardExpand all lines: .github/workflows/test-smokes.yml
+77-85Lines changed: 77 additions & 85 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ on:
15
15
type: boolean
16
16
default: false
17
17
extra-r-packages:
18
-
description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install"
18
+
description: "extra R packages installed on top of tests/rproj.lock (like a dev version of one of the deps) - comma separated, passed to rig pkg install: pkg, owner/repo[@ref], gitlab::group/project, url::https://...; pkg@1.2.3 means exactly 1.2.3"
19
19
required: false
20
20
type: string
21
21
default: ""
@@ -67,7 +67,7 @@ on:
67
67
type: boolean
68
68
default: false
69
69
extra-r-packages:
70
-
description: "extra R package to install for the runs (like a dev version of one of the deps) - comma separated, passed to renv::install"
70
+
description: "extra R packages installed on top of tests/rproj.lock (like a dev version of one of the deps) - comma separated, passed to rig pkg install: pkg, owner/repo[@ref], gitlab::group/project, url::https://...; pkg@1.2.3 means exactly 1.2.3"
71
71
required: false
72
72
type: string
73
73
default: ""
@@ -105,6 +105,16 @@ jobs:
105
105
# Empty keeps the standard checkout behavior.
106
106
ref: ${{ inputs.ref }}
107
107
108
+
- name: Check the ref supports the rig test environment
109
+
shell: bash
110
+
run: |
111
+
for f in tests/rproj.lock .github/actions/setup-rig/action.yml; do
112
+
if [ ! -f "$f" ]; then
113
+
echo "::error::This checkout has no $f. The R test environment needs a ref that uses the rig project (releases before it was introduced are not supported)."
114
+
exit 1
115
+
fi
116
+
done
117
+
108
118
# macOS runners boot with an unresolvable `.local` hostname, so any process
109
119
# resolving its own hostname stalls ~35s (actions/runner-images#14568).
110
120
- name: Set a resolvable hostname (macOS)
@@ -123,7 +133,7 @@ jobs:
123
133
shell: bash
124
134
125
135
# Drops a slow azure.archive.ubuntu.com from the apt mirror list so the job uses
126
-
# archive.ubuntu.com (actions/runner-images#14823): sampled here before setup-r,
136
+
# archive.ubuntu.com (actions/runner-images#14823): sampled here before rig installs R,
127
137
# and after a failed attempt in later apt steps run via $APT_WITH_FALLBACK.
128
138
# Inline, not a local action, because release mode checks out older tags.
Copy file name to clipboardExpand all lines: dev-docs/configuring-test-deps.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,9 +62,7 @@
62
62
63
63
## R
64
64
65
-
- Add the dependencies in `DESCRIPTION` file
66
-
- Run `renv::install(<package>)` to install the dependencies
67
-
- Run `renv::snapshot()` to lock the versions in `renv.lock`
65
+
- Run `rig proj add <package>` from `tests/`: it adds the dependency to `rproj.toml`, locks it in `rproj.lock` and installs it
68
66
69
67
## Julia
70
68
@@ -82,6 +80,5 @@
82
80
83
81
# Updating test dependencies
84
82
85
-
- When `main` updates the test environment (`tests/renv.lock`, `tests/uv.lock`, `tests/Manifest.toml`, or the R / Python / Julia versions in `.github/workflows/test-smokes.yml`), backport the update to the current stable branch (e.g. `v1.10`) while it still receives patch releases, as its own PR (see `checklist-backport-a-pr.md`).
83
+
- When `main` updates the test environment (`tests/rproj.lock`, `tests/uv.lock`, `tests/Manifest.toml`, or the R / Python / Julia versions in `.github/workflows/test-smokes.yml`), backport the update to the current stable branch (e.g. `v1.10`) while it still receives patch releases, as its own PR (see `checklist-backport-a-pr.md`).
86
84
- Patch releases are then tested against the same current R, Python, Julia and package versions users install.
87
-
- CI caches are shared: the R cache key is built from the OS, the R version and the `tests/renv.lock` hash, and any branch can read caches saved on `main`. A stable branch with identical lock files gets cache hits; a diverged one does a slow cold restore on each PR.
0 commit comments