Setup cargo actions

This commit is contained in:
Basile Henry 2020-07-05 17:32:38 +02:00
parent 72709d1bc8
commit c2fbeea503
4 changed files with 90 additions and 4 deletions

15
.github/actions/setup-env.sh vendored Executable file
View File

@ -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"

72
.github/workflows/cargo-ci.yml vendored Normal file
View File

@ -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

View File

@ -1,7 +1,5 @@
name: "Test"
on:
pull_request:
push:
name: "Nix CI"
on: [pull_request, push]
jobs:
tests:
runs-on: ubuntu-latest

1
.gitignore vendored
View File

@ -1 +1,2 @@
target/
result*