-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c014dbb
Showing
30 changed files
with
868 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
^LICENSE\.md$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^main$ | ||
^pull_request$ | ||
^packages\.json$ | ||
^\.lintr$ | ||
^\.git$ | ||
^\.github$ | ||
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
name: check | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
|
||
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: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- name: Git config | ||
run: | | ||
git config --global user.email "actions@github.com" | ||
git config --global user.name "GitHub Actions" | ||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
name: lint | ||
|
||
jobs: | ||
lint: | ||
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::lintr | ||
needs: lint | ||
|
||
- name: Lint | ||
run: lintr::lint_package() | ||
shell: Rscript {0} | ||
env: | ||
LINTR_ERROR_ON_LINT: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 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: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
name: pkgdown | ||
|
||
jobs: | ||
pkgdown: | ||
runs-on: ubuntu-latest | ||
# Only restrict concurrency for non-PR jobs | ||
concurrency: | ||
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
permissions: | ||
contents: write | ||
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: Deploy to GitHub pages 🚀 | ||
if: github.event_name != 'pull_request' | ||
uses: JamesIves/github-pages-deploy-action@v4.5.0 | ||
with: | ||
clean: false | ||
branch: gh-pages | ||
folder: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# 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: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: test-coverage | ||
|
||
jobs: | ||
test-coverage: | ||
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::covr | ||
needs: coverage | ||
|
||
- name: Test coverage | ||
run: | | ||
covr::codecov( | ||
quiet = FALSE, | ||
clean = FALSE, | ||
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | ||
) | ||
shell: Rscript {0} | ||
|
||
- name: Show testthat output | ||
if: always() | ||
run: | | ||
## -------------------------------------------------------------------- | ||
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true | ||
shell: bash | ||
|
||
- name: Upload test results | ||
if: failure() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-test-failures | ||
path: ${{ runner.temp }}/package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.Rproj.user | ||
.Rhistory | ||
.RData | ||
.Ruserdata | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
linters: linters_with_defaults( | ||
infix_spaces_linter = NULL, | ||
object_length_linter = NULL, | ||
object_name_linter = NULL, | ||
object_usage_linter = NULL) | ||
exclusions: list("inst/pipelines/use_targets.R", "R/class_database.R") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Package: r.releases.utils | ||
Title: Utilities for An R Universe of Package Releases | ||
Description: Utilities for an R universe of package releases. | ||
Version: 0.0.0.9000 | ||
License: MIT + file LICENSE | ||
URL: | ||
https://r-releases.github.io/r.releases.utils/, | ||
https://github.com/r-releases/r.releases.utils | ||
BugReports: https://github.com/r-releases/r.releases.utils/issues | ||
Authors@R: c( | ||
person( | ||
given = c("William", "Michael"), | ||
family = "Landau", | ||
role = c("aut", "cre"), | ||
email = "will.landau.oss@gmail.com", | ||
comment = c(ORCID = "0000-0003-1878-3253") | ||
), | ||
person( | ||
family = "Eli Lilly and Company", | ||
role = "cph" | ||
)) | ||
Depends: | ||
R (>= 3.5.0) | ||
Imports: | ||
gh, | ||
jsonlite | ||
Encoding: UTF-8 | ||
Language: en-US | ||
Config/testthat/edition: 3 | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
YEAR: 2024 | ||
COPYRIGHT HOLDER: Eli Lilly and Company |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# MIT License | ||
|
||
Copyright (c) 2024 Eli Lilly and Company | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(assert_package) | ||
export(build_universe) | ||
export(review_pull_request) | ||
export(review_pull_requests) | ||
importFrom(gh,gh) | ||
importFrom(jsonlite,read_json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# r.releases.utils 0.0.0.9000 (development) | ||
|
||
* First version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#' @title Validate a package entry. | ||
#' @export | ||
#' @keywords internal | ||
#' @description Validate a package entry. | ||
#' @return An character string if there is a problem with the package entry, | ||
#' otherwise `NULL` if there are no issues. | ||
assert_package <- function(path) { | ||
if (!is_character_scalar(path)) { | ||
return("Invalid package file path.") | ||
} | ||
if (!file.exists(path)) { | ||
return(paste("file", shQuote(path), "does not exist.")) | ||
} | ||
name <- basename(path) | ||
url <- try(readLines(path, warn = FALSE), silent = TRUE) | ||
if (inherits(url, "try-error")) { | ||
return(paste("Problem reading file", shQuote(path))) | ||
} | ||
assert_package_contents(name = name, url = url) | ||
} | ||
|
||
assert_package_contents <- function(name, url) { | ||
good_package_name <- grepl( | ||
pattern = "^[a-zA-Z][a-zA-Z0-9.]*[a-zA-Z0-9]$", | ||
x = name | ||
) | ||
if (!isTRUE(good_package_name)) { | ||
return(paste("Found invalid package name: ", shQuote(name))) | ||
} | ||
if (!is_character_scalar(url)) { | ||
return("Invalid package URL.") | ||
} | ||
good_url <- grepl( | ||
pattern = "^https?://[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,3}(/\\S*)?$", | ||
x = url | ||
) | ||
if (!isTRUE(good_url)) { | ||
return( | ||
paste("Found malformed URL", shQuote(url), "of package", shQuote(name)) | ||
) | ||
} | ||
NULL | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#' @title Build the universe. | ||
#' @export | ||
#' @keywords internal | ||
#' @description Create the `r-universe` `packages.json` file | ||
#' from constituent text files with URLs. | ||
#' @return NULL (invisibly) | ||
#' @param input Character of length 1, directory path with the | ||
#' text file listings of R releases. | ||
#' @param output Character of length 1, file path where the | ||
#' `r-universe` `packages.json` file will be written. | ||
build_universe <- function(input = getwd(), output = "packages.json") { | ||
assert_character_scalar(input, "invalid input") | ||
assert_character_scalar(output, "invalid output") | ||
assert_file(input) | ||
packages <- list.files(input, all.files = FALSE, full.names = TRUE) | ||
for (package in packages) { | ||
result <- assert_package(package) | ||
if (!is.null(result)) { | ||
stop(result, call. = FALSE) | ||
} | ||
} | ||
urls <- vapply( | ||
X = packages, | ||
FUN = readLines, | ||
FUN.VALUE = character(1L), | ||
USE.NAMES = FALSE, | ||
warn = FALSE | ||
) | ||
out <- data.frame( | ||
package = basename(packages), | ||
url = urls, | ||
branch = "*release" | ||
) | ||
if (!file.exists(dirname(output))) { | ||
dir.create(dirname(output)) | ||
} | ||
jsonlite::write_json(x = out, path = output) | ||
invisible() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#' r.releases.utils: Utilities for an R universe of package releases. | ||
#' @description Utilities for an R universe of package releases.. | ||
#' @name r.releases.utils-package | ||
#' @family help | ||
#' @importFrom gh gh | ||
#' @importFrom jsonlite read_json | ||
NULL |
Oops, something went wrong.