Skip to content

Commit 18a7ec0

Browse files
authored
Merge pull request #170 from cmu-delphi/cleanup
Cleanup
2 parents b5f819a + b0de490 commit 18a7ec0

File tree

8 files changed

+97
-70
lines changed

8 files changed

+97
-70
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
#
4+
# NOTE: This workflow is overkill for most R packages and
5+
# check-standard.yaml is likely a better choice.
6+
# usethis::use_github_action("check-standard") will install it.
7+
on:
8+
workflow_dispatch:
9+
10+
name: R-CMD-check
11+
12+
jobs:
13+
R-CMD-check:
14+
runs-on: ${{ matrix.config.os }}
15+
16+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
config:
22+
- { os: macos-latest, r: "release" }
23+
24+
- { os: windows-latest, r: "release" }
25+
# Use 3.6 to trigger usage of RTools35
26+
- { os: windows-latest, r: "3.6" }
27+
# use 4.1 to check with rtools40's older compiler
28+
- { os: windows-latest, r: "4.1" }
29+
30+
- { os: ubuntu-latest, r: "devel", http-user-agent: "release" }
31+
- { os: ubuntu-latest, r: "release" }
32+
- { os: ubuntu-latest, r: "oldrel-1" }
33+
- { os: ubuntu-latest, r: "oldrel-2" }
34+
- { os: ubuntu-latest, r: "oldrel-3" }
35+
- { os: ubuntu-latest, r: "oldrel-4" }
36+
# The oldest version of R we claim to support
37+
- { os: ubuntu-latest, r: "3.5" }
38+
39+
env:
40+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
41+
R_KEEP_PKG_SOURCE: yes
42+
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- uses: r-lib/actions/setup-pandoc@v2
47+
48+
- uses: r-lib/actions/setup-r@v2
49+
with:
50+
r-version: ${{ matrix.config.r }}
51+
http-user-agent: ${{ matrix.config.http-user-agent }}
52+
use-public-rspm: true
53+
54+
- uses: r-lib/actions/setup-r-dependencies@v2
55+
with:
56+
extra-packages: any::rcmdcheck
57+
needs: check
58+
59+
- uses: r-lib/actions/check-r-package@v2
60+
with:
61+
upload-snapshots: true

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,33 @@ name: R-CMD-check
1010

1111
jobs:
1212
R-CMD-check:
13-
runs-on: ubuntu-latest
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+
1427
env:
1528
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1629
R_KEEP_PKG_SOURCE: yes
30+
1731
steps:
1832
- uses: actions/checkout@v3
1933

34+
- uses: r-lib/actions/setup-pandoc@v2
35+
2036
- uses: r-lib/actions/setup-r@v2
2137
with:
38+
r-version: ${{ matrix.config.r }}
39+
http-user-agent: ${{ matrix.config.http-user-agent }}
2240
use-public-rspm: true
2341

2442
- uses: r-lib/actions/setup-r-dependencies@v2
@@ -27,3 +45,5 @@ jobs:
2745
needs: check
2846

2947
- uses: r-lib/actions/check-r-package@v2
48+
with:
49+
upload-snapshots: true

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ The release consists of multiple steps which can be all done via the GitHub webs
2727
5. Release to CRAN
2828

