Skip to content

Commit 6353926

Browse files
authored
ci: add dev-check (#278)
1 parent c40c014 commit 6353926

File tree

3 files changed

+114
-2254
lines changed

3 files changed

+114
-2254
lines changed

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

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# r cmd check workflow of the mlr3 ecosystem v0.2.0
2+
# https://github.com/mlr-org/actions
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
debug_enabled:
7+
type: boolean
8+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
9+
required: false
10+
default: false
11+
push:
12+
branches:
13+
- main
14+
pull_request:
15+
branches:
16+
- main
17+
schedule:
18+
- cron: '0 4 * * 1'
19+
20+
21+
name: dev-cmd-check
22+
23+
jobs:
24+
r-cmd-check:
25+
runs-on: ${{ matrix.config.os }}
26+
27+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
config:
33+
- {os: ubuntu-latest, r: 'release', dev-package: 'mlr-org/mlr3', 'mlr-org/mlr3pipelines', 'mlverse/torch', 'mlr-org/paradox'}
34+
35+
env:
36+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
37+
38+
steps:
39+
- uses: r-lib/actions/setup-r@v2
40+
with:
41+
r-version: ${{ matrix.config.r }}
42+
43+
- name: Set test environment variables (unix)
44+
if: runner.os != 'Windows'
45+
run: |
46+
echo "TORCH_TEST=1" >> $GITHUB_ENV
47+
echo "INCLUDE_IGNORED=1" >> $GITHUB_ENV
48+
49+
- name: Set test environment variables (windows)
50+
if: runner.os == 'Windows'
51+
run: |
52+
echo "TORCH_TEST=1" >> $env:GITHUB_ENV
53+
echo "INCLUDE_IGNORED=1" >> $env:GITHUB_ENV
54+
55+
- uses: actions/checkout@v4
56+
57+
- uses: r-lib/actions/setup-pandoc@v2
58+
59+
- uses: r-lib/actions/setup-r-dependencies@v2
60+
with:
61+
extra-packages: any::rcmdcheck
62+
needs: check
63+
64+
- name: Install dev versions
65+
run: pak::pkg_install(c('${{ matrix.config.dev-package }}'))
66+
shell: Rscript {0}
67+
68+
- name: Install torch
69+
run: |
70+
Rscript -e 'torch::install_torch()'
71+
72+
- name: Install further packages
73+
run: |
74+
Rscript -e 'install.packages("rappdirs")'
75+
76+
- name: Get torchvision package version (Linux/macOS)
77+
if: runner.os != 'Windows'
78+
id: get_package_version_unix
79+
run: |
80+
echo "TORCHVISION_PACKAGE_VERSION=$(Rscript -e 'cat(as.character(packageVersion("torchvision")))')" >> $GITHUB_ENV
81+
82+
- name: Get torchvision package version (Windows)
83+
if: runner.os == 'Windows'
84+
id: get_package_version_windows
85+
run: |
86+
$version = Rscript -e 'cat(as.character(packageVersion("torchvision")))'
87+
echo "TORCHVISION_PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
88+
89+
- name: Get torch cache path (Linux/macOS)
90+
if: runner.os != 'Windows'
91+
id: get_cache_path_unix
92+
run: |
93+
echo "TORCH_CACHE_PATH=$(Rscript -e 'cat(rappdirs::user_cache_dir("torch"))')" >> $GITHUB_ENV
94+
95+
- name: Get torch cache path (Windows)
96+
if: runner.os == 'Windows'
97+
id: get_cache_path_windows
98+
run: |
99+
$cachePath = Rscript -e 'cat(rappdirs::user_cache_dir("torch"))'
100+
echo "TORCH_CACHE_PATH=$cachePath" >> $env:GITHUB_ENV
101+
102+
- name: Cache Torchvision Downloads
103+
uses: actions/cache@v4
104+
with:
105+
path: ${{ env.TORCH_CACHE_PATH }}
106+
key: ${{ runner.os }}-r-${{ env.TORCHVISION_PACKAGE_VERSION }}
107+
108+
- uses: r-lib/actions/check-r-package@v2
109+
110+
- uses: mxschmitt/action-tmate@v3
111+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
112+
with:
113+
limit-access-to-actor: true

R/zzz.R

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# to silence RCMD check
2121
utils::globalVariables(c("self", "private", "super", ".."))
2222
if (FALSE) knitr::knit2pandoc
23+
if (FALSE) withr::with_seed
2324

2425
mlr3torch_pipeops = new.env()
2526
mlr3torch_learners = new.env()

0 commit comments

Comments
 (0)