Skip to content

Commit

Permalink
Merge pull request #1525 from sonos/fix-ci-syntax
Browse files Browse the repository at this point in the history
metal on CI ?
  • Loading branch information
kali authored Sep 14, 2024
2 parents e85abd8 + 0caeaeb commit bfa357f
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 40 deletions.
44 changes: 14 additions & 30 deletions .github/workflows/beta-and-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,55 +54,39 @@ jobs:
rust: [ 1.75.0, beta ]
os: [ ubuntu-latest, macOS-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
RUSTFLAGS: "-D warnings"
RUST_VERSION: ${{matrix.rust}}
steps:
- uses: actions/checkout@v3
- name: Rustup update
run: rustup update
- name: LLVM setup
run: sudo apt-get install -y llvm
- name: cargo check, -D warnings
if: runner.os == 'Linux'
env:
RUSTFLAGS: "-D warnings"
RUST_VERSION: ${{matrix.rust}}
run: |
rustc --version
cargo check --exclude tract-metal --exclude test-metal --workspace
ROOT=. .travis/ci-system-setup.sh
- name: cargo check, -D warnings
if: runner.os == 'macOS'
env:
RUSTFLAGS: "-D warnings"
RUST_VERSION: ${{matrix.rust}}
run: |
rustc --version
cargo check
if: runner.os == 'Linux'
run: cargo check -p test-tflite

cargo-clippy:
strategy:
matrix:
os: [ ubuntu-latest, macOS-latest ]
rust: [ stable, beta, nightly ]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
RUST_VERSION: ${{matrix.rust}}
RUSTFLAGS: "-D warnings --force-warn unknown_lints"
ROOT: .
steps:
- uses: actions/checkout@v3
- name: Rustup update, install clippy
run: |
ROOT=. .travis/ci-system-setup.sh
.travis/ci-system-setup.sh
rustup +${{matrix.rust}} component add clippy
env:
RUST_VERSION: ${{matrix.rust}}
- name: Run cargo-clippy
if: runner.os == 'Linux'
run: cargo clippy --exclude tract-metal --exclude test-metal --workspace
env:
RUSTFLAGS: "-D warnings --force-warn unknown_lints"
RUST_VERSION: ${{matrix.rust}}
- name: Run cargo-clippy
if: runner.os == 'macOS'
run: cargo clippy
env:
RUSTFLAGS: "-D warnings --force-warn unknown_lints"
RUST_VERSION: ${{matrix.rust}}
run: cargo clippy -p test-tflite

cargo-deny:
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
- name: Check all targets
run: |
ROOT=$(pwd) ./.travis/ci-system-setup.sh
cargo check --all-targets --exclude tract-metal --exclude test-metal --workspace
cargo check --all-targets --workspace --exclude test-metal --exclude tract-metal
cli-tests:
runs-on: ubuntu-latest
Expand Down
9 changes: 9 additions & 0 deletions .travis/regular-tests.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
#!/bin/sh

set -e
set -x

cd $(dirname $0)

./test-published-crates.sh
if [ -n "$CI" ]
then
cargo clean
fi
./test-rt.sh
if [ -n "$CI" ]
then
cargo clean
fi
./test-harness.sh
5 changes: 3 additions & 2 deletions .travis/test-published-crates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,23 @@ fi

set +x

for c in data linalg core nnef hir onnx pulse onnx-opl pulse-opl rs proxy
for c in data linalg core nnef hir onnx pulse onnx-opl pulse-opl rs
do
echo
echo "$WHITE ### $c ### $NC"
echo
cargo -q test $CARGO_EXTRA -q -p tract-$c
done

if [ `uname` = "Darwin" ]
if [ `uname` = "Darwin" -a -z "$CI" ]
then
echo
echo "$WHITE ### metal ### $NC"
echo
cargo -q test $CARGO_EXTRA -q -p tract-metal
fi

$ROOT/api/proxy/ci.sh

# doc test are not finding libtensorflow.so
if ! cargo -q test $CARGO_EXTRA -q -p tract-tensorflow --lib $ALL_FEATURES
Expand Down
7 changes: 6 additions & 1 deletion .travis/test-rt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ do
if [ "$c" = "test-rt/test-tflite" ]
then
echo "$WHITE ### $c ### IGNORED $NC"
elif [ "$c" = "test-rt/test-metal" -a `uname` != "Darwin" ]
elif [ "$c" = "test-rt/test-metal" -a \( `uname` != "Darwin" -o -n "$CI" \) ]
then
echo "$WHITE ### $c ### IGNORED $NC"
else
echo
echo "$WHITE ### $c ### $NC"
echo
(cd $c; cargo test -q $CARGO_EXTRA)
if [ -n "$CI" ]
then
df -h
cargo clean
fi
fi
done

55 changes: 52 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,16 @@ members = [
"nnef",
"nnef/nnef-resources",
"tensorflow",
"tflite",
"onnx-opl",
"onnx",
"libcli",
"cli",
"metal",
"extra",

"tflite",

"metal",


"api",
"api/rs",
"api/ffi",
Expand Down Expand Up @@ -59,6 +57,57 @@ members = [
"test-rt/test-tflite"
]

# same, without metal, test-metal and test-tflite which are probelematic on specific targets
default-members = [
"data",
"linalg",
"core",
"pulse",
"pulse-opl",
"hir",
"nnef",
"nnef/nnef-resources",
"tensorflow",
"tflite",
"onnx-opl",
"onnx",
"libcli",
"cli",
"extra",

"api",
"api/rs",
"api/ffi",

"examples/face_detection_yolov8onnx_example",
"examples/face_similarity_arcface_onnx",
"examples/tensorflow-mobilenet-v2",
"examples/tflite-mobilenet-v3",
"examples/keras-tract-tf2",
"examples/nnef-dump-mobilenet-v2",
"examples/nnef-mobilenet-v2",
"examples/onnx-mobilenet-v2",
"examples/pytorch-albert-v2",
"examples/pytorch-resnet",

"harness/core-proptest-pulse",
"harness/lstm-proptest-onnx-vs-tf",
"harness/nnef-inceptionv3",
"harness/tf-inceptionv3",
"harness/tf-mobilenet-v2",
"harness/tf-moz-deepspeech",
"harness/tfl-mobilenet-v2-q",

"test-rt/infra",
"test-rt/suite-unit",
"test-rt/suite-onnx",
"test-rt/test-f16",
"test-rt/test-blas",
"test-rt/test-unit-core",
"test-rt/test-onnx-core",
"test-rt/test-nnef-cycle",
]

[workspace.dependencies]
accelerate-src = "0.3"
ansi_term = "0.12.1"
Expand Down
12 changes: 12 additions & 0 deletions api/proxy/ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

ROOT=$(dirname $(realpath $0))/../..

set -ex

cargo build --release -p tract-ffi
export TRACT_DYLIB_SEARCH_PATH=$ROOT/target/release
export LD_LIBRARY_PATH=$ROOT/target/release

cd $(dirname $(realpath $0))
cargo test
3 changes: 0 additions & 3 deletions api/proxy/sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,3 @@ edition = "2021"
rust-version = "1.75"
include = [ "Cargo.toml", "src/**/*.rs", "LICENSE*", "build.rs", "tract.h", "bindings.rs" ]


[dependencies]
tract-ffi = { path = "../../ffi" , version = "=0.21.7-pre" }
3 changes: 3 additions & 0 deletions api/proxy/sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
fn main() {
if let Ok(path) = std::env::var("TRACT_DYLIB_SEARCH_PATH") {
println!("cargo:rustc-link-search={path}");
}
println!("cargo:rustc-link-lib=tract");
}
1 change: 1 addition & 0 deletions cli/src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use tract_core::ops::konst::Const;
use tract_itertools::Itertools;
use tract_libcli::profile::BenchLimits;
use tract_nnef::tensors::read_tensor;
#[allow(unused_imports)]
use tract_core::transform::ModelTransform;
use tract_core::internal::*;
use tract_core::model::TypedModel;
Expand Down

0 comments on commit bfa357f

Please sign in to comment.