Skip to content

Commit ebf0639

Browse files
committed
adds coverage to action
1 parent 1b83e43 commit ebf0639

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

.Rbuildignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
^CRAN-SUBMISSION$
1414
^docker-compose.yml$
1515
^paper$
16+
^codecov\.yml$

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

+33
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ jobs:
3939
http-user-agent: ${{ matrix.config.http-user-agent }}
4040
use-public-rspm: true
4141

42+
# run Ollama Docker image
43+
- name: Start Docker Container
44+
if: matrix.config.os == 'ubuntu-latest'
45+
run: |
46+
docker pull ollama/ollama:latest
47+
docker run -d --name ollama -p 11434:11434 ollama/ollama:latest
48+
4249
- uses: r-lib/actions/setup-r-dependencies@v2
4350
with:
4451
extra-packages: any::rcmdcheck
@@ -47,3 +54,29 @@ jobs:
4754
- uses: r-lib/actions/check-r-package@v2
4855
with:
4956
upload-snapshots: true
57+
58+
59+
- name: Test coverage
60+
if: matrix.config.os == 'ubuntu-latest'
61+
run: |
62+
covr::codecov(
63+
quiet = FALSE,
64+
clean = FALSE,
65+
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
66+
)
67+
shell: Rscript {0}
68+
69+
- name: Show testthat output
70+
if: matrix.config.os == 'ubuntu-latest'
71+
run: |
72+
## --------------------------------------------------------------------
73+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
74+
shell: bash
75+
76+
- name: Upload test results
77+
if: failure()
78+
uses: actions/upload-artifact@v3
79+
with:
80+
name: coverage-test-failures
81+
path: ${{ runner.temp }}/package
82+

R/utils.r

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ make_req <- function(req_data, server, endpoint, perform = TRUE) {
101101
get_headers <- function() {
102102
agent <- the$agent
103103
if (is.null(agent)) {
104-
sess <- sessionInfo()
104+
sess <- utils::sessionInfo()
105105
the$agent <- agent <- paste0(
106-
"rollama/", packageVersion("rollama"),
106+
"rollama/", utils::packageVersion("rollama"),
107107
"(", sess$platform, ") ",
108108
sess$R.version$version.string
109109
)

codecov.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
target: auto
8+
threshold: 1%
9+
informational: true
10+
patch:
11+
default:
12+
target: auto
13+
threshold: 1%
14+
informational: true

0 commit comments

Comments
 (0)