Require torch 0.14.0 #262
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
# | |
# NOTE: This workflow is overkill for most R packages and | |
# check-standard.yaml is likely a better choice. | |
# usethis::use_github_action("check-standard") will install it. | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
name: R-CMD-check | |
jobs: | |
Build-Libs: | |
runs-on: ${{ matrix.config.runner }} | |
container: ${{ matrix.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {runner: macOS-13, r_version: release, os: macOS} | |
- {runner: [self-hosted, m1], r_version: '', os: macOS} | |
- {runner: windows-2019, r_version: release, os: windows} | |
- {runner: ubuntu-latest, r_version: release, os: ubuntu} | |
- {runner: [self-hosted, linux], r_version: release, os: ubuntu, cuda: 12.4, cuda_patch: 1} | |
- {runner: windows-2019, r_version: release, os: windows, cuda: 12.4, cuda_patch: 1} | |
include: | |
- config: {os: ubuntu} | |
container: ubuntu:20.04 | |
env: | |
TORCH_INSTALL: 1 | |
TORCH_TEST: 1 | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CUDA: ${{matrix.config.cuda}} | |
MAKEFLAGS: '-j8' | |
DEBIAN_FRONTEND: 'noninteractive' | |
TZ: 'Etc/UTC' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: mlverse/torch/.github/actions/setup-r@main | |
with: | |
r_version: ${{ matrix.config.r_version}} | |
- name: Install system dependencies | |
if: matrix.container != '' | |
run: | | |
apt-get update | |
apt-get install -y curl sudo libxml2-dev wget chrpath rsync git libjpeg-dev | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
DRY_RUN=1 sh ./get-docker.sh | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: 'latest' | |
- if: ${{matrix.config.cuda != ''}} | |
uses: Jimver/[email protected] | |
id: cuda-toolkit | |
with: | |
cuda: '${{matrix.config.cuda}}.${{matrix.config.cuda_patch}}' | |
- name: Install CuDNN | |
if: ${{ matrix.config.cuda != '' }} | |
uses: mlverse/torch/.github/actions/install-cudnn@main | |
with: | |
cuda_version: ${{ matrix.config.cuda }} | |
- name: Install dependencies | |
run: | | |
Rscript -e "install.packages(c('remotes', 'desc', 'rcmdcheck'))" | |
Rscript -e "remotes::install_github('mlverse/torchexport')" | |
- run: | | |
cd csrc | |
mkdir build && cd build | |
cmake .. | |
cmake --build . --target package --config Release --parallel 4 | |
- id: version | |
shell: bash | |
run: | | |
version=$(Rscript -e "cat(as.character(desc::desc_get_version()))") | |
fname=$(Rscript -e "cat(list.files('csrc/build/', '*.zip'))") | |
echo "::set-output name=version::$version" | |
echo "::set-output name=fname::$fname" | |
- uses: svenstaro/upload-release-action@v2 | |
if: github.ref_name == 'main' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: csrc/build/*.zip | |
overwrite: true | |
file_glob: true | |
tag: v${{ steps.version.outputs.version }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.version.outputs.fname }} | |
path: csrc/build/*.zip | |
R-CMD-check: | |
runs-on: ${{ matrix.config.runner }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
needs: Build-Libs | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: mac, runner: macOS-latest, r: 'release', artifact: '+cpu+x86_64-Darwin.zip'} | |
- {os: m1mac, runner: ['self-hosted', 'm1'], artifact: '+cpu+arm64-Darwin.zip'} | |
- {os: windows, runner: windows-latest, r: 'release', rtools: '42', artifact: '+cpu-win64.zip'} | |
- {os: windows, runner: windows-latest, r: '3.6', artifact: '+cpu-win64.zip'} | |
- {os: ubuntu, runner: ubuntu-20.04, r: 'release', artifact: '+cpu-Linux.zip'} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
TORCH_INSTALL: 1 | |
TORCH_TEST: 1 | |
MAKEFLAGS: '-j8' | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-pandoc@v1 | |
if: ${{ !contains(matrix.config.os, 'm1') }} | |
- uses: r-lib/actions/setup-r@v2 | |
if: ${{ !contains(matrix.config.os, 'm1') }} | |
with: | |
r-version: ${{ matrix.config.r }} | |
rtools-version: ${{ matrix.config.rtools }} | |
http-user-agent: ${{ matrix.config.http-user-agent }} | |
use-public-rspm: true | |
windows-path-include-mingw: false | |
- name: Install dependencies | |
run: | | |
Rscript -e "install.packages(c('remotes', 'desc', 'rcmdcheck'))" -e "remotes::install_deps(dependencies = TRUE, INSTALL_opts='--no-multiarch')" | |
Rscript -e "remotes::install_github('mlverse/torchexport')" | |
- name: Query package version | |
shell: bash | |
id: version | |
run: | | |
version=$(Rscript -e "cat(as.character(desc::desc_get_version()))") | |
echo "::set-output name=version::$version" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: 'torchvisionlib-${{ steps.version.outputs.version }}${{ matrix.config.artifact }}' | |
path: build/ | |
- name: Set the path to the lib | |
shell: bash | |
run: | | |
Rscript -e "cat('ZIP file:', normalizePath(list.files('build/', pattern='zip', full.names=TRUE)))" | |
Rscript -e "cat('ENV file:', Sys.getenv('GITHUB_ENV'))" | |
Rscript -e "writeLines(paste0('TORCHVISIONLIB_URL=',normalizePath(list.files('build/', pattern='zip', full.names=TRUE))), Sys.getenv('GITHUB_ENV'))" | |
- uses: r-lib/actions/check-r-package@v2 | |
with: | |
error-on: '"error"' | |
args: 'c("--no-multiarch", "--no-manual")' | |
- name: Show testthat output | |
if: always() | |
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | |
path: check | |