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
13on :
24 push :
3- branches :
4- - master
5+ branches : [main, master]
56 pull_request :
6- branches :
7- - master
7+ branches : [main, master]
88
99name : test-coverage
1010
1111jobs :
1212 test-coverage :
13- runs-on : macOS -latest
13+ runs-on : ubuntu -latest
1414 env :
1515 GITHUB_PAT : ${{ secrets.GITHUB_TOKEN }}
16+
1617 steps :
17- - uses : actions/checkout@v2
18+ - uses : actions/checkout@v3
1819
19- - uses : r-lib/actions/setup-r@master
20+ - uses : r-lib/actions/setup-r@v2
21+ with :
22+ use-public-rspm : true
2023
21- - uses : r-lib/actions/setup-pandoc@master
24+ - uses : r-lib/actions/setup-r-dependencies@v2
25+ with :
26+ extra-packages : any::covr
27+ needs : coverage
2228
23- - name : Query dependencies
29+ - name : Test coverage
2430 run : |
25- install.packages('remotes')
26- saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
27- writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
31+ covr::codecov(
32+ quiet = FALSE,
33+ clean = FALSE,
34+ install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+ )
2836 shell : Rscript {0}
2937
30- - name : Cache R packages
31- uses : actions/cache@v2
32- with :
33- path : ${{ env.R_LIBS_USER }}
34- key : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
35- restore-keys : ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
36-
37- - name : Install dependencies
38+ - name : Show testthat output
39+ if : always()
3840 run : |
39- install.packages(c("remotes"))
40- remotes::install_deps(dependencies = TRUE)
41- remotes::install_cran("covr")
42- shell : Rscript {0}
41+ ## --------------------------------------------------------------------
42+ find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
43+ shell : bash
4344
44- - name : Test coverage
45- run : covr::codecov()
46- shell : Rscript {0}
45+ - name : Upload test results
46+ if : failure()
47+ uses : actions/upload-artifact@v3
48+ with :
49+ name : coverage-test-failures
50+ path : ${{ runner.temp }}/package
0 commit comments