Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilieFinch authored Jul 29, 2024
0 parents commit de38a54
Show file tree
Hide file tree
Showing 38 changed files with 2,791 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
^.*\.Rproj$
^CITATION\.cff$
^LICENSE\.md$
^Meta$
^README\.Rmd$
^\.Rproj\.user$
^\.github$
^\.lintr$
^\.pre-commit-config\.yaml$
^_pkgdown\.yml$
^codecov\.yml$
^doc$
^docs$
^pkgdown$
^tools$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.bib -linguist-detectable
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
22 changes: 22 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repository:
# https://probot.github.io/apps/settings/
allow_merge_commit: false
allow_rebase_merge: true
allow_squash_merge: true
default_branch: main
delete_branch_on_merge: true
# has_discussions: false
has_issues: true
# has_projects: false
# has_wiki: false
# private: false
branches:
- name: main
# https://docs.github.com/en/rest/reference/repos#update-branch-protection
protection:
required_pull_request_reviews:
required_approving_review_count: 0 # (1-6; optionally 0)
dismiss_stale_reviews: true
require_code_owner_reviews: false
required_status_checks:
strict: true
94 changes: 94 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# Reproduce locally by running:
# ```r
# pak::pak(c("any::rcmdcheck", "."), dependencies = "Config/Needs/check")
# rcmdcheck::rcmdcheck()
# ```
on:
push:
branches: [main, master]
paths:
- 'data/**'
- 'R/**'
- 'inst/**'
- 'man/**'
- 'src/**'
- 'tests/**'
- 'vignettes/**'
- 'DESCRIPTION'
- 'NAMESPACE'
- 'LICENSE'
- '.Rbuildignore'
- '.github/workflows/R-CMD-check.yaml'
merge_group:
pull_request:
paths:
- 'data/**'
- 'R/**'
- 'inst/**'
- 'man/**'
- 'src/**'
- 'tests/**'
- 'vignettes/**'
- 'DESCRIPTION'
- 'NAMESPACE'
- 'LICENSE'
- '.Rbuildignore'
- '.github/workflows/R-CMD-check.yaml'

name: R-CMD-check

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
id: rcmdcheck
with:
upload-snapshots: true
error-on: '"note"'

# fail-fast but only if rcmdcheck step fails
- name: Manual fail-fast
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always() && steps.rcmdcheck.outcome == 'failure'
run: gh run cancel ${{ github.run_id }}
82 changes: 82 additions & 0 deletions .github/workflows/dependency-change.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
pull_request:
paths:
- 'DESCRIPTION'

name: Analyze dependency changes

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write

jobs:
dependency-changes:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: any::pak, glue, gh

- name: Analyze dependency changes
shell: Rscript {0}
run: |
deps_base <- pak::pkg_deps("${{ github.repository }}@${{ github.base_ref }}", dependencies = TRUE) |>
subset(!directpkg) |>
subset(is.na(priority))
# We install from PR number rather than branch to deal with the case
# of PR coming from forks
deps_head <- pak::pkg_deps("${{ github.repository }}#${{ github.event.number }}", dependencies = TRUE) |>
subset(!directpkg) |>
subset(is.na(priority))
deps_added <- deps_head |>
subset(!ref %in% deps_base$ref)
deps_removed <- deps_base |>
subset(!ref %in% deps_head$ref)
if (nrow(deps_added) + nrow(deps_removed) > 0) {
message("Dependencies have changed! Analyzing...")
if (nrow(deps_added) > 0) {
nudge <- "Reach out on slack (`#code-review` or `#help` channels) to double check if there are base R alternatives to the new dependencies.\n"
} else {
nudge <- ""
}
msg <- glue::glue(
.sep = "\n",
"This pull request:",
"- Adds {nrow(deps_added)} new dependencies (direct and indirect)",
"- Adds {length(unique(deps_added$sysreqs))} new system dependencies",
"- Removes {nrow(deps_removed)} existing dependencies (direct and indirect)",
"- Removes {length(unique(deps_removed$sysreqs))} existing system dependencies",
"",
nudge,
"(Note that results may be inaccurate if you branched from an outdated version of the target branch.)"
)
message("Posting results as a pull request comment.")
gh::gh(
"POST /repos/{repo}/issues/{issue_number}/comments",
repo = "${{ github.repository }}",
issue_number = "${{ github.event.number }}",
body = msg
)
}
53 changes: 53 additions & 0 deletions .github/workflows/lint-changed-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
workflow_dispatch:
pull_request:
branches: [main, master]
paths:
- '**.R'
- '**.Rmd'
- '**/.lintr'
- '**/.lintr.R'

name: lint-changed-files

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-changed-files:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::gh
any::lintr
any::purrr
any::cyclocomp
epiverse-trace/etdev
needs: check

- name: Install package
run: R CMD INSTALL .

- name: Extract and lint files changed by this PR
run: |
files <- gh::gh("/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files")
changed_files <- purrr::map_chr(files, "filename")
all_files <- list.files(recursive = TRUE)
exclusions_list <- as.list(setdiff(all_files, changed_files))
lintr::lint_package(exclusions = exclusions_list)
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
90 changes: 90 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# Reproduce locally by running:
# ```r
# pak::pak(c("any::pkgdown", "."), dependencies = "Config/Needs/website")
# pkgdown::build_site()
# ```
on:
push:
branches: [main, master]
paths:
- 'README.Rmd'
- 'README.md'
- 'index.Rmd'
- 'index.md'
- 'man/**'
- 'vignettes/**'
- '_pkgdown.yml'
- 'pkgdown/**'
- 'DESCRIPTION'
- '.Rbuildignore'
- '.github/**'
merge_group:
pull_request:
paths:
- 'README.Rmd'
- 'README.md'
- 'index.Rmd'
- 'index.md'
- 'man/**'
- 'vignettes/**'
- '_pkgdown.yml'
- 'pkgdown/**'
- 'DESCRIPTION'
- '.Rbuildignore'
- '.github/**'
release:
types: [published]
workflow_dispatch:

name: pkgdown

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
pkgdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Check website links
uses: untitaker/[email protected]
with:
args: docs/

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'merge_group' && github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
# We clean on releases because we want to remove old vignettes,
# figures, etc. that have been deleted from the `main` branch.
# But we clean ONLY on releases because we want to be able to keep
# both the 'stable' and 'dev' websites.
# Also discussed in https://github.com/r-lib/actions/issues/484
clean: ${{ github.event_name == 'release' }}
branch: gh-pages
folder: docs
Loading

0 comments on commit de38a54

Please sign in to comment.