Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch CI to GitHub Actions #40

Merged
merged 12 commits into from
Aug 26, 2020
89 changes: 89 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Rust

on:
push:
branches:
- master
pull_request: {}

jobs:
windows-msvc:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
feature:
- system
- "system,static"
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v2
with:
path: ./vcpkg
key: vcpkg-openblas
- name: Install vcpkg
run: |
git clone https://github.com/Microsoft/vcpkg.git --depth 1
cd vcpkg
./bootstrap-vcpkg.bat
- name: Install static OpenBLAS by vcpkg
run: |
./vcpkg/vcpkg.exe install openblas:x64-windows-static
if: ${{ matrix.feature == 'system,static' }}
- name: Install OpenBLAS by vcpkg
run: |
./vcpkg/vcpkg.exe install openblas:x64-windows
if: ${{ matrix.feature == 'system' }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=${{ matrix.feature }}
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg

macos:
runs-on: macos-10.15
strategy:
fail-fast: false
matrix:
feature:
- ""
- static
- system
steps:
- uses: actions/checkout@v1
with:
submodules: 'recursive'
- name: Install OpenBLAS by homebrew
run: |
brew install openblas
if: ${{ contains(matrix.feature, 'system') }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=${{ matrix.feature }}

linux:
runs-on: ubuntu-18.04
container:
image: rust
strategy:
fail-fast: false
matrix:
feature:
- ""
- static
- system
steps:
- uses: actions/checkout@v1
with:
submodules: 'recursive'
- name: Install OpenBLAS by apt
run: |
apt update
apt install -y libopenblas-dev
if: ${{ contains(matrix.feature, 'system') }}
- uses: actions-rs/cargo@v1
with:
command: test
args: --features=${{ matrix.feature }}
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

25 changes: 0 additions & 25 deletions appveyor.yml

This file was deleted.

49 changes: 49 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,55 @@ fn main() {
#[cfg(target_env = "msvc")]
vcpkg::find_package("openblas").unwrap();
}

// Add path where pacman (on msys2) install OpenBLAS
//
// - `pacman -S mingw-w64-x86_64-openblas` will install
// - `libopenbla.dll` into `/mingw64/bin`
// - `libopenbla.a` into `/mingw64/lib`
// - But we have to specify them using `-L` in **Windows manner**
// - msys2 `/` is `C:\msys64\` in Windows by default install
// - It can be convert using `cygpath` command
if cfg!(target_os = "windows") && cfg!(target_env = "gnu") {
if kind == "dylib" {
let lib_path = String::from_utf8(
Command::new("cygpath")
.arg("-w")
.arg("/mingw64/bin")
.output()
.expect("Failed to exec cygpath")
.stdout,
)
.unwrap();
println!("cargo:rustc-link-search={}", lib_path);
} else {
let lib_path = String::from_utf8(
Command::new("cygpath")
.arg("-w")
.arg("/mingw64/lib")
.output()
.expect("Failed to exec cygpath")
.stdout,
)
.unwrap();
println!("cargo:rustc-link-search={}", lib_path);
}
}

// homebrew will says
//
// > openblas is keg-only, which means it was not symlinked into /usr/local,
// > because macOS provides BLAS in Accelerate.framework.
// > For compilers to find openblas you may need to set:
//
// ```
// export LDFLAGS="-L/usr/local/opt/openblas/lib"
// export CPPFLAGS="-I/usr/local/opt/openblas/include"
// ```
//
if cfg!(target_os = "macos") {
println!("cargo:rustc-link-search=/usr/local/opt/openblas/lib");
}
} else {
if cfg!(target_env = "msvc") {
panic!("Non-vcpkg builds are not supported on Windows (you must use the \"system\" feature.")
Expand Down