|
| 1 | +# Disabled - using test-only.yml instead |
| 2 | +# name: Rust Testing |
| 3 | + |
| 4 | +# on: |
| 5 | +# push: |
| 6 | +# branches: [ "*" ] # Run on all branches |
| 7 | +# pull_request: |
| 8 | +# branches: [ "*" ] # Run on PRs to any branch |
| 9 | +# workflow_dispatch: # Enable manual trigger button |
| 10 | + inputs: |
| 11 | + run_full_tests: |
| 12 | + description: 'Run full test suite (including performance tests)' |
| 13 | + required: false |
| 14 | + default: 'true' |
| 15 | + type: boolean |
| 16 | + run_benchmarks: |
| 17 | + description: 'Run performance benchmarks' |
| 18 | + required: false |
| 19 | + default: 'false' |
| 20 | + type: boolean |
| 21 | + |
| 22 | +env: |
| 23 | + CARGO_TERM_COLOR: always |
| 24 | + |
| 25 | +jobs: |
| 26 | + test_linux: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout repository |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Display workflow inputs |
| 34 | + if: github.event_name == 'workflow_dispatch' |
| 35 | + run: | |
| 36 | + echo "🔧 Manual workflow trigger detected" |
| 37 | + echo "📊 Run full tests: ${{ github.event.inputs.run_full_tests }}" |
| 38 | + echo "🏃 Run benchmarks: ${{ github.event.inputs.run_benchmarks }}" |
| 39 | + |
| 40 | + - name: Setup Node.js |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: '20' |
| 44 | + |
| 45 | + - name: Setup Rust |
| 46 | + uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + toolchain: stable |
| 49 | + profile: minimal |
| 50 | + override: true |
| 51 | + components: rustfmt, clippy |
| 52 | + |
| 53 | + - name: Cache Node.js dependencies |
| 54 | + uses: actions/cache@v4 |
| 55 | + with: |
| 56 | + path: ~/.npm |
| 57 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} |
| 58 | + restore-keys: | |
| 59 | + ${{ runner.os }}-node- |
| 60 | + |
| 61 | + - name: Install system dependencies (Linux) |
| 62 | + run: | |
| 63 | + sudo apt update |
| 64 | + sudo apt install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev |
| 65 | + |
| 66 | + - name: Install Node.js dependencies |
| 67 | + run: npm install |
| 68 | + |
| 69 | + - name: Cache Rust dependencies |
| 70 | + uses: actions/cache@v4 |
| 71 | + with: |
| 72 | + path: | |
| 73 | + ~/.cargo/bin/ |
| 74 | + ~/.cargo/registry/index/ |
| 75 | + ~/.cargo/registry/cache/ |
| 76 | + ~/.cargo/git/db/ |
| 77 | + target/ |
| 78 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 79 | + |
| 80 | + - name: Run cargo fmt check |
| 81 | + run: cargo fmt --all -- --check |
| 82 | + working-directory: ./src-tauri |
| 83 | + |
| 84 | + - name: Run cargo clippy |
| 85 | + run: cargo clippy --all-targets --all-features -- -D warnings |
| 86 | + working-directory: ./src-tauri |
| 87 | + |
| 88 | + - name: Generate test data |
| 89 | + run: | |
| 90 | + echo "📁 Generating test data for fuzzy search..." |
| 91 | + echo "This creates 176,840 empty files in ./src-tauri/test-data-for-fuzzy-search/" |
| 92 | + cargo test create_test_data --features "generate-test-data" -- --nocapture |
| 93 | + working-directory: ./src-tauri |
| 94 | + |
| 95 | + - name: Run basic tests |
| 96 | + run: | |
| 97 | + echo "🧪 Running basic functionality tests..." |
| 98 | + cargo test |
| 99 | + working-directory: ./src-tauri |
| 100 | + |
| 101 | + - name: Run comprehensive tests (without file opening) |
| 102 | + if: github.event.inputs.run_full_tests != 'false' |
| 103 | + run: | |
| 104 | + echo "🚀 Running comprehensive test suite..." |
| 105 | + echo "Note: This runs the full feature set but without opening default apps" |
| 106 | + cargo test --features "full-no-generate-test-data" -- --test-threads=1 |
| 107 | + working-directory: ./src-tauri |
| 108 | + |
| 109 | + - name: Run performance benchmarks |
| 110 | + if: github.event.inputs.run_benchmarks == 'true' |
| 111 | + run: | |
| 112 | + echo "⚡ Running performance benchmarks..." |
| 113 | + cargo test --features benchmarks --release -- bench |
| 114 | + working-directory: ./src-tauri |
| 115 | + continue-on-error: true |
| 116 | + |
| 117 | + - name: Verify test data was created |
| 118 | + run: | |
| 119 | + echo "📊 Verifying test data creation..." |
| 120 | + if [ -d "./src-tauri/test-data-for-fuzzy-search" ]; then |
| 121 | + echo "✅ Test data directory exists" |
| 122 | + find ./src-tauri/test-data-for-fuzzy-search -type f | wc -l | xargs echo "Total files created:" |
| 123 | + else |
| 124 | + echo "❌ Test data directory not found" |
| 125 | + fi |
| 126 | + |
| 127 | + - name: Upload test logs |
| 128 | + uses: actions/upload-artifact@v4 |
| 129 | + if: always() |
| 130 | + with: |
| 131 | + name: test-logs |
| 132 | + path: | |
| 133 | + ./src-tauri/logs/ |
| 134 | + ./src-tauri/app.log |
| 135 | + ./src-tauri/error.log |
| 136 | + |
| 137 | + - name: Upload test data artifacts |
| 138 | + uses: actions/upload-artifact@v4 |
| 139 | + if: always() |
| 140 | + with: |
| 141 | + name: test-data |
| 142 | + path: | |
| 143 | + ./src-tauri/test-data-for-fuzzy-search/ |
| 144 | + if-no-files-found: warn |
0 commit comments