Skip to content

Commit c2997a8

Browse files
authored
Prep package (#53)
1 parent 1f0a53e commit c2997a8

File tree

12 files changed

+2203
-313
lines changed

12 files changed

+2203
-313
lines changed

.Rbuildignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
^\.Rproj\.user$
33
^temp$
44
^chromote\.sublime-project$
5+
^\.github$
6+
^_pkgdown\.yml$
7+
^docs$
8+
^pkgdown$
9+
^README\.Rmd$
10+
^sidebar.png$

.github/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.html

.github/workflows/R-CMD-check.yaml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# NOTE: This workflow is overkill for most R packages
2+
# check-standard.yaml is likely a better choice
3+
# usethis::use_github_action("check-standard") will install it.
4+
#
5+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
6+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
pull_request:
13+
branches:
14+
- main
15+
- master
16+
17+
name: R-CMD-check
18+
19+
jobs:
20+
rversions:
21+
name: R Versions
22+
runs-on: ubuntu-latest
23+
outputs:
24+
devel: ${{ steps.devel.outputs.installed-r-version }}
25+
release: ${{ steps.release.outputs.installed-r-version }}
26+
oldrel1: ${{ steps.oldrel1.outputs.installed-r-version }}
27+
oldrel2: ${{ steps.oldrel2.outputs.installed-r-version }}
28+
oldrel3: ${{ steps.oldrel3.outputs.installed-r-version }}
29+
oldrel4: ${{ steps.oldrel4.outputs.installed-r-version }}
30+
steps:
31+
- name: devel
32+
uses: r-lib/actions/setup-r@master
33+
id: devel
34+
with:
35+
r-version: devel
36+
install-r: false # No need to install. Just need version
37+
38+
- name: release
39+
uses: r-lib/actions/setup-r@master
40+
id: release
41+
with:
42+
r-version: release
43+
install-r: false # No need to install. Just need version
44+
45+
- name: oldrel/1
46+
uses: r-lib/actions/setup-r@master
47+
id: oldrel1
48+
with:
49+
r-version: oldrel/1
50+
install-r: false # No need to install. Just need version
51+
52+
- name: oldrel/2
53+
uses: r-lib/actions/setup-r@master
54+
id: oldrel2
55+
with:
56+
r-version: oldrel/2
57+
install-r: false # No need to install. Just need version
58+
59+
- name: oldrel/3
60+
uses: r-lib/actions/setup-r@master
61+
id: oldrel3
62+
with:
63+
r-version: oldrel/3
64+
install-r: false # No need to install. Just need version
65+
66+
- name: oldrel/4
67+
uses: r-lib/actions/setup-r@master
68+
id: oldrel4
69+
with:
70+
r-version: oldrel/4
71+
install-r: false # No need to install. Just need version
72+
73+
- name: Set Output
74+
id: set_versions
75+
run: |
76+
echo "devel: ${{ steps.devel.outputs.installed-r-version }}"
77+
echo "release: ${{ steps.release.outputs.installed-r-version }}"
78+
echo "oldrel1: ${{ steps.oldrel1.outputs.installed-r-version }}"
79+
echo "oldrel2: ${{ steps.oldrel2.outputs.installed-r-version }}"
80+
echo "oldrel3: ${{ steps.oldrel3.outputs.installed-r-version }}"
81+
echo "oldrel4: ${{ steps.oldrel4.outputs.installed-r-version }}"
82+
83+
84+
R-CMD-check:
85+
runs-on: ${{ matrix.config.os }}
86+
87+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
88+
89+
needs:
90+
- rversions
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
config:
95+
- {os: macOS-latest, r: '${{ needs.rversions.outputs.release }}'}
96+
- {os: windows-latest, r: '${{ needs.rversions.outputs.release }}'}
97+
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
98+
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "release" }
99+
- {os: ubuntu-18.04, r: '${{ needs.rversions.outputs.release }}', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
100+
- {os: ubuntu-18.04, r: '${{ needs.rversions.outputs.oldrel1 }}', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
101+
- {os: ubuntu-18.04, r: '${{ needs.rversions.outputs.oldrel2 }}', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
102+
- {os: ubuntu-18.04, r: '${{ needs.rversions.outputs.oldrel3 }}', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
103+
- {os: ubuntu-18.04, r: '${{ needs.rversions.outputs.oldrel4 }}', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
104+
105+
env:
106+
RSPM: ${{ matrix.config.rspm }}
107+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
108+
109+
steps:
110+
- uses: actions/checkout@v2
111+
112+
- uses: r-lib/actions/setup-r@master
113+
id: install-r
114+
with:
115+
r-version: ${{ matrix.config.r }}
116+
http-user-agent: ${{ matrix.config.http-user-agent }}
117+
118+
- uses: r-lib/actions/setup-pandoc@v1
119+
120+
- name: Install pak and query dependencies
121+
run: |
122+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
123+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
124+
shell: Rscript {0}
125+
126+
- name: Restore R package cache
127+
uses: actions/cache@v2
128+
with:
129+
path: |
130+
${{ env.R_LIBS_USER }}/*
131+
!${{ env.R_LIBS_USER }}/pak
132+
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
133+
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
134+
135+
- name: Install system dependencies
136+
if: runner.os == 'Linux'
137+
run: |
138+
pak::local_system_requirements(execute = TRUE)
139+
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
140+
shell: Rscript {0}
141+
142+
- name: Install dependencies
143+
run: |
144+
pak::local_install_dev_deps(upgrade = TRUE)
145+
pak::pkg_install("rcmdcheck")
146+
shell: Rscript {0}
147+
148+
- name: Session info
149+
run: |
150+
options(width = 100)
151+
pkgs <- installed.packages()[, "Package"]
152+
sessioninfo::session_info(pkgs, include_base = TRUE)
153+
shell: Rscript {0}
154+
155+
- name: Check
156+
env:
157+
_R_CHECK_CRAN_INCOMING_: false
158+
run: |
159+
options(crayon.enabled = TRUE)
160+
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
161+
shell: Rscript {0}
162+
163+
- name: Show testthat output
164+
if: always()
165+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
166+
shell: bash
167+
168+
- name: Upload check results
169+
if: failure()
170+
uses: actions/upload-artifact@main
171+
with:
172+
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
173+
path: check
174+
175+
- name: Don't use tar from old Rtools to store the cache
176+
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
177+
shell: bash
178+
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH

.github/workflows/pkgdown-pak.yaml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
- rc-**
7+
tags:
8+
-'*'
9+
pull_request:
10+
branches: master
11+
12+
name: pkgdown
13+
14+
jobs:
15+
pkgdown:
16+
runs-on: ubuntu-18.04
17+
env:
18+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
19+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- uses: r-lib/actions/setup-r@v1
25+
id: install-r
26+
27+
- uses: r-lib/actions/setup-pandoc@v1
28+
29+
- name: Install pak and query dependencies
30+
run: |
31+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
32+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
33+
shell: Rscript {0}
34+
35+
- name: Restore R package cache
36+
uses: actions/cache@v2
37+
with:
38+
path: |
39+
${{ env.R_LIBS_USER }}/*
40+
!${{ env.R_LIBS_USER }}/pak
41+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
42+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
43+
44+
- name: Install system dependencies
45+
if: runner.os == 'Linux'
46+
run: |
47+
pak::local_system_requirements(execute = TRUE)
48+
pak::pkg_system_requirements("pkgdown", execute = TRUE)
49+
shell: Rscript {0}
50+
51+
- name: Install dependencies
52+
run: |
53+
pak::local_install_dev_deps(upgrade = TRUE, dependencies = c("all", "Config/Needs/website"))
54+
pak::pkg_install("pkgdown")
55+
shell: Rscript {0}
56+
57+
- name: Install package
58+
run: R CMD INSTALL .
59+
60+
- name: Build Site (PR)
61+
if: github.event_name != 'push'
62+
shell: Rscript {0}
63+
run: |
64+
pkgdown::build_site(new_process = FALSE)
65+
# Must validate after. Otherwise files are saved and `pkgdown::build_site()` gets mad
66+
- name: Validate all topics exist (PR)
67+
if: github.event_name != 'push'
68+
shell: Rscript {0}
69+
run: |
70+
pkgdown::build_reference_index()
71+
stopifnot(length(warnings()) == 0)
72+
73+
- name: Build and deploy pkgdown site (push)
74+
if: github.event_name == 'push'
75+
run: |
76+
git config --local user.name "$GITHUB_ACTOR"
77+
git config --local user.email "[email protected]"
78+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
push:
3+
paths:
4+
- 'README.Rmd'
5+
6+
name: Render README.Rmd
7+
8+
jobs:
9+
render:
10+
runs-on: ubuntu-18.04
11+
env:
12+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
13+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- uses: r-lib/actions/setup-r@v1
19+
id: install-r
20+
21+
- uses: r-lib/actions/setup-pandoc@v1
22+
23+
- name: Install pak and query dependencies
24+
run: |
25+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
26+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
27+
shell: Rscript {0}
28+
29+
- name: Restore R package cache
30+
uses: actions/cache@v2
31+
with:
32+
path: |
33+
${{ env.R_LIBS_USER }}/*
34+
!${{ env.R_LIBS_USER }}/pak
35+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
36+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
37+
38+
- name: Install system dependencies
39+
if: runner.os == 'Linux'
40+
run: |
41+
pak::local_system_requirements(execute = TRUE)
42+
pak::pkg_system_requirements("pkgdown", execute = TRUE)
43+
shell: Rscript {0}
44+
45+
- name: Install dependencies
46+
run: |
47+
pak::local_install_dev_deps(upgrade = TRUE, dependencies = c("all", "Config/Needs/website"))
48+
pak::pkg_install(c("cran::pkgdown", "cran::rmarkdown"))
49+
shell: Rscript {0}
50+
51+
- name: Install package
52+
run: R CMD INSTALL .
53+
54+
- name: Render README
55+
shell: Rscript {0}
56+
run: |
57+
rmarkdown::render("README.Rmd")
58+
59+
- name: Commit results
60+
run: |
61+
git config --local user.email "[email protected]"
62+
git config --local user.name "GitHub Actions"
63+
git commit README.md -m 'Re-build README.Rmd' || echo "No changes to commit"
64+
git push origin || echo "No changes to commit"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
.RData
33
.Rproj.user
44
temp
5+
docs
6+
sidebar.png

DESCRIPTION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ Suggests:
2424
showimage
2525
Roxygen: list(markdown = TRUE)
2626
RoxygenNote: 7.1.1
27+
URL: https://github.com/rstudio/chromote
28+
BugReports: https://github.com/rstudio/chromote/issues

R/chrome.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ find_chrome <- function() {
4141
} else if (is_windows()) {
4242
tryCatch(
4343
{
44-
path <- readRegistry("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe\\")
44+
path <- utils::readRegistry("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\chrome.exe\\")
4545
path <- path[["(Default)"]]
4646
},
4747
error = function(e) {

R/protocol.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' @import rlang
22

3-
globalVariables(c("self", "private", "callback_", "error_", "timeout_", "wait_"))
3+
utils::globalVariables(c("self", "private", "callback_", "error_", "timeout_", "wait_"))
44

55
# Given a protocol spec (essentially, the Chrome Devtools Protocol JSON
66
# converted to an R object), returns a list of domains of the Devtools

0 commit comments

Comments
 (0)