Skip to content

Commit 59d6ea6

Browse files
authored
Merge pull request #2 from epiforecasts/1-add-repo-skeleton
Issue 1: add repo skeleton
2 parents 1556061 + cc0698a commit 59d6ea6

22 files changed

+792
-0
lines changed

.Rbuildignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
^LICENSE\.md$
2+
^\.devcontainer$
3+
^data-raw$
4+
^README\.Rmd$
5+
^\.github$
6+
^\.pre-commit-config\.yaml$
7+
^\.lintr$
8+
^\.Rprofile
9+
^_pkgdown\.yml$
10+
^docs$
11+
^pkgdown$
12+
^vignettes/cache$
13+
^.*\.Rproj$
14+
^\.Rproj\.user$
15+
^codemeta\.json$
16+
^inst/make_hexsticker\.R$
17+
^inst/scripts$
18+
^vignettes/precompile\.R$
19+
^vignettes/chunks$
20+
^doc$
21+
^Meta$
22+
^\.vscode$
23+
^CITATION\.cff$
24+
^vignettes/using-stan-tools\.Rmd$
25+
^touchstone$
26+
^cran-comments\.md$
27+
^CRAN-SUBMISSION$
28+
^[\.]?air\.toml$

.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: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
- cron: '5 4 * * 1'
9+
pull_request:
10+
branches:
11+
- main
12+
merge_group:
13+
workflow_dispatch:
14+
15+
name: R-CMD-check
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
R-CMD-check:
23+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
24+
runs-on: ${{ matrix.config.os }}
25+
26+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
config:
32+
- {os: ubuntu-latest, r: 'release'}
33+
- {os: ubuntu-latest, r: 'oldrel-1'}
34+
- {os: macos-latest, r: 'release'}
35+
- {os: windows-latest, r: 'release'}
36+
37+
env:
38+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
39+
R_KEEP_PKG_SOURCE: yes
40+
NOT_CRAN: true
41+
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: r-lib/actions/setup-pandoc@v2
45+
- uses: r-lib/actions/setup-r@v2
46+
with:
47+
r-version: ${{ matrix.config.r }}
48+
use-public-rspm: true
49+
50+
- uses: r-lib/actions/setup-r-dependencies@v2
51+
with:
52+
extra-packages: any::rcmdcheck, any::testthat
53+
needs: check
54+
55+
- uses: r-lib/actions/check-r-package@v2
56+
with:
57+
upload-snapshots: true

.github/workflows/codemeta.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
on:
2+
push:
3+
paths:
4+
- DESCRIPTION
5+
- .github/workflows/codemeta.yaml
6+
workflow_dispatch:
7+
8+
name: Render codemeta
9+
10+
jobs:
11+
render:
12+
runs-on: ubuntu-latest
13+
if: "!contains(github.event.head_commit.message, 'cm-skip')"
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
steps:
17+
- uses: actions/checkout@v4
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::codemetar
26+
needs: codemeta
27+
28+
- name: Render codemeta
29+
run: codemetar::write_codemeta()
30+
shell: Rscript {0}
31+
32+
- name: Create Pull Request
33+
if: github.ref == 'refs/heads/main'
34+
uses: peter-evans/create-pull-request@v7
35+
with:
36+
commit-message: "Update codemeta.json"
37+
title: "Update codemeta.json"
38+
body: "This is an automated pull request to update the codemeta.json file."
39+
branch: "update-codemeta-${{ github.run_number }}"
40+
labels: "metadata"
41+
reviewers: seabbs
42+
add-paths: |
43+
codemeta.json
44+
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+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
name: lint-changed-files
10+
11+
jobs:
12+
lint-changed-files:
13+
runs-on: ubuntu-latest
14+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
steps:
18+
- uses: actions/checkout@v4
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: |
27+
any::gh
28+
any::lintr
29+
any::purrr
30+
any::cyclocomp
31+
needs: check
32+
33+
- name: Add lintr options
34+
run: |
35+
cat('\noptions(lintr.linter_file = ".lintr")\n', file = "~/.Rprofile", append = TRUE)
36+
shell: Rscript {0}
37+
38+
- name: Install package
39+
run: R CMD INSTALL .
40+
41+
- name: Extract and lint files changed by this PR
42+
run: |
43+
files <- gh::gh("GET https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files")
44+
changed_files <- purrr::map_chr(files, "filename")
45+
all_files <- list.files(recursive = TRUE)
46+
exclusions_list <- as.list(setdiff(all_files, changed_files))
47+
lintr::lint_package(exclusions = exclusions_list)
48+
shell: Rscript {0}
49+
env:
50+
LINTR_ERROR_ON_LINT: true

