Skip to content

Add installation support for windows #114

Add installation support for windows

Add installation support for windows #114

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
# enable manual triggering
schedule:
# run testing on the first of each month 5am ET / 9am UTC
- cron: '0 9 1 * *'
jobs:
R-build:
strategy:
fail-fast: false
matrix:
R: [ '4.3.1', '4.4.1' ]
os: [ 'macos-15-intel', 'ubuntu-latest', 'windows-latest']
runs-on: ${{ matrix.os }}
name: ${{ matrix.R }} ${{ matrix.os }} build
env:
R_LIBS: ${{ github.workspace }}/Rlibs
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.R }}
- name: System Dependencies
if: startsWith( matrix.os, 'ubuntu' )
run: |
sudo apt-get -y update &&
sudo apt-get install -y libcurl4-openssl-dev libssh2-1-dev libharfbuzz-dev libfribidi-dev gh &&
sudo rm -rf /var/lib/apt/lists/*
- name: Configuration Information
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
mkdir ${R_LIBS}
c++ --version
cmake --version
which R
R --version
- name: Configuration Information (Windows)
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "$env:R_LIBS" | Out-Null
g++ --version
cmake --version
Get-Command R.exe
R.exe --version
- name: Install R packages
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
R -e "install.packages(c('remotes'), lib=c('${R_LIBS}'), repo='https://cloud.r-project.org/')"
- name: Install R packages (Windows)
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: |
Rscript -e "lib <- Sys.getenv('R_LIBS'); lib <- normalizePath(lib, winslash='/', mustWork=FALSE); dir.create(lib, recursive=TRUE, showWarnings=FALSE); install.packages('remotes', lib=lib, repos='https://cloud.r-project.org/')"
Rscript.exe -e "install.packages(c('remotes', 'desc'), repos='https://cloud.r-project.org/')"
- name: Build and test
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
set -x
R -e "remotes::install_git(c('.'), lib=c('${R_LIBS}'), configure.vars=c('"MAKEJ=2"'))"
env:
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
- name: Build and test (Windows)
if: startsWith(matrix.os, 'windows')
shell: pwsh
env:
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
run: |
$env:MAKEJ="4"
Rcmd.exe INSTALL --build .