workflow #9
This file contains hidden or 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: Rust Testing | |
| on: | |
| push: | |
| branches: [ "*" ] # Run on all branches | |
| pull_request: | |
| branches: [ "*" ] # Run on PRs to any branch | |
| workflow_dispatch: # Enable manual trigger button | |
| inputs: | |
| run_full_tests: | |
| description: 'Run full test suite (including performance tests)' | |
| required: false | |
| default: 'true' | |
| type: boolean | |
| run_benchmarks: | |
| description: 'Run performance benchmarks' | |
| required: false | |
| default: 'false' | |
| type: boolean | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test_linux: | |
| runs-on: ubuntu-latest-8-cores | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Display workflow inputs | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "π§ Manual workflow trigger detected" | |
| echo "π Run full tests: ${{ github.event.inputs.run_full_tests }}" | |
| echo "π Run benchmarks: ${{ github.event.inputs.run_benchmarks }}" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| profile: minimal | |
| override: true | |
| components: rustfmt, clippy | |
| - name: Cache Node.js dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install system dependencies (Linux) | |
| run: | | |
| sudo apt update | |
| sudo apt install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev | |
| - name: Install Node.js dependencies | |
| run: npm install | |
| - name: Cache Rust dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run cargo fmt check | |
| run: cargo fmt --all -- --check | |
| working-directory: ./src-tauri | |
| - name: Run cargo clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| working-directory: ./src-tauri | |
| - name: Generate test data | |
| run: | | |
| echo "π Generating test data for fuzzy search..." | |
| echo "This creates 176,840 empty files in ./src-tauri/test-data-for-fuzzy-search/" | |
| cargo test create_test_data --features "generate-test-data" -- --nocapture | |
| working-directory: ./src-tauri | |
| - name: Run basic tests | |
| run: | | |
| echo "π§ͺ Running basic functionality tests..." | |
| cargo test | |
| working-directory: ./src-tauri | |
| - name: Run comprehensive tests (without file opening) | |
| if: github.event.inputs.run_full_tests != 'false' | |
| run: | | |
| echo "π Running comprehensive test suite..." | |
| echo "Note: This runs the full feature set but without opening default apps" | |
| cargo test --features "full-no-generate-test-data" -- --test-threads=1 | |
| working-directory: ./src-tauri | |
| - name: Run performance benchmarks | |
| if: github.event.inputs.run_benchmarks == 'true' | |
| run: | | |
| echo "β‘ Running performance benchmarks..." | |
| cargo test --features benchmarks --release -- bench | |
| working-directory: ./src-tauri | |
| continue-on-error: true | |
| - name: Verify test data was created | |
| run: | | |
| echo "π Verifying test data creation..." | |
| if [ -d "./src-tauri/test-data-for-fuzzy-search" ]; then | |
| echo "β Test data directory exists" | |
| find ./src-tauri/test-data-for-fuzzy-search -type f | wc -l | xargs echo "Total files created:" | |
| else | |
| echo "β Test data directory not found" | |
| fi | |
| - name: Upload test logs | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-logs | |
| path: | | |
| ./src-tauri/logs/ | |
| ./src-tauri/app.log | |
| ./src-tauri/error.log | |
| - name: Upload test data artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-data | |
| path: | | |
| ./src-tauri/test-data-for-fuzzy-search/ | |
| if-no-files-found: warn |