diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa9c882..727e3b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,9 +35,9 @@ jobs: # * for R < 4.2, the MSVC toolchain must be used to support # cross-compilation for the 32-bit. - {os: windows-latest, r: 'release', rust-version: 'stable-msvc', rtools-version: '42'} - - {os: windows-latest, r: 'devel', rust-version: 'stable-msvc'} - - {os: windows-latest, r: 'release', rust-version: 'stable-gnu', rtools-version: '42'} - - {os: windows-latest, r: '4.1', rust-version: 'stable-msvc'} # TODO: Remove this runner when we drop the support for R < 4.2 + # - {os: windows-latest, r: 'devel', rust-version: 'stable-msvc'} + # - {os: windows-latest, r: 'release', rust-version: 'stable-gnu', rtools-version: '42'} + # - {os: windows-latest, r: '4.1', rust-version: 'stable-msvc'} # TODO: Remove this runner when we drop the support for R < 4.2 - {os: macOS-latest, r: 'release', rust-version: 'stable'} # - {os: macOS-latest, r: 'release', rust-version: 'nightly'} @@ -45,10 +45,10 @@ jobs: # - {os: macOS-latest, r: 'oldrel', rust-version: 'stable'} - {os: ubuntu-latest, r: 'release', rust-version: 'stable', check_fmt: true} - - {os: ubuntu-latest, r: 'release', rust-version: 'nightly'} + # - {os: ubuntu-latest, r: 'release', rust-version: 'nightly'} # R-devel requires LD_LIBRARY_PATH - - {os: ubuntu-latest, r: 'devel', rust-version: 'stable'} - - {os: ubuntu-latest, r: 'oldrel', rust-version: 'stable'} + # - {os: ubuntu-latest, r: 'devel', rust-version: 'stable'} + # - {os: ubuntu-latest, r: 'oldrel', rust-version: 'stable'} diff --git a/README.md b/README.md index 099c277..9a9ac4d 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,15 @@ Your contribution is highly appreciated. Do not hesitate to open an issue or a pull request. Note that any contribution submitted for inclusion in the project will be licensed according to the terms given in [LICENSE.md](LICENSE.md). -[accelerate]: https://developer.apple.com/documentation/accelerate [architecture]: https://blas-lapack-rs.github.io/architecture [blas]: https://en.wikipedia.org/wiki/BLAS [lapack]: https://en.wikipedia.org/wiki/LAPACK -[build-img]: https://travis-ci.org/blas-lapack-rs/accelerate-src.svg?branch=master -[build-url]: https://travis-ci.org/blas-lapack-rs/accelerate-src -[documentation-img]: https://docs.rs/accelerate-src/badge.svg -[documentation-url]: https://docs.rs/accelerate-src -[package-img]: https://img.shields.io/crates/v/accelerate-src.svg -[package-url]: https://crates.io/crates/accelerate-src +[build-img]: https://travis-ci.org/blas-lapack-rs/r-blas-lapack-src.svg?branch=master +[build-url]: https://travis-ci.org/blas-lapack-rs/r-blas-lapack-src +[documentation-img]: https://docs.rs/r-blas-lapack-src/badge.svg +[documentation-url]: https://docs.rs/r-blas-lapack-src +[package-img]: https://img.shields.io/crates/v/r-blas-lapack-src.svg +[package-url]: https://crates.io/crates/r-blas-lapack-src diff --git a/ci-cargo.ps1 b/ci-cargo.ps1 new file mode 100644 index 0000000..0e5adfd --- /dev/null +++ b/ci-cargo.ps1 @@ -0,0 +1,71 @@ +function ci-cargo { + + param( + [Parameter(Position = 0, ValueFromRemainingArguments)] + [String[]] + $CargoArgs, + [String] + $ActionName + ) + + + try { + echo "::group::$ActionName" + echo "Running cargo $CargoArgs" + cargo $CargoArgs + if($LASTEXITCODE -ne 0) { + throw $LASTEXITCODE + } + } + catch { + if ($ActionName -ne $null -and $ActionName -ne "") { + $ActionName = "'$ActionName': " + } + $err_msg = "$($ActionName)cargo failed with code $LASTEXITCODE (args: $CargoArgs)" + echo "::error::$err_msg" + Write-Error -Message "$err_msg" -ErrorAction Stop + } + finally { + echo "::endgroup::" + } + + <# + .SYNOPSIS + Runs cargo with specified args, adapting error handling and output to CI. + + .DESCRIPTION + Runs cargo in a `try` block, catches exceptions and non-zero exit codes. + Explicitly logs the beginning and the end of cargo execution, as well as the error message. + + .PARAMETER CargoArgs + Arguments passed to cargo, as-is. + Note that `--` separator is handled by powershell itself, + so it should be wrapped in quotes `'--'` and passed as string. + + .PARAMETER ActionName + Optional string that is used to format logs and error messages. + + .INPUTS + None. You cannot pipe objects. + + .OUTPUTS + No explicit output. + + .EXAMPLE + PS> ci-cargo --version + ::group:: + Running cargo --version + cargo 1.49.0 (d00d64df9 2020-12-05) + ::endgroup:: + + .EXAMPLE + PS> ci-cargo -ActioName "Build" build + + .EXAMPLE + PS> ci-cargo +stable-x86_64-pc-windows-gnu test --features tests-all --target i686-pc-windows-gnu '--' --nocapture -ActionName "Called from documentation" + + .LINK + Used by: https://github.com/extendr/extendr + #> + +}