Skip to content

Commit

Permalink
Updated ci stuff and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bnaras committed May 6, 2023
1 parent 22955ad commit 9a77ecd
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 13 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Expand Up @@ -35,20 +35,20 @@ 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'}
# - {os: macOS-latest, r: 'devel', rust-version: 'stable'}
# - {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'}



Expand Down
13 changes: 6 additions & 7 deletions README.md
Expand Up @@ -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


71 changes: 71 additions & 0 deletions 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
#>

}

0 comments on commit 9a77ecd

Please sign in to comment.