2929
[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
30-
[mit-url]: https://opensource.org/licenses/MIT
30+
[mit-url]: https://opensource.org/license/MIT
3131
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
3232
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions

R/cache.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,15 @@ cache_epidata_call <- function(epidata_call, fetch_args = fetch_args_list()) {
250250
as_of_recent <- check_is_recent(epidata_call$params$as_of, 7)
251251
issues_recent <- check_is_recent(epidata_call$params$issues, 7)
252252
if (as_of_recent || issues_recent) {
253-
cli::cli_warn("using cached results with `as_of` within the past week (or the future!). This will likely result ",
254-
"in an invalid cache. Consider\n",
255-
"1. disabling the cache for this session with `disable_cache` or permanently with environmental ",
256-
"variable `EPIDATR_USE_CACHE=FALSE`\n",
257-
"2. setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS', unset = 1)}` to e.g. `3/24` ",
258-
"(3 hours).",
253+
cli::cli_warn(
254+
c(
255+
"using cached results with `as_of` within the past week (or the future!).",
256+
"This will likely result in an invalid cache. Consider\n",
257+
"1. disabling the cache for this session with `disable_cache` or permanently with environmental ",
258+
"variable `EPIDATR_USE_CACHE=FALSE`\n",
259+
"2. setting `EPIDATR_CACHE_MAX_AGE_DAYS={Sys.getenv('EPIDATR_CACHE_MAX_AGE_DAYS', unset = 1)}`",
260+
" to e.g. `3/24` (3 hours)."
261+
),
259262
.frequency = "regularly",
260263
.frequency_id = "cache timing issues",
261264
class = "cache_recent_data"

R/endpoints.R

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,13 +1715,6 @@ pvt_twitter <- function(auth, locations, ..., dates = NULL, epiweeks = NULL, fet
17151715
#' @description
17161716
#' API docs: <https://cmu-delphi.github.io/delphi-epidata/api/wiki.html>
17171717
#'
1718-
#' ```{r results="asis", echo = FALSE}
1719-
#' url <- "https://github.com/raw/cmu-delphi/delphi-epidata/dev/docs/api/covidcast_signals.md"
1720-
#' txt <- readLines(url)
1721-
#' txt <- txt[7:length(txt)]
1722-
#' cat(txt, sep = "\n")
1723-
#' ```
1724-
#'
17251718
#' @examples
17261719
#' \dontrun{
17271720
#' pub_wiki(articles = "avian_influenza", epiweeks = epirange(201501, 201601))

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Delphi Epidata R client
22

33
[![License: MIT][mit-image]][mit-url] [![Github Actions][github-actions-image]][github-actions-url]
4-
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://codecov.io/gh/dsweber2/epidatr)
4+
[![codecov](https://codecov.io/gh/dsweber2/epidatr/branch/dev/graph/badge.svg?token=jVHL9eHZNZ)](https://app.codecov.io/gh/dsweber2/epidatr)
55

66
The [Delphi Epidata API](https://cmu-delphi.github.io/delphi-epidata/) provides real-time access to epidemiological surveillance data for influenza, COVID-19, and other diseases from both official government sources such as the [Center for Disease Control (CDC)](https://www.cdc.gov/datastatistics/index.html) and [Google Trends](https://cmu-delphi.github.io/delphi-epidata/api/covidcast-signals/google-symptoms.html) and private partners such as [Facebook](https://delphi.cmu.edu/blog/2020/08/26/covid-19-symptom-surveys-through-facebook/) and [Change Healthcare](https://www.changehealthcare.com/). It is built and maintained by the Carnegie Mellon University [Delphi research group](https://delphi.cmu.edu/).
77

@@ -82,7 +82,7 @@ Note that for the time being, the private endpoints (i.e. those prefixed with
8282
`pvt`) will require a separate key that needs to be passed as an argument.
8383

8484
[mit-image]: https://img.shields.io/badge/License-MIT-yellow.svg
85-
[mit-url]: https://opensource.org/licenses/MIT
85+
[mit-url]: https://opensource.org/license/mit
8686
[github-actions-image]: https://github.com/cmu-delphi/epidatr/workflows/ci/badge.svg
8787
[github-actions-url]: https://github.com/cmu-delphi/epidatr/actions
8888

man/pub_wiki.Rd

Lines changed: 0 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-cache.R

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@ test_that("basic cache setup", {
22
expect_true(is.null(cache_environ$epidatr_cache))
33
})
44

5-
tmp_base_dir <- Sys.getenv("TMPDIR")
6-
new_temp_dir <- NULL
7-
if (tmp_base_dir == "") {
8-
new_temp_dir <- md5(paste(Sys.time(), "I am the very model of a modern major general"))
9-
} else {
10-
new_temp_dir <- file.path(
11-
Sys.getenv("TMPDIR"),
12-
md5(paste(Sys.time(), "I am the very model of a modern major general"))
13-
)
14-
}
15-
5+
new_temp_dir <- tempdir()
166
test_set_cache <- function(cache_dir = new_temp_dir,
177
days = 1,
188
max_size = 1,
@@ -31,11 +21,11 @@ test_that("cache set as expected", {
3121
test_set_cache()
3222
if (grepl("/", as.character(new_temp_dir))) {
3323
# this is what check produces
34-
expect_equal(cache_info()$dir, as.character(new_temp_dir))
24+
expect_equal(cache_info()$dir, normalizePath(new_temp_dir))
3525
} else {
3626
# this is what test produces directly
3727
tmp <- strsplit(cache_info()$dir, "/")[[1]]
38-
expect_equal(tmp[length(tmp)], as.character(new_temp_dir))
28+
expect_equal(tmp[length(tmp)], normalizePath(new_temp_dir))
3929
}
4030
expect_equal(cache_info()$max_size, 1024^2)
4131
expect_equal(cache_info()$max_age, 24 * 60 * 60)

0 commit comments

Comments
 (0)