Skip to content

Commit f44a363

Browse files
be-marcclaude
andauthored
ci: update workflows (#106)
* ci: update workflows Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: add dependabot for github actions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: skip tests when suggested dependencies are missing Skip tests that require `tibble` (needed by `sf::read_sf()`) and `future.callr` when these packages are not installed, fixing the no-suggest-cmd-check CI workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: guard predict_spatial example with tibble check The example uses `tsk("leipzig")` which calls `sf::read_sf()`, requiring `tibble` at runtime. Wrap in `requireNamespace()` guard so R CMD check passes without suggested dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: replace `read_sf()` with `st_read()` to avoid tibble dependency `sf::read_sf()` requires `tibble` which is only a suggested dependency of `sf`. Use `sf::st_read()` instead which returns a plain data.frame and works without `tibble` installed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 684b975 commit f44a363

9 files changed

Lines changed: 124 additions & 13 deletions

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# R CMD check workflow without suggested packages v0.4.0
2+
# Without `cache: false` packages can leak from the cache of the previous workflow runs
3+
# You can remove the `services.redis` section if the package does not require `rush` for the tests
4+
# https://github.com/mlr-org/actions
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
debug_enabled:
9+
type: boolean
10+
description: 'Run the build with tmate debugging enabled'
11+
required: false
12+
default: false
13+
push:
14+
branches:
15+
- main
16+
pull_request:
17+
branches:
18+
- main
19+
20+
name: no-suggest-cmd-check
21+
22+
jobs:
23+
no-suggest-cmd-check:
24+
runs-on: ${{ matrix.config.os }}
25+
services:
26+
redis:
27+
image: redis
28+
options: >-
29+
--health-cmd "redis-cli ping"
30+
--health-interval 10s
31+
--health-timeout 5s
32+
--health-retries 5
33+
ports:
34+
- 6379:6379
35+
36+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
37+
38+
env:
39+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
40+
RUSH_TEST_USE_REDIS: true
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
config:
46+
- {os: ubuntu-latest, r: 'release'}
47+
48+
steps:
49+
- uses: actions/checkout@v6
50+
51+
- uses: r-lib/actions/setup-pandoc@v2
52+
53+
- uses: r-lib/actions/setup-r@v2
54+
with:
55+
r-version: ${{ matrix.config.r }}
56+
57+
- uses: r-lib/actions/setup-r-dependencies@v2
58+
with:
59+
extra-packages: |
60+
any::rcmdcheck
61+
any::testthat
62+
any::knitr
63+
any::rmarkdown
64+
needs: check
65+
dependencies: '"hard"'
66+
cache: false
67+
68+
- uses: mxschmitt/action-tmate@v3
69+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
70+
with:
71+
limit-access-to-actor: true
72+
73+
- uses: r-lib/actions/check-r-package@v2
74+
with:
75+
args: 'c("--no-manual", "--as-cran")'

.github/workflows/pkgdown.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# pkgdown workflow of the mlr3 ecosystem v0.1.0
1+
# pkgdown workflow of the mlr3 ecosystem v0.2.0
2+
# You can remove the `services.redis` section if the package does not require `rush` for the tests
23
# https://github.com/mlr-org/actions
34
on:
45
push:
@@ -17,13 +18,26 @@ name: pkgdown
1718
jobs:
1819
pkgdown:
1920
runs-on: ubuntu-latest
21+
services:
22+
redis:
23+
image: redis
24+
options: >-
25+
--health-cmd "redis-cli ping"
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
- 6379:6379
31+
2032

2133
concurrency:
2234
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
35+
2336
env:
2437
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
38+
2539
steps:
26-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v6
2741

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

@@ -44,7 +58,7 @@ jobs:
4458

4559
- name: Deploy
4660
if: github.event_name != 'pull_request'
47-
uses: JamesIves/github-pages-deploy-action@v4.4.1
61+
uses: JamesIves/github-pages-deploy-action@v4.8.0
4862
with:
4963
clean: false
5064
branch: gh-pages

.github/workflows/r-cmd-check.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# r cmd check workflow of the mlr3 ecosystem v0.4.0
1+
# r cmd check workflow of the mlr3 ecosystem v0.6.0
2+
# You can remove the `services.redis` section if the package does not require `rush` for the tests
23
# https://github.com/mlr-org/actions
34
on:
45
workflow_dispatch:
@@ -20,11 +21,22 @@ name: r-cmd-check
2021
jobs:
2122
r-cmd-check:
2223
runs-on: ${{ matrix.config.os }}
24+
services:
25+
redis:
26+
image: redis
27+
options: >-
28+
--health-cmd "redis-cli ping"
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
ports:
33+
- 6379:6379
2334

2435
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
2536

2637
env:
2738
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
39+
RUSH_TEST_USE_REDIS: true
2840

2941
strategy:
3042
fail-fast: false
@@ -34,7 +46,7 @@ jobs:
3446
- {os: ubuntu-latest, r: 'release'}
3547

3648
steps:
37-
- uses: actions/checkout@v3
49+
- uses: actions/checkout@v6
3850

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

@@ -46,7 +58,6 @@ jobs:
4658
with:
4759
extra-packages: any::rcmdcheck
4860
needs: check
49-
error-on: '"note"'
5061

5162
- uses: mxschmitt/action-tmate@v3
5263
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
@@ -55,4 +66,5 @@ jobs:
5566

5667
- uses: r-lib/actions/check-r-package@v2
5768
with:
69+
error-on: '"note"'
5870
args: 'c("--no-manual", "--as-cran")'

R/TaskClassif_leipzig.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
NULL
2222

2323
load_task_leipzig = function(id = "leipzig") {
24-
vector = sf::read_sf(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE)
24+
vector = sf::st_read(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE, quiet = TRUE)
2525
task = as_task_classif_st(vector, id = id, target = "land_cover", label = "Leipzig Land Cover")
2626
task$backend$hash = task$man = "mlr3::mlr_tasks_leipzig"
2727
task

man/predict_spatial.Rd

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_DataBackendVector.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test_that("DataBackendVector works", {
2-
vector = sf::read_sf(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE)
2+
vector = sf::st_read(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE, quiet = TRUE)
33
primary_key = "..row_id"
44
vector[[primary_key]] = seq_row(vector)
55
backend = DataBackendVector$new(vector, primary_key = primary_key)
@@ -9,7 +9,7 @@ test_that("DataBackendVector works", {
99
})
1010

1111
test_that("as_data_backend.sf works", {
12-
vector = sf::read_sf(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE)
12+
vector = sf::st_read(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE, quiet = TRUE)
1313
backend = as_data_backend(vector)
1414

1515
expect_class(backend, "DataBackendVector")

tests/testthat/test_as_task_unsupervised.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ test_that("as_task_unsupervised works on RasterStack objects", {
6161
})
6262

6363
test_that("as_task_unsupervised works on sf objects", {
64-
vector = sf::read_sf(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE)
64+
vector = sf::st_read(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE, quiet = TRUE)
6565
vector$land_cover = NULL
6666

6767
expect_class(as_task_unsupervised(vector), "TaskUnsupervised")

tests/testthat/test_predict_spatial.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ test_that("parallel execution works with multisession", {
140140
})
141141

142142
test_that("parallel execution works with callr", {
143+
skip_if_not_installed("future.callr")
143144
# train
144145
stack = generate_stack(
145146
list(
@@ -276,7 +277,7 @@ test_that("prediction are written to sf vector", {
276277
learner = lrn("classif.rpart")
277278
learner$train(task)
278279

279-
vector = sf::read_sf(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE)
280+
vector = sf::st_read(system.file("extdata", "leipzig_points.gpkg", package = "mlr3spatial"), stringsAsFactors = TRUE, quiet = TRUE)
280281
vector$land_cover = NULL
281282
task_predict = as_task_unsupervised(vector)
282283
pred = predict_spatial(task_predict, learner)

0 commit comments

Comments
 (0)