Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upkeep 2024-08 #1984

Merged
merged 6 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -25,24 +27,22 @@ jobs:
- {os: macos-latest, r: 'release'}

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

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

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

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -65,3 +65,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
10 changes: 7 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
Expand All @@ -19,8 +21,10 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -39,7 +43,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ on:
issue_comment:
types: [created]

name: Commands
name: pr-commands.yaml

permissions: read-all

jobs:
document:
Expand All @@ -13,8 +15,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down Expand Up @@ -50,8 +54,10 @@ jobs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
Expand Down
25 changes: 18 additions & 7 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
pull_request:
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
Expand All @@ -15,36 +17,45 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- 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
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ Description: Software testing is important, but, in part because it is
License: MIT + file LICENSE
URL: https://testthat.r-lib.org, https://github.com/r-lib/testthat
BugReports: https://github.com/r-lib/testthat/issues
Depends:
Depends:
R (>= 3.6.0)
Imports:
brio (>= 1.1.3),
callr (>= 3.7.3),
cli (>= 3.6.1),
desc (>= 1.4.2),
digest (>= 0.6.33),
evaluate (>= 0.21),
evaluate (>= 1.0.1),
jsonlite (>= 1.8.7),
lifecycle (>= 1.0.3),
magrittr (>= 2.0.3),
Expand All @@ -36,7 +36,7 @@ Imports:
utils,
waldo (>= 0.5.1),
withr (>= 2.5.0)
Suggests:
Suggests:
covr,
curl (>= 0.9.5),
diffviewer (>= 0.1.0),
Expand All @@ -47,7 +47,7 @@ Suggests:
usethis,
vctrs (>= 0.1.0),
xml2
VignetteBuilder:
VignetteBuilder:
knitr
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Expand Down
8 changes: 4 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ knitr::opts_chunk$set(
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/testthat)](https://cran.r-project.org/package=testthat)
[![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)
[![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)
[![Codecov test coverage](https://codecov.io/gh/r-lib/testthat/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat)
<!-- badges: end -->

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

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

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).
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).

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

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.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
status](https://www.r-pkg.org/badges/version/testthat)](https://cran.r-project.org/package=testthat)
[![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)
[![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)
coverage](https://codecov.io/gh/r-lib/testthat/graph/badge.svg)](https://app.codecov.io/gh/r-lib/testthat)
<!-- badges: end -->

## Overview
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/_snaps/R4.4/snapshot-file/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
R4.4
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/R4.4/snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# variants save different values

Code
r_version()
Output
[1] "R4.4"

17 changes: 6 additions & 11 deletions tests/testthat/test-parallel-crash.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
test_that("crash", {
# https://github.com/r-lib/rlang/commit/c84d52b6
skip_if_not_installed("rlang", "1.0.1.9000")

skip_on_cran()
skip_on_covr()
skip_if_not(getRversion() >= "4.4.0")

withr::local_envvar(TESTTHAT_PARALLEL = "TRUE")

do <- function() {
err <- NULL
pkg <- test_path("test-parallel", "crash")
err <- callr::r(function() {
tryCatch(
testthat::test_local(".", reporter = "summary", stop_on_failure = FALSE),
error = function(e) err <<- e
error = function(e) e
)
err
}

pkg <- test_path("test-parallel", "crash")
err <- callr::r(do, wd = pkg)
}, wd = pkg)
expect_s3_class(err, "testthat_process_error")
expect_equal(err$test_file, "test-crash-3.R")
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_that("this crashes", {
expect_true(TRUE)
expect_true(FALSE)
asNamespace("callr")$crash()
rlang::node_car(0)
})
4 changes: 2 additions & 2 deletions tests/testthat/test-verify-conditions-lines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Message: First.
Second.

> warning("First.\nSecond.")
Warning in eval(expr, envir, enclos): First.
Warning: First.
Second.

> stop("First.\nSecond.")
Error in eval(expr, envir, enclos): First.
Error: First.
Second.

4 changes: 2 additions & 2 deletions tests/testthat/test-verify-conditions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Message: Message

> # With calls
> warning("Warning")
Warning in eval(expr, envir, enclos): Warning
Warning: Warning

> stop("Error")
Error in eval(expr, envir, enclos): Error
Error: Error

> # Without calls
> warning("Warning", call. = FALSE)
Expand Down
Loading