Skip to content

Commit e2a8cdb

Browse files
Add CI pipelines to run all examples using openblas (#1)
* Add CI pipelines to run all examples using openblas * Point to the right script * Another stupid typo * Cargo fmt * Use proper bash if statement
1 parent 7ee3c80 commit e2a8cdb

File tree

4 files changed

+66
-4
lines changed

4 files changed

+66
-4
lines changed

.travis.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
language: rust
2+
# use trusty for newer openblas
3+
sudo: required
4+
dist: trusty
5+
matrix:
6+
include:
7+
- rust: 1.32.0
8+
env:
9+
- FEATURES='openblas'
10+
- RUSTFLAGS='-D warnings'
11+
- rust: stable
12+
env:
13+
- FEATURES='openblas'
14+
- RUSTFLAGS='-D warnings'
15+
- rust: beta
16+
env:
17+
- FEATURES='openblas'
18+
- CHANNEL='beta'
19+
- RUSTFLAGS='-D warnings'
20+
- rust: nightly
21+
env:
22+
- FEATURES='openblas'
23+
- CHANNEL='nightly'
24+
env:
25+
global:
26+
- HOST=x86_64-unknown-linux-gnu
27+
- CARGO_INCREMENTAL=0
28+
addons:
29+
apt:
30+
packages:
31+
- libopenblas-dev
32+
- gfortran
33+
script:
34+
- ./test.sh "$FEATURES" "$CHANNEL"

linear_regression/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ impl LinearRegression {
6262
///
6363
/// **Panics** if `self` has not be `fit`ted before calling `predict.
6464
pub fn predict<A>(&self, X: &ArrayBase<A, Ix2>) -> Array1<f64>
65-
where
66-
A: Data<Elem = f64>,
65+
where
66+
A: Data<Elem = f64>,
6767
{
6868
let (n_samples, _) = X.dim();
6969

linear_regression/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#![allow(non_snake_case)]
2-
use ndarray::{Array1, Array2, Array, Axis};
2+
use ndarray::{Array, Array1, Array2, Axis};
33
use ndarray_linalg::random;
4-
use ndarray_stats::DeviationExt;
54
use ndarray_rand::RandomExt;
5+
use ndarray_stats::DeviationExt;
66
use rand::distributions::StandardNormal;
77

88
// Import LinearRegression from other file ("lib.rs") in this example

test.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
set -x
4+
set -e
5+
6+
FEATURES=$1
7+
CHANNEL=$2
8+
9+
if [[ "$CHANNEL" != "beta" ]]; then
10+
rustup component add rustfmt
11+
cargo fmt --all -- --check
12+
rustup component add clippy
13+
fi
14+
15+
# Loop over the directories in the project, skipping the target directory
16+
for f in *; do
17+
if [[ -d ${f} ]] && [[ ${f} != "target" ]]; then
18+
# Will not run if no directories are available
19+
echo "\n\nTesting '${f}' example.\n\n"
20+
cd ${f}
21+
cargo run --features "${FEATURES}"
22+
if [[ "$CHANNEL" != "beta" ]]; then
23+
cargo clippy -- -D warnings
24+
fi
25+
cd ..
26+
fi
27+
done
28+

0 commit comments

Comments
 (0)