feat: enhance query history management with deletion options and impr… #23
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 Tests | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| test: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install nightly toolchain for JSON test output | |
| run: rustup toolchain install nightly | |
| - name: Cache Cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| src-tauri/target | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('src-tauri/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-test- | |
| - name: Run cargo check | |
| working-directory: src-tauri | |
| run: cargo check | |
| - name: Run unit tests with output capture | |
| working-directory: src-tauri | |
| run: | | |
| rustup run nightly cargo test --lib -- -Z unstable-options --format json > test-results.json 2>&1 || true | |
| cargo test --lib -- --nocapture > test-results.txt 2>&1 || true | |
| - name: Generate test report | |
| working-directory: src-tauri | |
| run: python3 scripts/generate-test-report.py | |
| - name: Comment PR with test report | |
| if: github.event_name == 'pull_request' | |
| working-directory: src-tauri | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| REPOSITORY: ${{ github.repository }} | |
| run: | | |
| REPORT_FILE="test-report.md" | |
| if [ ! -f "$REPORT_FILE" ]; then | |
| echo "No report file found, skipping comment" | |
| exit 0 | |
| fi | |
| REPORT_CONTENT=$(cat "$REPORT_FILE") | |
| EXISTING_COMMENT=$(gh api repos/"$REPOSITORY"/issues/"$PR_NUMBER"/comments \ | |
| --jq '.[] | select(.body | startswith("## 🧪 Test Results Report")) | .id' | head -1) | |
| if [ -n "$EXISTING_COMMENT" ]; then | |
| gh api repos/"$REPOSITORY"/issues/comments/"$EXISTING_COMMENT" \ | |
| --method PATCH \ | |
| --field body="$REPORT_CONTENT" \ | |
| --silent | |
| else | |
| gh api repos/"$REPOSITORY"/issues/"$PR_NUMBER"/comments \ | |
| --method POST \ | |
| --field body="$REPORT_CONTENT" \ | |
| --silent | |
| fi |