Skip to content

Commit edf5ba7

Browse files
committed
Fix tests and program CI
- Get time before and after job in tests - Program CI to test for checks overnight
1 parent dc93a7e commit edf5ba7

File tree

6 files changed

+41
-24
lines changed

6 files changed

+41
-24
lines changed

Diff for: .github/workflows/R-CMD-check.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main, master]
66
pull_request:
77
branches: [main, master]
8+
schedule:
9+
# * is a special character in YAML so you have to quote this string
10+
- cron: '59 23,11 * * 3'
811

912
name: R-CMD-check
1013

Diff for: .github/workflows/test-coverage.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: [main, master]
66
pull_request:
77
branches: [main, master]
8+
schedule:
9+
# * is a special character in YAML so you have to quote this string
10+
- cron: '59 23,11 * * 3'
811

912
name: test-coverage
1013

Diff for: DESCRIPTION

+12-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
Package: gitdown
22
Title: Turn Your Git Commit Messages into a HTML Book
3-
Version: 0.1.4.9000
4-
Authors@R:
5-
c(person(given = "Sébastien",
6-
family = "Rochette",
7-
role = c("aut", "cre"),
8-
email = "[email protected]",
9-
comment = c(ORCID = "0000-0002-1565-9313")),
10-
person(given = "Cervan",
11-
family = "Girard",
12-
role = "aut",
13-
email = "[email protected]",
14-
comment = c(ORCID = "0000-0002-4816-4624")),
15-
person(given = "ThinkR",
16-
role = "cph"),
17-
person(given = "Institut de Recherches Internationales Servier",
18-
role = "spn"))
3+
Version: 0.1.5
4+
Authors@R: c(
5+
person("Sébastien", "Rochette", , "[email protected]", role = c("aut", "cre"),
6+
comment = c(ORCID = "0000-0002-1565-9313")),
7+
person("Cervan", "Girard", , "[email protected]", role = "aut",
8+
comment = c(ORCID = "0000-0002-4816-4624")),
9+
person("ThinkR", role = "cph"),
10+
person("Institut de Recherches Internationales Servier", role = "spn")
11+
)
1912
Description: Read all commit messages of your local git repository and
2013
sort them according to tags or specific text pattern into chapters of
2114
a HTML book using 'bookdown'. The git history book presentation helps
@@ -41,10 +34,11 @@ Imports:
4134
tidyr,
4235
utils
4336
Suggests:
44-
testthat (>= 2.1.0),
37+
testthat (>= 3.0.0),
4538
withr
4639
VignetteBuilder:
4740
knitr
41+
Config/testthat/edition: 3
4842
Encoding: UTF-8
4943
Roxygen: list(markdown = TRUE)
50-
RoxygenNote: 7.1.1
44+
RoxygenNote: 7.1.2

Diff for: NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# gitdown (development version)
1+
# gitdown 0.1.5
2+
3+
* Change unit tests
24

35
# gitdown 0.1.4
46

Diff for: dev_history.R

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ usethis::use_git_ignore("gitdown")
77

88
usethis::use_git(message = "init commitdown")
99
usethis::use_mit_license("ThinkR")
10+
usethis::use_testthat(edition = 3)
1011

1112
# Functions ----
1213
usethis::use_pipe()
@@ -81,14 +82,19 @@ urlchecker::url_check()
8182
urlchecker::url_update()
8283

8384
# check on other distributions
85+
Sys.time()
8486
rcmdcheck::rcmdcheck(args = "--as-cran")
87+
Sys.time()
88+
devtools::test()
89+
Sys.time()
8590

8691
# rhub::validate_email()
8792
rhub::check_for_cran(show_status = FALSE)
8893
rhub::check_on_windows(check_args = "--force-multiarch")
8994
rhub::check_on_fedora()
9095
rhub::check_on_solaris(show_status = FALSE)
9196
rhub::check_on_windows()
97+
rhub::check_on_debian(show_status = FALSE)
9298

9399
devtools::check_win_devel()
94100
devtools::check_win_release()

Diff for: tests/testthat/test-get_info_files.R

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
1+
time_before_date <- Sys.Date()
2+
time_before <- as.character(time_before_date)
3+
14
repo_pkg <- fake_repo(as.package = TRUE)
25
repo_no_pkg <- fake_repo()
36

47
# get_info ----
58
files <- list.files(repo_pkg, recursive = TRUE)
69
infos <- get_info(files[grep("example", files)], repo = repo_pkg)
710
infos_not_in_repo <- get_info(files[grep("my_mean", files)], repo = repo_pkg)
8-
today <- as.character(Sys.Date())
11+
912
# if check started one day and finishes the other day
10-
tomorrow <- as.character(Sys.Date() + 1)
13+
time_after_date <- Sys.Date()
14+
time_after <- as.character(time_after_date)
1115

1216
test_that("get_info works", {
1317
expect_true(infos$in_repository)
1418
expect_equal(infos$file, "example.txt")
19+
20+
expect_gte(as.Date(infos$last_modif), time_before_date)
21+
expect_lte(as.Date(infos$last_modif), time_after_date)
1522
expect_true(as.character(as.Date(infos$first_modif)) %in%
16-
c(setNames(today, "first"), setNames(tomorrow, "first")))
23+
c(setNames(time_before, "first"), setNames(time_after, "first")))
1724
expect_true(as.character(as.Date(infos$last_modif)) %in%
18-
c(setNames(today, "last"), setNames(tomorrow, "first")))
25+
c(setNames(time_before, "last"), setNames(time_after, "first")))
1926

2027
expect_false(infos_not_in_repo$in_repository)
2128
expect_equal(infos_not_in_repo$file, "R/my_mean.R")
2229
expect_true(is.na(infos_not_in_repo$first_modif))
30+
expect_gte(as.Date(infos_not_in_repo$last_modif), time_before_date)
31+
expect_lte(as.Date(infos_not_in_repo$last_modif), time_after_date)
2332
expect_true(as.character(as.Date(infos_not_in_repo$last_modif)) %in%
24-
c(setNames(today, "last"), setNames(tomorrow, "first")))
33+
c(setNames(time_before, "last"), setNames(time_after, "first")))
2534
})
2635

2736
# get_last_modif ----

0 commit comments

Comments
 (0)