Skip to content

Commit c6be0a6

Browse files
committed
feat: myrpackage with professional development infrastructure
1 parent 68377a0 commit c6be0a6

24 files changed

+1224
-120
lines changed

.Rbuildignore

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,25 @@
44
^\.Rhistory$
55
^\.RData$
66
^\.DS_Store$
7-
^vignettes/
7+
^_pkgdown\.yml$
8+
^pkgdown$
9+
^\.github$
10+
^codecov\.yml$
11+
^\.lintr$
12+
^\.pre-commit-config\.yaml$
13+
^CRAN-SUBMISSION$
14+
^cran-comments\.md$
15+
^CONTRIBUTING\.md$
16+
^docs$
17+
^doc$
18+
^\.github/workflows/.*\.yaml$
19+
^LICENSE\.md$
20+
^codemeta\.json$
21+
^revdep$
22+
^vignettes/articles$
23+
^\.git$
24+
^.*\.Rproj$
25+
^data-raw$
26+
^CODE_OF_CONDUCT\.md$
27+
^CHANGELOG\.md$
28+
^\.Renviron$

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

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: R-CMD-check
10+
11+
jobs:
12+
R-CMD-check:
13+
runs-on: ${{ matrix.config.os }}
14+
15+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
config:
21+
- {os: macOS-latest, r: 'release'}
22+
- {os: windows-latest, r: 'release'}
23+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24+
- {os: ubuntu-latest, r: 'release'}
25+
- {os: ubuntu-latest, r: 'oldrel-1'}
26+
27+
env:
28+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
29+
R_KEEP_PKG_SOURCE: yes
30+
31+
steps:
32+
- uses: actions/checkout@v3
33+
34+
- uses: r-lib/actions/setup-pandoc@v2
35+
36+
- uses: r-lib/actions/setup-r@v2
37+
with:
38+
r-version: ${{ matrix.config.r }}
39+
http-user-agent: ${{ matrix.config.http-user-agent }}
40+
use-public-rspm: true
41+
42+
- uses: r-lib/actions/setup-r-dependencies@v2
43+
with:
44+
extra-packages: any::rcmdcheck
45+
needs: check
46+
47+
- uses: r-lib/actions/check-r-package@v2
48+
with:
49+
upload-snapshots: true

.github/workflows/lint.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: lint
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- uses: r-lib/actions/setup-r@v2
20+
with:
21+
use-public-rspm: true
22+
23+
- uses: r-lib/actions/setup-r-dependencies@v2
24+
with:
25+
extra-packages: any::lintr, local::.
26+
needs: lint
27+
28+
- name: Lint
29+
run: lintr::lint_package()
30+
shell: Rscript {0}
31+
env:
32+
LINTR_ERROR_ON_LINT: true

.github/workflows/pkgdown.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
tags: ['*']
7+
8+
name: pkgdown
9+
10+
jobs:
11+
pkgdown:
12+
runs-on: ubuntu-latest
13+
# Only restrict concurrency for non-PR jobs
14+
concurrency:
15+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
permissions:
19+
contents: write
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- uses: r-lib/actions/setup-pandoc@v2
24+
25+
- uses: r-lib/actions/setup-r@v2
26+
with:
27+
use-public-rspm: true
28+
29+
- uses: r-lib/actions/setup-r-dependencies@v2
30+
with:
31+
extra-packages: any::pkgdown, local::.
32+
needs: website
33+
34+
- name: Build site
35+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
36+
shell: Rscript {0}
37+
38+
- name: Deploy to GitHub pages 🚀
39+
if: github.event_name != 'pull_request'
40+
uses: JamesIves/[email protected]
41+
with:
42+
clean: false
43+
branch: gh-pages
44+
folder: docs

.github/workflows/pr-commands.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
name: Commands
8+
9+
jobs:
10+
document:
11+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
12+
name: document
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- uses: r-lib/actions/pr-fetch@v2
20+
with:
21+
repo-token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- uses: r-lib/actions/setup-r@v2
24+
with:
25+
use-public-rspm: true
26+
27+
- uses: r-lib/actions/setup-r-dependencies@v2
28+
with:
29+
extra-packages: any::roxygen2
30+
needs: pr-document
31+
32+
- name: Document
33+
run: roxygen2::roxygenise()
34+
shell: Rscript {0}
35+
36+
- name: commit
37+
run: |
38+
git config --local user.name "$GITHUB_ACTOR"
39+
git config --local user.email "[email protected]"
40+
git add man/\* NAMESPACE
41+
git commit -m 'Document'
42+
shell: bash
43+
44+
- uses: r-lib/actions/pr-push@v2
45+
with:
46+
repo-token: ${{ secrets.GITHUB_TOKEN }}
47+
48+
style:
49+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
50+
name: style
51+
runs-on: ubuntu-latest
52+
env:
53+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
54+
steps:
55+
- uses: actions/checkout@v3
56+
57+
- uses: r-lib/actions/pr-fetch@v2
58+
with:
59+
repo-token: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- uses: r-lib/actions/setup-r@v2
62+
63+
- name: Install dependencies
64+
run: install.packages("styler")
65+
shell: Rscript {0}
66+
67+
- name: Style
68+
run: styler::style_pkg()
69+
shell: Rscript {0}
70+
71+
- name: commit
72+
run: |
73+
git config --local user.name "$GITHUB_ACTOR"
74+
git config --local user.email "[email protected]"
75+
git add \*.R
76+
git commit -m 'Style'
77+
shell: bash
78+
79+
- uses: r-lib/actions/pr-push@v2
80+
with:
81+
repo-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: test-coverage
10+
11+
jobs:
12+
test-coverage:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- uses: r-lib/actions/setup-r@v2
21+
with:
22+
use-public-rspm: true
23+
24+
- uses: r-lib/actions/setup-r-dependencies@v2
25+
with:
26+
extra-packages: any::covr
27+
needs: coverage
28+
29+
- name: Test coverage
30+
run: |
31+
covr::codecov(
32+
quiet = FALSE,
33+
clean = FALSE,
34+
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
)
36+
shell: Rscript {0}
37+
38+
- name: Show testthat output
39+
if: always()
40+
run: |
41+
## --------------------------------------------------------------------
42+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
43+
shell: bash
44+
45+
- name: Upload test results
46+
if: failure()
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: coverage-test-failures
50+
path: ${{ runner.temp }}/package

.lintr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
linters: linters_with_defaults(
2+
line_length_linter(120),
3+
commented_code_linter = NULL,
4+
indentation_linter = NULL
5+
)
6+
exclusions: list(
7+
"inst/",
8+
"man/",
9+
"vignettes/"
10+
)
11+
encoding: "UTF-8"

0 commit comments

Comments
 (0)