mirror of
https://github.com/Xevion/byte-me.git
synced 2025-12-09 16:06:44 -06:00
Compare commits
18 Commits
8bfae44115
...
46876d5d9d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46876d5d9d | ||
|
|
e578ac2f3d | ||
|
|
d0aea1662d | ||
|
|
7b52f87d9d | ||
|
|
7b7e495fc0 | ||
|
|
8c897209ae | ||
|
|
b7d90c151c | ||
|
|
8c5e86be19 | ||
|
|
a2c4a0bd0c | ||
|
|
6c2c10c25d | ||
|
|
fc47fd9fe9 | ||
|
|
f507277827 | ||
|
|
51498b234e | ||
|
|
e35ac0eeee | ||
|
|
047ee8b1e4 | ||
|
|
50f53eccf1 | ||
|
|
ca82456a53 | ||
|
|
19a39a8c25 |
96
.github/workflows/ci.yml
vendored
96
.github/workflows/ci.yml
vendored
@@ -10,14 +10,52 @@ env:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build (${{ matrix.os }}${{ matrix.target && format(' / {0}', matrix.target) || '' }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
target: x86_64-unknown-linux-gnu
|
||||
artifact_name: byte-me-linux-x86_64
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
artifact_name: byte-me-windows-x86_64
|
||||
artifact_extension: .exe
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
artifact_name: byte-me-macos-aarch64
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
artifact_name: byte-me-macos-x86_64
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Use sccache
|
||||
if: runner.os != 'Linux' && github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
||||
uses: mozilla-actions/sccache-action@v0.0.9
|
||||
|
||||
- name: Configure sccache
|
||||
if: runner.os != 'Linux' && github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
||||
run: |
|
||||
# Enable GitHub Actions for cache storage
|
||||
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
|
||||
# Use sccache for rustc
|
||||
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
@@ -30,36 +68,52 @@ jobs:
|
||||
node-version: 20
|
||||
cache: "pnpm"
|
||||
|
||||
- name: Install JS deps
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: Install frontend dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- name: Install backend dependencies
|
||||
run: cargo fetch --manifest-path src-tauri/Cargo.toml
|
||||
|
||||
- name: Install Tauri CLI
|
||||
uses: Xevion/cache-cargo-install-action@main
|
||||
with:
|
||||
tool: tauri-cli@2
|
||||
locked: true
|
||||
|
||||
- name: Cache apt packages
|
||||
if: runner.os == 'Linux'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /var/cache/apt/archives
|
||||
key: ${{ runner.os }}-apt-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-apt-
|
||||
|
||||
- name: Install Linux dependencies
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
pkg-config \
|
||||
# Update package list and install dependencies in one command to reduce time
|
||||
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libxdo-dev \
|
||||
libssl-dev \
|
||||
libglib2.0-dev \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
libayatana-appindicator3-dev \
|
||||
librsvg2-dev \
|
||||
patchelf
|
||||
patchelf \
|
||||
musl-tools
|
||||
|
||||
# this will run again in next step, but we run it here to separate the error from the frontend build step
|
||||
- name: Generate frontend bindings
|
||||
run: pnpm run generate-types
|
||||
|
||||
- name: Build frontend (tsc + vite)
|
||||
run: |
|
||||
pnpm run build # implicitly runs generate-types
|
||||
- name: Build app (tauri)
|
||||
run: cargo tauri build --target ${{ matrix.target }}
|
||||
|
||||
- name: Format check
|
||||
run: cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features -- -D warnings
|
||||
|
||||
- name: Run tests
|
||||
run: cargo test --manifest-path src-tauri/Cargo.toml --all-features
|
||||
- name: Upload binary artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: |
|
||||
src-tauri/target/${{ matrix.target }}/release/byte-me${{ matrix.artifact_extension }}
|
||||
src-tauri/target/${{ matrix.target }}/release/bundle/**/*
|
||||
if-no-files-found: error
|
||||
|
||||
57
.github/workflows/code-quality.yml
vendored
57
.github/workflows/code-quality.yml
vendored
@@ -6,25 +6,15 @@ on:
|
||||
workflow_dispatch: # Allow manual triggering
|
||||
pull_request:
|
||||
branches: [master]
|
||||
paths:
|
||||
- "**/Cargo.toml"
|
||||
- "**/Cargo.lock"
|
||||
- "**/package.json"
|
||||
- "**/pnpm-lock.yaml"
|
||||
push:
|
||||
branches: [master]
|
||||
paths:
|
||||
- "**/Cargo.toml"
|
||||
- "**/Cargo.lock"
|
||||
- "**/package.json"
|
||||
- "**/pnpm-lock.yaml"
|
||||
|
||||
jobs:
|
||||
rust-quality:
|
||||
name: Rust Code Quality
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@nightly
|
||||
@@ -51,17 +41,13 @@ jobs:
|
||||
patchelf
|
||||
|
||||
- name: Install cargo-udeps
|
||||
uses: taiki-e/cache-cargo-install-action@v2
|
||||
with:
|
||||
tool: cargo-udeps
|
||||
uses: taiki-e/install-action@cargo-udeps
|
||||
|
||||
- name: Check for unused dependencies
|
||||
run: cargo +nightly udeps --manifest-path src-tauri/Cargo.toml --all-targets
|
||||
|
||||
- name: Install cargo-machete
|
||||
uses: taiki-e/cache-cargo-install-action@v2
|
||||
with:
|
||||
tool: cargo-machete
|
||||
uses: taiki-e/install-action@cargo-machete
|
||||
|
||||
- name: Check for unused Cargo.toml dependencies
|
||||
run: cargo machete src-tauri/
|
||||
@@ -79,7 +65,7 @@ jobs:
|
||||
name: Frontend Code Quality
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
@@ -106,38 +92,3 @@ jobs:
|
||||
- name: Bundle size analysis
|
||||
run: pnpm run build && du -sh dist/
|
||||
continue-on-error: true
|
||||
|
||||
license-check:
|
||||
name: License Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Install cargo-license
|
||||
uses: taiki-e/cache-cargo-install-action@v2
|
||||
with:
|
||||
tool: cargo-license
|
||||
|
||||
- name: Check Rust crate licenses
|
||||
run: cargo license --manifest-path src-tauri/Cargo.toml --json > rust-licenses.json
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Check npm package licenses
|
||||
run: pnpm exec license-checker --json > npm-licenses.json
|
||||
continue-on-error: true
|
||||
|
||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
17
.github/workflows/security-audit.yml
vendored
17
.github/workflows/security-audit.yml
vendored
@@ -3,36 +3,25 @@ name: Security Audit
|
||||
on:
|
||||
workflow_dispatch: # Allow manual triggering
|
||||
push:
|
||||
paths:
|
||||
- "**/Cargo.toml"
|
||||
- "**/Cargo.lock"
|
||||
- "**/package.json"
|
||||
- "**/pnpm-lock.yaml"
|
||||
|
||||
jobs:
|
||||
rust-audit:
|
||||
name: Rust Security Audit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install cargo-audit
|
||||
uses: taiki-e/install-action@cargo-audit
|
||||
|
||||
- name: Run cargo audit
|
||||
run: cargo audit --file src-tauri/Cargo.lock
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install cargo-deny
|
||||
uses: taiki-e/install-action@cargo-deny
|
||||
|
||||
- name: Run cargo deny
|
||||
run: cargo deny --manifest-path src-tauri/Cargo.toml check
|
||||
run: cargo deny --manifest-path src-tauri/Cargo.toml check sources advisories bans --show-stats
|
||||
|
||||
npm-audit:
|
||||
name: NPM Security Audit
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
1
src-tauri/Cargo.lock
generated
1
src-tauri/Cargo.lock
generated
@@ -398,7 +398,6 @@ dependencies = [
|
||||
"ffprobe",
|
||||
"infer",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tauri-plugin-opener",
|
||||
|
||||
@@ -21,7 +21,6 @@ tauri-build = { version = "2.4.0", features = [] }
|
||||
tauri = { version = "2.8.2", features = [] }
|
||||
tauri-plugin-opener = "2.5.0"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1.0.143"
|
||||
ffprobe = "0.4.0"
|
||||
ts-rs = { version = "11.0", features = ["format"] }
|
||||
infer = "0.19.0"
|
||||
|
||||
39
src-tauri/deny.toml
Normal file
39
src-tauri/deny.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[graph]
|
||||
targets = [
|
||||
"x86_64-unknown-linux-gnu",
|
||||
"x86_64-pc-windows-msvc",
|
||||
"aarch64-apple-darwin",
|
||||
"x86_64-apple-darwin",
|
||||
]
|
||||
all-features = true
|
||||
no-default-features = false
|
||||
|
||||
[output]
|
||||
feature-depth = 1
|
||||
|
||||
[advisories]
|
||||
ignore = [
|
||||
"RUSTSEC-2024-0429",
|
||||
]
|
||||
unmaintained = "workspace"
|
||||
|
||||
[licenses]
|
||||
allow = []
|
||||
confidence-threshold = 0.8
|
||||
exceptions = []
|
||||
|
||||
[licenses.private]
|
||||
ignore = false
|
||||
registries = []
|
||||
|
||||
[bans]
|
||||
multiple-versions = "allow"
|
||||
wildcards = "allow"
|
||||
highlight = "all"
|
||||
workspace-default-features = "allow"
|
||||
external-default-features = "allow"
|
||||
allow = []
|
||||
|
||||
[sources]
|
||||
unknown-registry = "warn"
|
||||
unknown-git = "warn"
|
||||
@@ -43,5 +43,3 @@ pub fn extract_streams(info: &ffprobe::FfProbe) -> Vec<StreamDetail> {
|
||||
|
||||
streams
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -96,16 +96,3 @@ pub fn run() {
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ts_rs::TS;
|
||||
|
||||
#[test]
|
||||
fn export_bindings() {
|
||||
// This will generate TypeScript bindings when you run `cargo test export_bindings`
|
||||
use crate::models::*;
|
||||
|
||||
StreamDetail::export_all_to("../../src/bindings").expect("Failed to export bindings");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};
|
||||
use ts_rs::TS;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub enum MediaType {
|
||||
Audio,
|
||||
Video,
|
||||
@@ -15,7 +14,6 @@ pub enum MediaType {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub struct StreamResult {
|
||||
pub path: String,
|
||||
pub filename: String,
|
||||
@@ -26,7 +24,6 @@ pub struct StreamResult {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub enum StreamDetail {
|
||||
Video {
|
||||
codec: String,
|
||||
@@ -48,9 +45,22 @@ pub enum StreamDetail {
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, TS)]
|
||||
#[ts(export)]
|
||||
pub struct StreamResultError {
|
||||
pub filename: Option<String>,
|
||||
pub reason: String,
|
||||
pub error_type: String,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn export_bindings() {
|
||||
// This will generate TypeScript bindings when you run `cargo test export_bindings`
|
||||
use super::*;
|
||||
|
||||
StreamDetail::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
StreamResult::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
StreamResultError::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
MediaType::export_all_to("../src/bindings").expect("Failed to export bindings");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user