Skip to content

update logging

update logging #12

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
dbus \
dbus-x11 \
python3 \
python3-dbus \
python3-gi \
python3-gi-cairo \
gir1.2-glib-2.0 \
systemd \
libdbus-1-dev \
pkg-config
- name: Cache cargo dependencies
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 -- --check
- name: Start D-Bus session for tests
run: |
# Start D-Bus daemon for testing
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV
# Give D-Bus time to start
sleep 2
# Verify D-Bus is working
echo "Testing D-Bus connection..."
dbus-send --session --dest=org.freedesktop.DBus --type=method_call \
--print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames > /dev/null
echo "D-Bus session ready"
- name: Run unit tests
env:
RUST_BACKTRACE: 1
run: |
echo "Running all tests..."
cargo test --verbose
- name: Run integration tests with output
env:
RUST_BACKTRACE: 1
run: |
echo "Running integration tests with detailed output..."
cargo test --test integration_tests -- --nocapture
- name: Test mock script standalone
run: |
echo "Testing mock media player script..."
timeout 3s python3 tests/mock_media_player.py || true
echo "Mock script test completed"
- name: Build release binary
run: |
echo "Building release version..."
cargo build --release
ls -la target/release/
- name: Upload test artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-logs-${{ github.run_number }}
path: |
target/debug/deps/
retention-days: 5
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
dbus \
dbus-x11 \
python3-dbus \
python3-gi \
libdbus-1-dev \
pkg-config
- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov
- name: Start D-Bus session for coverage
run: |
export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --print-address --fork)
echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV
sleep 2
- name: Generate code coverage
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 }}