Skip to content

Commit b8cce57

Browse files
committed
Streamline GH workflow and harmonize instructions across OSs.
Use bash as the shell for all OS instead of bash for macos/linux and pwsh for windows. Instead of passing environment variables via configure.vars to remotes::install_git, set them via Sys.setenv() in R before calling install_git. This works across all OSs. For some reason configure.vars set the environment variables on linux/mac but not on windows.
1 parent c308415 commit b8cce57

2 files changed

Lines changed: 16 additions & 35 deletions

File tree

.github/workflows/main.yml

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,44 +42,24 @@ jobs:
4242
sudo apt-get install -y libcurl4-openssl-dev libssh2-1-dev libharfbuzz-dev libfribidi-dev gh &&
4343
sudo rm -rf /var/lib/apt/lists/*
4444
- name: Configuration Information
45-
if: runner.os == 'Linux' || runner.os == 'macOS'
45+
shell: bash
4646
run: |
47-
mkdir ${R_LIBS}
48-
c++ --version
47+
mkdir -p "$R_LIBS"
4948
cmake --version
49+
if [[ "$RUNNER_OS" == "Windows" ]]; then
50+
g++ --version
51+
else
52+
c++ --version
53+
fi
5054
which R
5155
R --version
52-
- name: Configuration Information (Windows)
53-
if: startsWith(matrix.os, 'windows')
54-
shell: pwsh
55-
run: |
56-
New-Item -ItemType Directory -Force -Path "$env:R_LIBS" | Out-Null
57-
g++ --version
58-
cmake --version
59-
Get-Command R.exe
60-
R.exe --version
6156
- name: Install R packages
62-
if: runner.os == 'Linux' || runner.os == 'macOS'
63-
run: |
64-
R -e "install.packages(c('remotes'), lib=c('${R_LIBS}'), repos='https://cloud.r-project.org/')"
65-
- name: Install R packages (Windows)
66-
if: startsWith(matrix.os, 'windows')
67-
shell: pwsh
57+
shell: bash
6858
run: |
69-
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/')"
70-
Rscript.exe -e "install.packages(c('remotes', 'desc'), repos='https://cloud.r-project.org/')"
59+
R -e "install.packages(c('remotes'), lib=Sys.getenv('R_LIBS'), repos='https://cloud.r-project.org/')"
7160
- name: Build and test
72-
if: runner.os == 'Linux' || runner.os == 'macOS'
73-
run: |
74-
set -x
75-
R -e "remotes::install_git(c('.'), lib=c('${R_LIBS}'), configure.vars=c('"MAKEJ=2"'))"
76-
env:
77-
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
78-
- name: Build and test (Windows)
79-
if: startsWith(matrix.os, 'windows')
80-
shell: pwsh
61+
shell: bash
8162
env:
8263
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
8364
run: |
84-
$env:MAKEJ="3"
85-
Rcmd.exe INSTALL --build .
65+
R -e "Sys.setenv(MAKEJ=2); remotes::install_git(c('.'), lib=Sys.getenv('R_LIBS'))"

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ remotes::install_github("SimpleITK/SimpleITKRInstaller")
1515
Turn on mutlicore compilation, six cores in this example
1616

1717
```R
18-
remotes::install_github("SimpleITK/SimpleITKRInstaller", configure.vars=c("MAKEJ=6"))
18+
Sys.setenv(MAKEJ=6)
19+
remotes::install_github("SimpleITK/SimpleITKRInstaller")
1920
```
2021

2122
Use multicore compilation and build additional modules not included in the default build setup such as SimpleElastix (registration) and DCMTK (additional DICOM IO option beyond the default GDCM).
2223

23-
**Note**: We need to use backslashes to escape the spaces in the `ADDITIONAL_SITK_MODULES` otherwise the `remotes::install` does not pass the string correctly to the shell (separates it using the spaces instead of passing as one string).
24-
2524
```R
26-
remotes::install_github("SimpleITK/SimpleITKRInstaller", configure.vars=c("MAKEJ=6", "ADDITIONAL_SITK_MODULES=-DSimpleITK_USE_ELASTIX=ON\\ -DModule_ITKIODCMTK:BOOL=ON"))
25+
Sys.setenv(MAKEJ=6)
26+
Sys.setenv(ADDITIONAL_SITK_MODULES="-DSimpleITK_USE_ELASTIX=ON -DModule_ITKIODCMTK:BOOL=ON")
27+
remotes::install_github("SimpleITK/SimpleITKRInstaller")
2728
```
2829

2930
Note:

0 commit comments

Comments
 (0)