Skip to content

Fix YAML syntax by simplifying runner mapping in release workflow #28

Fix YAML syntax by simplifying runner mapping in release workflow

Fix YAML syntax by simplifying runner mapping in release workflow #28

Workflow file for this run

name: CI
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: false
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check code formatting
run: cargo fmt --all -- --check
- name: Run clippy lints
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
# coverage:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
# with:
# components: llvm-tools-preview
# - name: Install cargo-llvm-cov
# uses: taiki-e/install-action@cargo-llvm-cov
# - name: Generate coverage report
# run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v4
# with:
# files: lcov.info
# fail_ci_if_error: false
# token: ${{ secrets.CODECOV_TOKEN }}
freebsd:
name: FreeBSD 15.0 Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD 15.0
uses: vmactions/freebsd-vm@v1
with:
release: '15.0'
usesh: true
prepare: |
pkg update -f
pkg install -y rust pkgconf
# Install additional build dependencies that might be needed
pkg install -y openssl cmake gmake
run: |
rustc --version
cargo --version
pwd
ls -lah
# Set environment variables for FreeBSD
export OPENSSL_DIR=/usr/local
export OPENSSL_LIB_DIR=/usr/local/lib
export OPENSSL_INCLUDE_DIR=/usr/local/include
# Build and test only (fmt/clippy already done in main test job)
cargo build --verbose
cargo test --verbose
performance:
name: Performance Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build release
run: cargo build --release
- name: Run benchmarks
run: |
# Basic performance test - measure startup time
echo "Testing startup time..."
time ./target/release/obs-cmd --help > /dev/null
# Test with mock OBS connection (if available)
echo "Testing command execution time..."
time timeout 5s ./target/release/obs-cmd --version || true
- name: Binary size analysis
run: |
echo "Binary size analysis:"
ls -lh target/release/obs-cmd
du -h target/release/obs-cmd
- name: Memory usage check
run: |
echo "Memory usage analysis:"
/usr/bin/time -v ./target/release/obs-cmd --help 2>&1 | grep -E "Maximum resident set size|Average resident set size" || true
- name: Test CLI interface
run: |
# Test help command
./target/release/obs-cmd --help
# Test version command
./target/release/obs-cmd --version
# Test invalid arguments (should fail gracefully)
./target/release/obs-cmd --invalid-arg || echo "Expected failure for invalid argument"
- name: Test error handling
run: |
# Test connection to non-existent OBS (should fail gracefully)
timeout 10s ./target/release/obs-cmd --ws-url ws://localhost:9999 scene list || echo "Expected connection failure"
# Test with invalid WebSocket URL
timeout 5s ./target/release/obs-cmd --ws-url invalid-url scene list || echo "Expected URL parsing failure"
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Check flake
run: nix flake check
- name: Build package
run: nix build
- name: Test dev shell
run: nix develop -c cargo test