1313 # run testing on the first of each month 5am ET / 9am UTC
1414 - cron : ' 0 9 1 * *'
1515
16+ # Set minimal permissions for all jobs (read-only)
17+ permissions :
18+ contents : read
19+ actions : read
20+
1621jobs :
1722 R-build :
1823 strategy :
@@ -22,17 +27,15 @@ jobs:
2227 os : [ 'macos-15-intel', 'ubuntu-latest', 'windows-latest']
2328 runs-on : ${{ matrix.os }}
2429 name : ${{ matrix.R }} ${{ matrix.os }} build
25- env :
26- R_LIBS : ${{ github.workspace }}/Rlibs
2730
2831 steps :
29- - uses : actions/checkout@v6
32+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3033 with :
3134 fetch-depth : 0
3235 ref : ${{ github.event.pull_request.head.sha }}
3336
34- - name : Setup R
35- uses : r-lib/actions/setup-r@v2
37+ - name : Setup R (also sets the R_LIBS_USER environment variable)
38+ uses : r-lib/actions/setup-r@a51a8012b0aab7c32ef9d19bf54da93f3254335e # v2.12.0
3639 with :
3740 r-version : ${{ matrix.R }}
3841 - name : System Dependencies
4447 - name : Configuration Information
4548 shell : bash
4649 run : |
47- mkdir -p "$R_LIBS"
4850 cmake --version
4951 if [[ "$RUNNER_OS" == "Windows" ]]; then
5052 ls -d /c/rtools* 2>/dev/null || echo "No rtools found in /c/"
@@ -58,45 +60,48 @@ jobs:
5860 - name : Install R packages
5961 shell : bash
6062 run : |
61- R -e "install.packages(c('remotes', 'pkgbuild' ), lib=Sys.getenv('R_LIBS '), repos='https://cloud.r-project.org/')"
63+ R -e "install.packages(c('remotes'), lib=Sys.getenv('R_LIBS_USER '), repos='https://cloud.r-project.org/')"
6264 - name : Build and test
6365 shell : bash
6466 env :
6567 ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS : 2
6668 run : |
67- R -e "Sys.setenv(MAKEJ=2); remotes::install_git(c('.'), lib=Sys.getenv('R_LIBS '))"
69+ R -e "Sys.setenv(MAKEJ=2); remotes::install_git(c('.'), lib=Sys.getenv('R_LIBS_USER '))"
6870 R -e "library(SimpleITK); Version()"
6971 - name : Create binary package from installed package
7072 id : create_package
7173 shell : bash
7274 run : |
7375 # Get the R version for naming
74- R_VERSION="${{ matrix.R }}"
75- R_VERSION_SHORT=$(echo $R_VERSION | cut -d'.' -f1,2)
76+ R_VERSION_SHORT=$(echo "${{ matrix.R }}" | cut -d'.' -f1,2)
77+
78+ # Get package version from DESCRIPTION
79+ PKG_VERSION=$(Rscript -e "cat(read.dcf(file.path(Sys.getenv('R_LIBS_USER'), 'SimpleITK', 'DESCRIPTION'), 'Version')[1])")
80+
7681 # Create output directory for artifacts
7782 mkdir -p artifacts
78- # Build binary package from the installed package (no recompilation needed)
79- # The configure script already built everything and remotes::install_git installed it
80- R -e "pkg <- file.path(Sys.getenv('R_LIBS'), 'SimpleITK'); pkgbuild::build(pkg, dest_path='artifacts', binary=TRUE)"
81- # Rename with descriptive platform info
83+
84+ # Create binary package archive from installed package (no recompilation)
85+ cd "${R_LIBS_USER}"
8286 if [[ "$RUNNER_OS" == "macOS" ]]; then
83- PKG_FILE=$(ls artifacts/ SimpleITK_* .tgz)
84- NEW_NAME= "${PKG_FILE%.tgz}_R${R_VERSION_SHORT}_macos-x86_64.tgz"
87+ PKG_NAME=" SimpleITK_${PKG_VERSION}_R${R_VERSION_SHORT}_macos-x86_64 .tgz"
88+ tar czf "${GITHUB_WORKSPACE}/artifacts/${PKG_NAME}" SimpleITK
8589 elif [[ "$RUNNER_OS" == "Linux" ]]; then
86- PKG_FILE=$(ls artifacts/ SimpleITK_* .tar.gz)
87- NEW_NAME= "${PKG_FILE%.tar.gz}_R${R_VERSION_SHORT}_linux-x86_64.tar.gz"
90+ PKG_NAME=" SimpleITK_${PKG_VERSION}_R${R_VERSION_SHORT}_linux-x86_64 .tar.gz"
91+ tar czf "${GITHUB_WORKSPACE}/artifacts/${PKG_NAME}" SimpleITK
8892 elif [[ "$RUNNER_OS" == "Windows" ]]; then
89- PKG_FILE=$(ls artifacts/ SimpleITK_* .zip)
90- NEW_NAME= "${PKG_FILE%.zip}_R${R_VERSION_SHORT}_windows-x86_64.zip"
93+ PKG_NAME=" SimpleITK_${PKG_VERSION}_R${R_VERSION_SHORT}_windows-x86_64 .zip"
94+ 7z a -tzip "${GITHUB_WORKSPACE}/artifacts/${PKG_NAME}" SimpleITK
9195 fi
92- mv "$PKG_FILE" "$NEW_NAME"
96+
97+ cd "${GITHUB_WORKSPACE}"
9398 ls -lh artifacts/
9499
95100 # Export PKG_NAME as output for use in upload step
96101 echo "pkg_name=${PKG_NAME}" >> $GITHUB_OUTPUT
97102 - name : Upload binary package
98103 if : steps.create_package.outcome == 'success'
99- uses : actions/upload-artifact@v4
104+ uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
100105 with :
101106 name : ${{ steps.create_package.outputs.pkg_name }}
102107 path : artifacts/*
@@ -114,7 +119,7 @@ jobs:
114119
115120 steps :
116121 - name : Checkout repository
117- uses : actions/checkout@v6
122+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
118123 with :
119124 fetch-depth : 1
120125
@@ -133,7 +138,7 @@ jobs:
133138
134139 - name : Download all artifacts
135140 if : steps.verify_tag.outputs.draft_release == 'true'
136- uses : actions/download-artifact@v4
141+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
137142 with :
138143 path : release-artifacts
139144 pattern : SimpleITK_*
@@ -149,7 +154,7 @@ jobs:
149154 # or updates it if it does.
150155 - name : Create or Update Draft Release
151156 if : steps.verify_tag.outputs.draft_release == 'true'
152- uses : softprops/action-gh-release@v2
157+ uses : softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0
153158 env :
154159 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
155160 with :
0 commit comments