Skip to content

Commit 29af1c1

Browse files
committed
Merge branch 'master' of https://github.com/SCasanova/f1dataR
2 parents 35eec15 + 31fc531 commit 29af1c1

File tree

3 files changed

+57
-18
lines changed

3 files changed

+57
-18
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1818

1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
2121

2222
- uses: r-lib/actions/setup-r@v2
2323
with:
@@ -29,7 +29,10 @@ jobs:
2929

3030
- uses: r-lib/actions/setup-r-dependencies@v2
3131
with:
32-
extra-packages: any::covr
32+
extra-packages: |
33+
any::covr
34+
any::devtools
35+
any::xml2
3336
needs: coverage
3437

3538
- name: setup r-reticulate venv
@@ -47,13 +50,23 @@ jobs:
4750
4851
- name: Test coverage
4952
run: |
50-
covr::codecov(
53+
cov <- covr::package_coverage(
5154
quiet = FALSE,
5255
clean = FALSE,
53-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
56+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
5457
)
58+
covr::to_cobertura(cov)
5559
shell: Rscript {0}
5660

61+
- uses: codecov/codecov-action@v4
62+
with:
63+
# Fail if error if not on PR, or if on PR and token is given
64+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
65+
file: ./cobertura.xml
66+
plugin: noop
67+
disable_search: true
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
5770
- name: Show testthat output
5871
if: always()
5972
run: |
@@ -63,7 +76,7 @@ jobs:
6376

6477
- name: Upload test results
6578
if: failure()
66-
uses: actions/upload-artifact@v3
79+
uses: actions/upload-artifact@v4
6780
with:
6881
name: coverage-test-failures
6982
path: ${{ runner.temp }}/package
@@ -77,7 +90,7 @@ jobs:
7790
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
7891

7992
steps:
80-
- uses: actions/checkout@v3
93+
- uses: actions/checkout@v4
8194

8295
- uses: r-lib/actions/setup-r@v2
8396
with:
@@ -89,7 +102,10 @@ jobs:
89102

90103
- uses: r-lib/actions/setup-r-dependencies@v2
91104
with:
92-
extra-packages: any::covr
105+
extra-packages: |
106+
any::covr
107+
any::devtools
108+
any::xml2
93109
needs: coverage
94110

95111
- name: setup r-reticulate venv
@@ -107,13 +123,23 @@ jobs:
107123
108124
- name: Test coverage
109125
run: |
110-
covr::codecov(
126+
cov <- covr::package_coverage(
111127
quiet = FALSE,
112128
clean = FALSE,
113-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
129+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
114130
)
131+
covr::to_cobertura(cov)
115132
shell: Rscript {0}
116133

134+
- uses: codecov/codecov-action@v4
135+
with:
136+
# Fail if error if not on PR, or if on PR and token is given
137+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
138+
file: ./cobertura.xml
139+
plugin: noop
140+
disable_search: true
141+
token: ${{ secrets.CODECOV_TOKEN }}
142+
117143
- name: Show testthat output
118144
if: always()
119145
run: |
@@ -123,9 +149,9 @@ jobs:
123149

124150
- name: Upload test results
125151
if: failure()
126-
uses: actions/upload-artifact@v3
152+
uses: actions/upload-artifact@v4
127153
with:
128-
name: coverage-test-failures
154+
name: coverage-oldff1-test-failures
129155
path: ${{ runner.temp }}/package
130156

131157
test-coverage-hard:
@@ -147,7 +173,7 @@ jobs:
147173
R_KEEP_PKG_SOURCE: yes
148174

149175
steps:
150-
- uses: actions/checkout@v3
176+
- uses: actions/checkout@v4
151177

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

@@ -166,17 +192,29 @@ jobs:
166192
any::rmarkdown
167193
any::markdown
168194
any::covr
195+
any::devtools
196+
any::xml2
169197
needs: coverage
170198

171199
- name: Test coverage
172200
run: |
173-
covr::codecov(
201+
cov <- covr::package_coverage(
174202
quiet = FALSE,
175203
clean = FALSE,
176-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
204+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
177205
)
206+
covr::to_cobertura(cov)
178207
shell: Rscript {0}
179208

209+
- uses: codecov/codecov-action@v4
210+
with:
211+
# Fail if error if not on PR, or if on PR and token is given
212+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
213+
file: ./cobertura.xml
214+
plugin: noop
215+
disable_search: true
216+
token: ${{ secrets.CODECOV_TOKEN }}
217+
180218
- name: Show testthat output
181219
if: always()
182220
run: |
@@ -186,9 +224,9 @@ jobs:
186224

187225
- name: Upload test results
188226
if: failure()
189-
uses: actions/upload-artifact@v3
227+
uses: actions/upload-artifact@v4
190228
with:
191-
name: coverage-test-failures
229+
name: coverage-hard-test-failures
192230
path: ${{ runner.temp }}/package
193231

194232
test-pkgdown-ok:

R/load_results.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ load_results <- function(season = get_current_season(), round = "last") {
3737
dplyr::mutate(
3838
fastest_rank = NA_integer_,
3939
fastest = NA_character_,
40-
top_speed_kpt = NA_real_
40+
top_speed_kph = NA_real_,
41+
time_sec = NA_real_
4142
) %>%
4243
tibble::as_tibble() %>%
4344
janitor::clean_names()

tests/testthat/test-load_results.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test_that("load_results works", {
2525
results_2021_12 <- load_results(2021, 12)
2626
expect_equal(nrow(results_2021_1), nrow(results_2021_12))
2727
expect_equal(ncol(results_2003), ncol(results_2021_12))
28-
expect_true(ncol(results_2021_1) != ncol(results_2021_12))
28+
expect_equal(ncol(results_2021_1), ncol(results_2021_12))
2929

3030
expect_error(load_results(3050, 2), "`season` must be between 1950 and *")
3131
})

0 commit comments

Comments
 (0)