Cleanup code #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Workflow | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
container: | |
image: rust:latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Update local Rust toolchain | |
run: | | |
rustup update | |
rustup install nightly | |
rustup component add clippy rustfmt | |
rustup component add clippy rustfmt --toolchain nightly | |
- name: Get toolchain info | |
run: | | |
cargo --version --verbose | |
rustc --version | |
cargo clippy --version | |
- name: Install build dependencies | |
run: > | |
apt-get update && | |
apt-get install -y | |
build-essential | |
cmake | |
libv4l-dev | |
nasm | |
- name: Lint | |
run: | | |
cargo +nightly fmt -- --check | |
cargo +nightly clippy --no-deps -- -D warnings | |
- name: Test | |
run: | | |
cargo check | |
cargo test --workspace -- --nocapture | |
- name: Build | |
run: | | |
cargo build --release | |
- name: Set variables for release | |
run: | | |
echo "TIMESTAMP=$(date +'%Y-%m-%d_%H:%M:%S')" >> $GITHUB_ENV | |
echo "RELEASE_FILE=infercam_onnx_${GITHUB_REF#refs/tags/}.tar.gz" >> $GITHUB_ENV | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: List build content | |
run: ls -la | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Compress release files | |
run: | | |
tar -czf ${RELEASE_FILE} | |
target/release/infer_server | |
target/release/libcam_sender* | |
target/release/libcommon* | |
target/release/libinfer_server* | |
target/release/multipart_sender | |
target/release/socket_sender | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Publish a release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@69a9b03fd9694e185b5d1450f1c534fb50ed4ab8 | |
with: | |
files: | | |
*.tar.gz |