Skip to content

Commit 35b81f1

Browse files
authored
Upkeep 2024-08 (#1984)
* Re-run tests on R 4.4 * `use_tidy_github_actions()` * Install XQuartz for `png()` * Freshen up crashing test and only run on 4.4 and later * Update snapshots/bump evaluate
1 parent 46504ad commit 35b81f1

File tree

13 files changed

+75
-50
lines changed

13 files changed

+75
-50
lines changed

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

+13-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ on:
1010
pull_request:
1111
branches: [main, master]
1212

13-
name: R-CMD-check
13+
name: R-CMD-check.yaml
14+
15+
permissions: read-all
1416

1517
jobs:
1618
R-CMD-check:
@@ -25,24 +27,22 @@ jobs:
2527
- {os: macos-latest, r: 'release'}
2628

2729
- {os: windows-latest, r: 'release'}
28-
# Use 3.6 to trigger usage of RTools35
29-
- {os: windows-latest, r: '3.6'}
30-
# use 4.1 to check with rtools40's older compiler
31-
- {os: windows-latest, r: '4.1'}
30+
# use 4.0 or 4.1 to check with rtools40's older compiler
31+
- {os: windows-latest, r: 'oldrel-4'}
3232

33-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34-
- {os: ubuntu-latest, r: 'release'}
35-
- {os: ubuntu-latest, r: 'oldrel-1'}
36-
- {os: ubuntu-latest, r: 'oldrel-2'}
37-
- {os: ubuntu-latest, r: 'oldrel-3'}
38-
- {os: ubuntu-latest, r: 'oldrel-4'}
33+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
34+
- {os: ubuntu-latest, r: 'release'}
35+
- {os: ubuntu-latest, r: 'oldrel-1'}
36+
- {os: ubuntu-latest, r: 'oldrel-2'}
37+
- {os: ubuntu-latest, r: 'oldrel-3'}
38+
- {os: ubuntu-latest, r: 'oldrel-4'}
3939

4040
env:
4141
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4242
R_KEEP_PKG_SOURCE: yes
4343

4444
steps:
45-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
4646

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

@@ -65,3 +65,4 @@ jobs:
6565
- uses: r-lib/actions/check-r-package@v2
6666
with:
6767
upload-snapshots: true
68+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/pkgdown.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99
types: [published]
1010
workflow_dispatch:
1111

12-
name: pkgdown
12+
name: pkgdown.yaml
13+
14+
permissions: read-all
1315

1416
jobs:
1517
pkgdown:
@@ -19,8 +21,10 @@ jobs:
1921
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2022
env:
2123
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
permissions:
25+
contents: write
2226
steps:
23-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2428

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

@@ -39,7 +43,7 @@ jobs:
3943

4044
- name: Deploy to GitHub pages 🚀
4145
if: github.event_name != 'pull_request'
42-
uses: JamesIves/github-pages-deploy-action@v4.4.1
46+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4347
with:
4448
clean: false
4549
branch: gh-pages

.github/workflows/pr-commands.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
issue_comment:
55
types: [created]
66

7-
name: Commands
7+
name: pr-commands.yaml
8+
9+
permissions: read-all
810

911
jobs:
1012
document:
@@ -13,8 +15,10 @@ jobs:
1315
runs-on: ubuntu-latest
1416
env:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
permissions:
19+
contents: write
1620
steps:
17-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
1822

1923
- uses: r-lib/actions/pr-fetch@v2
2024
with:
@@ -50,8 +54,10 @@ jobs:
5054
runs-on: ubuntu-latest
5155
env:
5256
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
57+
permissions:
58+
contents: write
5359
steps:
54-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v4
5561

5662
- uses: r-lib/actions/pr-fetch@v2
5763
with:

.github/workflows/test-coverage.yaml

+18-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
pull_request:
77
branches: [main, master]
88

9-
name: test-coverage
9+
name: test-coverage.yaml
10+
11+
permissions: read-all
1012

1113
jobs:
1214
test-coverage:
@@ -15,36 +17,45 @@ jobs:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1618

1719
steps:
18-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1921

2022
- uses: r-lib/actions/setup-r@v2
2123
with:
2224
use-public-rspm: true
2325

2426
- uses: r-lib/actions/setup-r-dependencies@v2
2527
with:
26-
extra-packages: any::covr
28+
extra-packages: any::covr, any::xml2
2729
needs: coverage
2830

2931
- name: Test coverage
3032
run: |
31-
covr::codecov(
33+
cov <- covr::package_coverage(
3234
quiet = FALSE,
3335
clean = FALSE,
34-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
36+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3537
)
38+
covr::to_cobertura(cov)
3639
shell: Rscript {0}
3740

41+
- uses: codecov/codecov-action@v4
42+
with:
43+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
44+
file: ./cobertura.xml
45+
plugin: noop
46+
disable_search: true
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
3849
- name: Show testthat output
3950
if: always()
4051
run: |
4152
## --------------------------------------------------------------------
42-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
53+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4354
shell: bash
4455

4556
- name: Upload test results
4657
if: failure()
47-
uses: actions/upload-artifact@v3
58+
uses: actions/upload-artifact@v4
4859
with:
4960
name: coverage-test-failures
5061
path: ${{ runner.temp }}/package

DESCRIPTION

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Description: Software testing is important, but, in part because it is
1414
License: MIT + file LICENSE
1515
URL: https://testthat.r-lib.org, https://github.com/r-lib/testthat
1616
BugReports: https://github.com/r-lib/testthat/issues
17-
Depends:
17+
Depends:
1818
R (>= 3.6.0)
1919
Imports:
2020
brio (>= 1.1.3),
2121
callr (>= 3.7.3),
2222
cli (>= 3.6.1),
2323
desc (>= 1.4.2),
2424
digest (>= 0.6.33),
25-
evaluate (>= 0.21),
25+
evaluate (>= 1.0.1),
2626
jsonlite (>= 1.8.7),
2727
lifecycle (>= 1.0.3),
2828
magrittr (>= 2.0.3),
@@ -36,7 +36,7 @@ Imports:
3636
utils,
3737
waldo (>= 0.5.1),
3838
withr (>= 2.5.0)
39-
Suggests:
39+
Suggests:
4040
covr,
4141
curl (>= 0.9.5),
4242
diffviewer (>= 0.1.0),
@@ -47,7 +47,7 @@ Suggests:
4747
usethis,
4848
vctrs (>= 0.1.0),
4949
xml2
50-
VignetteBuilder:
50+
VignetteBuilder:
5151
knitr
5252
Config/Needs/website: tidyverse/tidytemplate
5353
Config/testthat/edition: 3

README.Rmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ knitr::opts_chunk$set(
1717
<!-- badges: start -->
1818
[![CRAN status](https://www.r-pkg.org/badges/version/testthat)](https://cran.r-project.org/package=testthat)
1919
[![R-CMD-check](https://github.com/r-lib/testthat/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/testthat/actions/workflows/R-CMD-check.yaml)
20-
[![Codecov test coverage](https://codecov.io/gh/r-lib/testthat/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat?branch=main)
20+
[![Codecov test coverage](https://codecov.io/gh/r-lib/testthat/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat)
2121
<!-- badges: end -->
2222

2323
## Overview
@@ -31,12 +31,12 @@ Testing your code can be painful and tedious, but it greatly increases the quali
3131
on the command line, building test suites, or using R CMD check.
3232

3333
* Displays test progress visually, showing a pass, fail, or error for every
34-
expectation. If you're using the terminal or a recent version of RStudio,
34+
expectation. If you're using the terminal or a recent version of RStudio,
3535
it'll even colour the output.
3636

37-
testthat draws inspiration from the xUnit family of testing packages, as well as from many of the innovative ruby testing libraries, like [rspec](https://rspec.info/), [testy](https://github.com/ahoward/testy), [bacon](https://github.com/leahneukirchen/bacon) and [cucumber](https://cucumber.io).
37+
testthat draws inspiration from the xUnit family of testing packages, as well as from many of the innovative ruby testing libraries, like [rspec](https://rspec.info/), [testy](https://github.com/ahoward/testy), [bacon](https://github.com/leahneukirchen/bacon) and [cucumber](https://cucumber.io).
3838

39-
testthat is the most popular unit testing package for R and is used by thousands of CRAN packages.
39+
testthat is the most popular unit testing package for R and is used by thousands of CRAN packages.
4040

4141
If you're not familiar with testthat, the [testing chapter](https://r-pkgs.org/testing-basics.html) in [R packages](https://r-pkgs.org) gives a good overview, along with workflow advice and concrete examples.
4242

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
status](https://www.r-pkg.org/badges/version/testthat)](https://cran.r-project.org/package=testthat)
1010
[![R-CMD-check](https://github.com/r-lib/testthat/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/r-lib/testthat/actions/workflows/R-CMD-check.yaml)
1111
[![Codecov test
12-
coverage](https://codecov.io/gh/r-lib/testthat/branch/main/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat?branch=main)
12+
coverage](https://codecov.io/gh/r-lib/testthat/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat)
1313
<!-- badges: end -->
1414

1515
## Overview
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
R4.4
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# variants save different values
2+
3+
Code
4+
r_version()
5+
Output
6+
[1] "R4.4"
7+

tests/testthat/test-parallel-crash.R

+6-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
test_that("crash", {
2-
# https://github.com/r-lib/rlang/commit/c84d52b6
3-
skip_if_not_installed("rlang", "1.0.1.9000")
4-
52
skip_on_cran()
63
skip_on_covr()
4+
skip_if_not(getRversion() >= "4.4.0")
5+
76
withr::local_envvar(TESTTHAT_PARALLEL = "TRUE")
87

9-
do <- function() {
10-
err <- NULL
8+
pkg <- test_path("test-parallel", "crash")
9+
err <- callr::r(function() {
1110
tryCatch(
1211
testthat::test_local(".", reporter = "summary", stop_on_failure = FALSE),
13-
error = function(e) err <<- e
12+
error = function(e) e
1413
)
15-
err
16-
}
17-
18-
pkg <- test_path("test-parallel", "crash")
19-
err <- callr::r(do, wd = pkg)
14+
}, wd = pkg)
2015
expect_s3_class(err, "testthat_process_error")
2116
expect_equal(err$test_file, "test-crash-3.R")
2217
})
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test_that("this crashes", {
22
expect_true(TRUE)
33
expect_true(FALSE)
4-
asNamespace("callr")$crash()
4+
rlang::node_car(0)
55
})

tests/testthat/test-verify-conditions-lines.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Message: First.
33
Second.
44

55
> warning("First.\nSecond.")
6-
Warning in eval(expr, envir, enclos): First.
6+
Warning: First.
77
Second.
88

99
> stop("First.\nSecond.")
10-
Error in eval(expr, envir, enclos): First.
10+
Error: First.
1111
Second.
1212

tests/testthat/test-verify-conditions.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ Message: Message
33

44
> # With calls
55
> warning("Warning")
6-
Warning in eval(expr, envir, enclos): Warning
6+
Warning: Warning
77

88
> stop("Error")
9-
Error in eval(expr, envir, enclos): Error
9+
Error: Error
1010

1111
> # Without calls
1212
> warning("Warning", call. = FALSE)

0 commit comments

Comments
 (0)