diff --git a/.github/actions/setup-env.sh b/.github/actions/setup-env.sh new file mode 100755 index 0000000..28b256c --- /dev/null +++ b/.github/actions/setup-env.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -xe + +ONNXRUNTIME_VERSION=${ONNXRUNTIME_VERSION:-1.2.0} + +ONNXRUNTIME_RELEASE="onnxruntime-linux-x64-${ONNXRUNTIME_VERSION}" +ONNXRUNTIME_RELEASE_URL="https://github.com/microsoft/onnxruntime/releases/download/v${ONNXRUNTIME_VERSION}/${ONNXRUNTIME_RELEASE}.tgz" + +curl -L "$ONNXRUNTIME_RELEASE_URL" --output "$ONNXRUNTIME_RELEASE.tgz" + +tar -xzf "$ONNXRUNTIME_RELEASE.tgz" "$ONNXRUNTIME_RELEASE" + +export ONNXRUNTIME_LIB_DIR="$PWD/$ONNXRUNTIME_RELEASE/lib/" +export ONNXRUNTIME_INCLUDE_DIR="$PWD/$ONNXRUNTIME_RELEASE/include" diff --git a/.github/workflows/cargo-ci.yml b/.github/workflows/cargo-ci.yml new file mode 100644 index 0000000..2334ddc --- /dev/null +++ b/.github/workflows/cargo-ci.yml @@ -0,0 +1,72 @@ +name: "Cargo CI" +on: [pull_request, push] + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Run cargo check + uses: actions-rs/cargo@v1 + with: + command: check + args: -- --examples --tests --bins + + test: + name: Test Suite + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: Install onnxruntime dependency + uses: ./.github/actions/setup-env.sh + + - name: Run cargo test + uses: actions-rs/cargo@v1 + with: + command: test + + lints: + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install stable toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + components: rustfmt, clippy + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings diff --git a/.github/workflows/test.yml b/.github/workflows/nix-ci.yml similarity index 89% rename from .github/workflows/test.yml rename to .github/workflows/nix-ci.yml index a09425e..c54846e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/nix-ci.yml @@ -1,7 +1,5 @@ -name: "Test" -on: - pull_request: - push: +name: "Nix CI" +on: [pull_request, push] jobs: tests: runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 2f7896d..e92f4cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target/ +result*