Skip to content

Commit

Permalink
######
Browse files Browse the repository at this point in the history
  • Loading branch information
jamjamjon committed Dec 29, 2024
1 parent 6c3290e commit cfb1a06
Show file tree
Hide file tree
Showing 197 changed files with 9,879 additions and 5,225 deletions.
218 changes: 49 additions & 169 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,193 +11,73 @@ env:


jobs:
build-on-linux:
name: build / linux / ffmpeg ${{ matrix.ffmpeg_version }}
runs-on: ubuntu-latest
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu

check:
name: Check
runs-on: ${{ matrix.os }}
strategy:
matrix:
ffmpeg_version: ["4.3", "4.4", "5.0", "5.1", "6.0", "6.1", "7.0"]
fail-fast: false

os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
apt update
apt install -y --no-install-recommends clang curl pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Build
run: cargo build

build-on-macos:
name: build / macos / ffmpeg latest
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
brew install ffmpeg pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
toolchain: stable

- name: Build
run: cargo build


build-on-windows:
name: build / windows / ffmpeg latest
runs-on: windows-latest

env:
FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z
7z x ffmpeg-release-full-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable

- name: Build
run: cargo build


test-on-linux:
name: test / linux / ffmpeg ${{ matrix.ffmpeg_version }}
runs-on: ubuntu-latest
container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu
command: check
args: --all

test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
ffmpeg_version: ["4.3", "4.4", "5.0", "5.1", "6.0", "6.1", "7.0"]
fail-fast: false

os: [ubuntu-latest, macOS-latest, windows-latest]
rust: [stable]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
apt update
apt install -y --no-install-recommends clang curl pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Run Tests with All Features
run: cargo test --all-features

- name: Run Tests in Release Mode
run: cargo test --release

test-on-macos:
name: test / macos / ffmpeg latest
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
brew install ffmpeg pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
profile: minimal
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
toolchain: stable

- name: Run Tests with All Features
run: cargo test --all-features

- name: Run Tests in Release Mode
run: cargo test --release

test-on-windows:
name: test / windows / ffmpeg latest
runs-on: windows-latest

env:
FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z
command: test
args: --all

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z
7z x ffmpeg-release-full-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable

- name: Run Tests with All Features
run: cargo test --all-features

- name: Run Tests in Release Mode
run: cargo test --release

override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

lints:
clippy:
name: Clippy
runs-on: ubuntu-latest
container: jrottenberg/ffmpeg:6-ubuntu

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: |
apt update
apt install -y --no-install-recommends clang curl pkg-config
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Rustfmt
run: cargo fmt --all -- --check
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --all-targets -- -D warnings

- name: Clippy
run: cargo clippy --all --all-targets --all-features -- -D warnings
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
debug/
target/

**/*.DS_Store

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
Expand All @@ -13,7 +15,6 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


.debug
.vscode
runs/
Expand Down
83 changes: 46 additions & 37 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,66 +1,75 @@
[package]
name = "usls"
version = "0.0.20"
version = "0.0.21"
edition = "2021"
description = "A Rust library integrated with ONNXRuntime, providing a collection of ML models."
repository = "https://github.com/jamjamjon/usls"
authors = ["Jamjamjon <[email protected]>"]
license = "MIT"
readme = "README.md"
exclude = ["assets/*", "examples/*", "scripts/*", "runs/*"]
exclude = ["assets/*", "examples/*", "runs/*", "benches/*"]


[dependencies]
clap = { version = "4.2.4", features = ["derive"] }
aksr = { version = "0.0.2" }
image = { version = "0.25.2" }
imageproc = { version = "0.24" }
ndarray = { version = "0.16.1", features = ["rayon"] }
ort = { version = "2.0.0-rc.5", default-features = false}
rayon = { version = "1.10.0" }
anyhow = { version = "1.0.75" }
regex = { version = "1.5.4" }
rand = { version = "0.8.5" }
chrono = { version = "0.4.30" }
half = { version = "2.3.1" }
dirs = { version = "5.0.1" }
ureq = { version = "2.9.1", default-features = true, features = [
"socks-proxy",
] }
tokenizers = { version = "0.15.2" }
rayon = "1.10.0"
log = { version = "0.4.22" }
env_logger = { version = "0.11.5" }
indicatif = "0.17.8"
image = "0.25.2"
imageproc = { version = "0.24" }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
ort = { version = "2.0.0-rc.9", default-features = false}
prost = "0.12.4"
ab_glyph = "0.2.23"
dirs = { version = "5.0.1" }
tempfile = "3.12.0"
geo = "0.28.0"
prost = "0.12.4"
half = { version = "2.3.1" }
ureq = { version = "2.9.1", default-features = true, features = [
"socks-proxy",
] }
fast_image_resize = { version = "4.2.1", features = ["image"]}
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tempfile = "3.12.0"
video-rs = { version = "0.9.0", features = ["ndarray"] }
natord = "1.0.9"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
minifb = "0.27.0"
aksr = "0.0.1"
video-rs = { version = "0.10.0", features = ["ndarray"], optional = true }
minifb = { version = "0.27.0", optional = true }
argh = "0.1.13"


[dev-dependencies]
tracing-subscriber = { version = "0.3.18" }
tracing = { version = "0.1.40", features = ["log"] }



[[example]]
name = "viewer"
required-features = ["ffmpeg"]



[features]
default = [
"ort/load-dynamic",
"ort/copy-dylibs",
"ort/half",
"ort/ndarray",
"ort/cuda",
"ort/tensorrt",
"ort/coreml",
"ort/operator-libraries"
"ort/ndarray",
"ort/copy-dylibs",
"ort/load-dynamic",
"ort/half",
]
auto = ["ort/download-binaries"]
ffmpeg = ["dep:video-rs", "dep:minifb"]
cuda = [ "ort/cuda" ]
trt = [ "ort/tensorrt" ]
mps = [ "ort/coreml" ]

[dev-dependencies]
criterion = "0.5.1"

[[bench]]
name = "yolo"
harness = false

[lib]
bench = false
[profile.release]
# lto = true
strip = true
panic = "abort"
Loading

0 comments on commit cfb1a06

Please sign in to comment.