.github/workflows/pr-commands.yaml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/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' || github.event.comment.author_association == 'COLLABORATOR') && 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@v4
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: roxygen2
30+
31+
- name: Document
32+
run: Rscript -e 'roxygen2::roxygenise()'
33+
34+
- name: commit
35+
run: |
36+
git config --local user.name "$GITHUB_ACTOR"
37+
git config --local user.email "[email protected]"
38+
git add man/\* NAMESPACE
39+
git commit -m 'Document'
40+
- uses: r-lib/actions/pr-push@v2
41+
with:
42+
repo-token: ${{ secrets.GITHUB_TOKEN }}
43+
44+
style:
45+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/style') }}
46+
name: style
47+
runs-on: ubuntu-latest
48+
env:
49+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
50+
steps:
51+
- uses: actions/checkout@v4
52+
53+
- uses: r-lib/actions/pr-fetch@v2
54+
with:
55+
repo-token: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- uses: r-lib/actions/setup-r@v2
58+
59+
- name: Install dependencies
60+
run: Rscript -e 'install.packages(c("styler", "roxygen2"))'
61+
62+
- name: Style
63+
run: Rscript -e 'styler::style_pkg()'
64+
65+
- name: Install Air
66+
uses: posit-dev/setup-air@v1
67+
68+
- name: Check
69+
run: air format . --check
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+
- uses: r-lib/actions/pr-push@v2
78+
with:
79+
repo-token: ${{ secrets.GITHUB_TOKEN }}
80+
81+
update_wordlist:
82+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR') && startsWith(github.event.comment.body, '/update_wordlist') }}
83+
name: update_wordlist
84+
runs-on: ubuntu-latest
85+
env:
86+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- uses: r-lib/actions/pr-fetch@v2
91+
with:
92+
repo-token: ${{ secrets.GITHUB_TOKEN }}
93+
94+
- uses: r-lib/actions/setup-r@v2
95+
96+
- name: Install dependencies
97+
run: |
98+
install.packages(c("spelling"))
99+
shell: Rscript {0}
100+
101+
- name: Update wordlist
102+
run: |
103+
spelling::update_wordlist(confirm = TRUE)
104+
shell: Rscript {0}
105+
106+
- name: Commit changes
107+
run: |
108+
git config --local user.name "$GITHUB_ACTOR"
109+
git config --local user.email "[email protected]"
110+
git add inst/WORDLIST
111+
git commit -m 'Update wordlist' || echo "No changes to commit"
112+
113+
- uses: r-lib/actions/pr-push@v2
114+
with:
115+
repo-token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/master/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]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
merge_group:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref }}
13+
cancel-in-progress: true
14+
15+
name: test-coverage
16+
17+
jobs:
18+
test-coverage:
19+
runs-on: ubuntu-latest
20+
if: "! contains(github.event.head_commit.message, '[ci skip]')"
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
NOT_CRAN: true
24+
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: r-lib/actions/setup-r@v2
29+
with:
30+
use-public-rspm: true
31+
32+
- uses: r-lib/actions/setup-r-dependencies@v2
33+
with:
34+
extra-packages: any::covr
35+
needs: coverage
36+
37+
- name: Test coverage
38+
run: covr::codecov(quiet = FALSE, token = "${{ secrets.CODECOV_TOKEN }}")
39+
shell: Rscript {0}

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
*.xlsx
2+
output
3+
*.rds
4+
inst/doc
5+
*.tex
6+
*.log
7+
_targets
8+
docs
9+
cache
10+
.DS_Store
11+
.Rproj.user
12+
*.Rproj
13+
!inst/extdata/*.rds
14+
/doc/
15+
/Meta/
16+
*.Rhistory
17+
.vscode
18+
/figures/
19+
/vignettes/*_cache/
20+
.here
21+
*.pdf
22+
*.html
23+
CRAN-SUBMISSION

.lintr

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
linters: all_linters(
2+
packages = "lintr",
3+
implicit_integer_linter = NULL,
4+
undesirable_function_linter = NULL,
5+
function_argument_linter = NULL,
6+
indentation_linter = NULL,
7+
object_name_linter = NULL,
8+
return_linter(return_style = "explicit"),
9+
cyclocomp_linter(25L)
10+
)
11+
exclusions: list(
12+
"inst",
13+
"tests/testthat.R" = list(
14+
unused_import_linter = Inf
15+
)
16+
)

0 commit comments

Comments
 (0)