@@ -135,12 +135,13 @@ jobs:
135
135
id : build
136
136
run : |
137
137
foreach ($target in ($env:RUST_TARGETS).Split(",")) {
138
- echo "Building for target: $target"
138
+ echo "::group:: Building for target: $target"
139
139
cargo build -vv --features use-bindgen $(if ($target -ne 'default') {"--target=$target"} )
140
140
if (!$?) {
141
- echo "::error::$target" ;
141
+ echo "::error::Building for target: $target" ;
142
142
throw "Last exit code $LASTEXITCODE"
143
143
}
144
+ echo "::endgroup::"
144
145
}
145
146
env :
146
147
LIBRSYS_BINDINGS_OUTPUT_PATH : generated_bindings
@@ -154,12 +155,13 @@ jobs:
154
155
echo "::warning:: Skipping bindgen tests for target: $target"
155
156
}
156
157
else {
157
- echo "Running bindgen tests for target: $target"
158
+ echo "::group:: Running bindgen tests for target: $target"
158
159
cargo test -vv --features use-bindgen $(if ($target -ne 'default') {"--target=$target"} ) -- --nocapture --test-threads=1
159
160
if (!$?) {
160
- echo "::error::$target";
161
+ echo "::error::Running bindgen tests for target: $target";
161
162
throw "Last exit code $LASTEXITCODE"
162
163
}
164
+ echo "::endgroup::"
163
165
}
164
166
}
165
167
env :
@@ -190,13 +192,105 @@ jobs:
190
192
echo "::warning:: Skipping tests for target: $target"
191
193
}
192
194
else {
193
- echo "Running tests for target: $target"
195
+ echo "::group:: Running tests for target: $target"
194
196
cargo test -vv $(if ($target -ne 'default') {"--target=$target"} ) -- --nocapture --test-threads=1
195
197
if (!$?) {
196
- echo "::error::$target";
198
+ echo "::error::Running tests for target: $target";
197
199
throw "Last exit code $LASTEXITCODE"
198
200
}
201
+ echo "::endgroup::"
199
202
}
200
203
}
201
204
env :
202
205
NO_TEST_TARGETS : ${{ join(matrix.config.no-test-targets, ',') }}
206
+
207
+ test_windows_rtools :
208
+ runs-on : ${{ matrix.config.os }}
209
+
210
+ name : ${{ matrix.config.os }} (R-${{ matrix.config.r }} rust-${{ matrix.config.rust-version }}) \w RTOOLS
211
+
212
+ strategy :
213
+ fail-fast : false
214
+ matrix :
215
+ config :
216
+ - {os: windows-latest, r: 'release', rust-version: 'stable-msvc', targets: ['x86_64-pc-windows-gnu', 'i686-pc-windows-gnu']}
217
+
218
+ env :
219
+ RSPM : ${{ matrix.config.rspm }}
220
+
221
+ # PowerShell core is available on all platforms and can be used to unify scripts
222
+ defaults :
223
+ run :
224
+ shell : pwsh
225
+
226
+ steps :
227
+
228
+ - uses : actions/checkout@v2
229
+
230
+ - name : Set up R
231
+ uses : r-lib/actions/setup-r@v1
232
+ with :
233
+ r-version : ${{ matrix.config.r }}
234
+
235
+ - name : Set up Rust
236
+ uses : actions-rs/toolchain@v1
237
+ with :
238
+ toolchain : ${{ matrix.config.rust-version }}
239
+ default : true
240
+ components : rustfmt, clippy
241
+
242
+ - name : Configure targets
243
+ run : |
244
+ if ($env:RUST_TARGETS -eq '') {
245
+ $env:RUST_TARGETS = "default"
246
+ }
247
+ foreach ($target in ($env:RUST_TARGETS).Split(",")) {
248
+ if ($target -ne "default") {
249
+ rustup target add $target
250
+ }
251
+ }
252
+ echo "RUST_TARGETS=$env:RUST_TARGETS" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
253
+ env :
254
+ RUST_TARGETS : ${{ join(matrix.config.targets, ',')}}
255
+
256
+ # All configurations for Windows go here
257
+ # Rust toolchain is used to determine target architecture
258
+ - name : Configure Windows
259
+ if : runner.os == 'Windows'
260
+ # 1. Configure path to libclang
261
+ # 2. Add path to mingw32/mingw64 -- otherwise library is linked to rtools
262
+ # 3. Add path to R's i386/x64 -- to solve x86 build/test issue
263
+ run : |
264
+ if ($env:RUST_TARGETS -like "*x86_64*") {
265
+ <# Amend rtools libgcc_eh.a #>
266
+ cp C:\rtools40\mingw64\lib\gcc\x86_64-w64-mingw32\8.3.0\libgcc.a C:\rtools40\mingw64\lib\gcc\x86_64-w64-mingw32\8.3.0\libgcc_eh.a
267
+ echo "C:\rtools40\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
268
+ echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\x64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
269
+ }
270
+ if ($env:RUST_TARGETS -like "*i686*") {
271
+ echo "C:\rtools40\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
272
+ echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\i386" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ;
273
+ }
274
+
275
+
276
+ # Run tests again using different bindings
277
+ - name : Run tests on precomputed bindings shipped with libR-sys
278
+ run : |
279
+ foreach ($target in ($env:RUST_TARGETS).Split(",")) {
280
+ if(($env:NO_TEST_TARGETS).Split(",").Contains($target)) {
281
+ echo "::warning:: Skipping tests for target: $target"
282
+ }
283
+ else {
284
+ echo "::group::Running tests for target: $target"
285
+ cargo test -vv $(if ($target -ne 'default') {"--target=$target"} ) -- --nocapture --test-threads=1
286
+ if (!$?) {
287
+ echo "::error::Running tests for target: $target";
288
+ throw "Last exit code $LASTEXITCODE"
289
+ }
290
+ echo "::endgroup::"
291
+ }
292
+ }
293
+ env :
294
+ NO_TEST_TARGETS : ${{ join(matrix.config.no-test-targets, ',') }}
295
+
296
+
0 commit comments