Skip to content

Commit

Permalink
ci: add dev-check
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Aug 21, 2024
1 parent 41a5233 commit 3c4137e
Showing 1 changed file with 184 additions and 0 deletions.
184 changes: 184 additions & 0 deletions .github/workflows/devcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@

# r cmd check workflow of the mlr3 ecosystem v0.3.1
# https://github.com/mlr-org/actions
on:
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: false
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '0 4 * * 1'

name: Dev Check

jobs:
check-package:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.dev-package }}

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release', dev-package: "mlr-org/paradox', 'mlr-org/mlr3', 'mlr-org/mlr3pipelines', 'mlverse/torch"}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- name: Set test environment variables (unix)
if: runner.os != 'Windows'
run: |
echo "TORCH_TEST=1" >> $GITHUB_ENV
echo "INCLUDE_IGNORED=1" >> $GITHUB_ENV
- name: Set test environment variables (windows)
if: runner.os == 'Windows'
run: |
echo "TORCH_TEST=1" >> $env:GITHUB_ENV
echo "INCLUDE_IGNORED=1" >> $env:GITHUB_ENV
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Install torch
run: |
Rscript -e 'torch::install_torch()'
- name: Install further packages
run: |
Rscript -e 'install.packages("rappdirs")'
- name: Get torchvision package version (Linux/macOS)
if: runner.os != 'Windows'
id: get_package_version_unix
run: |
echo "TORCHVISION_PACKAGE_VERSION=$(Rscript -e 'cat(as.character(packageVersion("torchvision")))')" >> $GITHUB_ENV
- name: Get torchvision package version (Windows)
if: runner.os == 'Windows'
id: get_package_version_windows
run: |
$version = Rscript -e 'cat(as.character(packageVersion("torchvision")))'
echo "TORCHVISION_PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
- name: Get torch cache path (Linux/macOS)
if: runner.os != 'Windows'
id: get_cache_path_unix
run: |
echo "TORCH_CACHE_PATH=$(Rscript -e 'cat(rappdirs::user_cache_dir("torch"))')" >> $GITHUB_ENV
- name: Get torch cache path (Windows)
if: runner.os == 'Windows'
id: get_cache_path_windows
run: |
$cachePath = Rscript -e 'cat(rappdirs::user_cache_dir("torch"))'
echo "TORCH_CACHE_PATH=$cachePath" >> $env:GITHUB_ENV
- name: Cache Torchvision Downloads
uses: actions/cache@v4
with:
path: ${{ env.TORCH_CACHE_PATH }}
key: ${{ runner.os }}-r-${{ env.TORCHVISION_PACKAGE_VERSION }}

- uses: r-lib/actions/check-r-package@v2

- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- name: Set test environment variables (unix)
if: runner.os != 'Windows'
run: |
echo "TORCH_TEST=1" >> $GITHUB_ENV
echo "INCLUDE_IGNORED=1" >> $GITHUB_ENV
- name: Set test environment variables (windows)
if: runner.os == 'Windows'
run: |
echo "TORCH_TEST=1" >> $env:GITHUB_ENV
echo "INCLUDE_IGNORED=1" >> $env:GITHUB_ENV
- uses: actions/checkout@v4

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Install torch
run: |
Rscript -e 'torch::install_torch()'
- name: Install further packages
run: |
Rscript -e 'install.packages("rappdirs")'
- name: Get torchvision package version (Linux/macOS)
if: runner.os != 'Windows'
id: get_package_version_unix
run: |
echo "TORCHVISION_PACKAGE_VERSION=$(Rscript -e 'cat(as.character(packageVersion("torchvision")))')" >> $GITHUB_ENV
- name: Get torchvision package version (Windows)
if: runner.os == 'Windows'
id: get_package_version_windows
run: |
$version = Rscript -e 'cat(as.character(packageVersion("torchvision")))'
echo "TORCHVISION_PACKAGE_VERSION=$version" >> $env:GITHUB_ENV
- name: Get torch cache path (Linux/macOS)
if: runner.os != 'Windows'
id: get_cache_path_unix
run: |
echo "TORCH_CACHE_PATH=$(Rscript -e 'cat(rappdirs::user_cache_dir("torch"))')" >> $GITHUB_ENV
- name: Get torch cache path (Windows)
if: runner.os == 'Windows'
id: get_cache_path_windows
run: |
$cachePath = Rscript -e 'cat(rappdirs::user_cache_dir("torch"))'
echo "TORCH_CACHE_PATH=$cachePath" >> $env:GITHUB_ENV
- name: Cache Torchvision Downloads
uses: actions/cache@v4
with:
path: ${{ env.TORCH_CACHE_PATH }}
key: ${{ runner.os }}-r-${{ env.TORCHVISION_PACKAGE_VERSION }}

- uses: r-lib/actions/check-r-package@v2

- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
with:
limit-access-to-actor: true

0 comments on commit 3c4137e

Please sign in to comment.