-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (135 loc) · 4.59 KB
/
Copy pathrelease.yml
File metadata and controls
165 lines (135 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
on:
push:
name: R-release
jobs:
metadata:
name: Read package metadata
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.5.2'
- name: Extract version from DESCRIPTION
id: meta
run: |
VERSION="$(Rscript -e 'x <- read.dcf("DESCRIPTION"); cat(x[1,"Version"])')"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Detected version: $VERSION"
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.version }}
name: ${{ steps.meta.outputs.version }}
draft: true
build:
name: Build R package on ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
needs: metadata
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
_R_CHECK_TESTS_NLINES_: 0
NOT_CRAN: true
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: true
_R_CHECK_FORCE_SUGGESTS_: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_LIBS: ${{ github.workspace }}/Rlibs
strategy:
fail-fast: false
matrix:
config:
# - {os: macos-15-intel, r: 'release', build: 'binary'}
- {os: windows-latest, r: 'release', build: 'binary'}
- {os: ubuntu-latest, r: 'release', build: 'source'}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- name: Configuration Information
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
mkdir ${R_LIBS}
c++ --version
cmake --version
which R
R --version
- name: Install R packages
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
R -e "install.packages(c('remotes', 'desc'), lib=c('${R_LIBS}'), repo='https://cloud.r-project.org/')"
- name: Make source (Linux)
if: runner.os == 'Linux'
run: |
set -x
R CMD build . --no-manual
env:
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
- name: Build Package (macOS)
if: runner.os == 'macOS'
run: |
set -x
R CMD INSTALL --build -l ${R_LIBS} --configure-vars='MAKEJ=8' .
env:
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
- name: Configuration Information (Windows)
if: startsWith(matrix.config.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 (Windows)
if: startsWith(matrix.config.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 Package (Windows)
if: startsWith(matrix.config.os, 'windows')
shell: pwsh
env:
ITK_GLOBAL_DEFAULT_NUMBER_OF_THREADS: 2
run: |
$env:MAKEJ="8"
$env:ADDITIONAL_SITK_MODULES="-DSimpleITK_USE_ELASTIX=ON"
Rcmd.exe INSTALL --build .
- name: Collect artifacts
shell: bash
run: |
mkdir -p dist
mv *.zip *.tgz *.tar.gz dist/ 2>/dev/null || true
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: r-${{ matrix.config.os }}
path: dist/*
release:
name: Create GitHub Release
runs-on: ubuntu-22.04
needs: [metadata, build]
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Inspect release assets
run: ls -R dist
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.metadata.outputs.version }}
name: ${{ needs.metadata.outputs.version }}
draft: true
files: dist/**/*