Skip to content

Commit 8be7a3e

Browse files
committed
Use Github Actions to deploy pkgdown
1 parent 4a7d3dc commit 8be7a3e

23 files changed

Lines changed: 265 additions & 2248 deletions

.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: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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+
R-CMD-check:
21+
runs-on: ${{ matrix.config.os }}
22+
23+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
config:
29+
- {os: macOS-latest, r: 'release'}
30+
- {os: windows-latest, r: 'release'}
31+
- {os: windows-latest, r: '3.6'}
32+
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33+
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
34+
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
35+
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
36+
- {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
37+
- {os: ubuntu-18.04, r: '3.3', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
38+
39+
env:
40+
RSPM: ${{ matrix.config.rspm }}
41+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
42+
43+
steps:
44+
- uses: actions/checkout@v2
45+
46+
- uses: r-lib/actions/setup-r@v1
47+
id: install-r
48+
with:
49+
r-version: ${{ matrix.config.r }}
50+
http-user-agent: ${{ matrix.config.http-user-agent }}
51+
52+
- uses: r-lib/actions/setup-pandoc@v1
53+
54+
- name: Install pak and query dependencies
55+
run: |
56+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
57+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
58+
shell: Rscript {0}
59+
60+
- name: Cache R packages
61+
uses: actions/cache@v2
62+
with:
63+
path: ${{ env.R_LIBS_USER }}
64+
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
65+
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
66+
67+
- name: Install system dependencies
68+
if: runner.os == 'Linux'
69+
run: |
70+
pak::local_system_requirements(execute = TRUE)
71+
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
72+
shell: Rscript {0}
73+
74+
- name: Install dependencies
75+
run: |
76+
pak::local_install_dev_deps(upgrade = TRUE)
77+
pak::pkg_install("rcmdcheck")
78+
shell: Rscript {0}
79+
80+
- name: Session info
81+
run: |
82+
options(width = 100)
83+
pkgs <- installed.packages()[, "Package"]
84+
sessioninfo::session_info(pkgs, include_base = TRUE)
85+
shell: Rscript {0}
86+
87+
- name: Check
88+
env:
89+
_R_CHECK_CRAN_INCOMING_: false
90+
run: |
91+
options(crayon.enabled = TRUE)
92+
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
93+
shell: Rscript {0}
94+
95+
- name: Show testthat output
96+
if: always()
97+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
98+
shell: bash
99+
100+
- name: Upload check results
101+
if: failure()
102+
uses: actions/upload-artifact@main
103+
with:
104+
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
105+
path: check

.github/workflows/pkgdown.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
7+
name: pkgdown
8+
9+
jobs:
10+
pkgdown:
11+
runs-on: macOS-latest
12+
env:
13+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- uses: r-lib/actions/setup-r@v1
18+
19+
- uses: r-lib/actions/setup-pandoc@v1
20+
21+
- name: Query dependencies
22+
run: |
23+
install.packages('remotes')
24+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
25+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
26+
shell: Rscript {0}
27+
28+
- name: Cache R packages
29+
uses: actions/cache@v2
30+
with:
31+
path: ${{ env.R_LIBS_USER }}
32+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
33+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
34+
35+
- name: Install dependencies
36+
run: |
37+
remotes::install_deps(dependencies = TRUE)
38+
install.packages("pkgdown", type = "binary")
39+
shell: Rscript {0}
40+
41+
- name: Install package
42+
run: R CMD INSTALL .
43+
44+
- name: Deploy package
45+
run: |
46+
git config --local user.email "actions@github.com"
47+
git config --local user.name "GitHub Actions"
48+
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'

.github/workflows/pr-commands.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
issue_comment:
3+
types: [created]
4+
name: Commands
5+
jobs:
6+
document:
7+
if: startsWith(github.event.comment.body, '/document')
8+
name: document
9+
runs-on: macOS-latest
10+
env:
11+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: r-lib/actions/pr-fetch@v1
15+
with:
16+
repo-token: ${{ secrets.GITHUB_TOKEN }}
17+
- uses: r-lib/actions/setup-r@v1
18+
- name: Install dependencies
19+
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
20+
- name: Document
21+
run: Rscript -e 'roxygen2::roxygenise()'
22+
- name: commit
23+
run: |
24+
git config --local user.email "actions@github.com"
25+
git config --local user.name "GitHub Actions"
26+
git add man/\* NAMESPACE
27+
git commit -m 'Document'
28+
- uses: r-lib/actions/pr-push@v1
29+
with:
30+
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
style:
32+
if: startsWith(github.event.comment.body, '/style')
33+
name: style
34+
runs-on: macOS-latest
35+
env:
36+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
37+
steps:
38+
- uses: actions/checkout@v2
39+
- uses: r-lib/actions/pr-fetch@v1
40+
with:
41+
repo-token: ${{ secrets.GITHUB_TOKEN }}
42+
- uses: r-lib/actions/setup-r@v1
43+
- name: Install dependencies
44+
run: Rscript -e 'install.packages("styler")'
45+
- name: Style
46+
run: Rscript -e 'styler::style_pkg()'
47+
- name: commit
48+
run: |
49+
git config --local user.email "actions@github.com"
50+
git config --local user.name "GitHub Actions"
51+
git add \*.R
52+
git commit -m 'Style'
53+
- uses: r-lib/actions/pr-push@v1
54+
with:
55+
repo-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
pull_request:
7+
branches:
8+
- main
9+
- master
10+
11+
name: test-coverage
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: ubuntu-18.04
16+
env:
17+
RSPM: https://packagemanager.rstudio.com/cran/__linux__/bionic/latest
18+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- uses: r-lib/actions/setup-r@v1
24+
id: install-r
25+
26+
- name: Install pak and query dependencies
27+
run: |
28+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
29+
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
30+
shell: Rscript {0}
31+
32+
- name: Cache R packages
33+
uses: actions/cache@v2
34+
with:
35+
path: ${{ env.R_LIBS_USER }}
36+
key: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
37+
restore-keys: ubuntu-18.04-${{ steps.install-r.outputs.installed-r-version }}-1-
38+
39+
- name: Install system dependencies
40+
if: runner.os == 'Linux'
41+
run: |
42+
pak::local_system_requirements(execute = TRUE)
43+
pak::pkg_system_requirements("covr", execute = TRUE)
44+
shell: Rscript {0}
45+
46+
- name: Install dependencies
47+
run: |
48+
pak::local_install_dev_deps(upgrade = TRUE)
49+
pak::pkg_install("covr")
50+
shell: Rscript {0}
51+
52+
- name: Test coverage
53+
run: covr::codecov()
54+
shell: Rscript {0}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.Rproj.user
22
.Rhistory
33
.RData
4+
docs

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
url: https://rohelab.github.io/sparseLRMatrix

0 commit comments

Comments
 (0)