fix: guard against stale drag message on double-click #127
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: windows-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci-lint-windows-x64 | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Format | |
| run: cargo fmt --all -- --check | |
| - name: Clippy | |
| run: cargo clippy --all --all-targets -- -D warnings | |
| - name: Check gpui-full feature | |
| run: cargo check -p codirigent-ui --features gpui-full | |
| test: | |
| name: Test | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: ci-test-${{ runner.os }}-${{ runner.arch }} | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Test | |
| run: cargo test --all --all-targets | |
| warm-release-cache: | |
| name: Warm Release Cache (${{ matrix.name }}) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ${{ matrix.runner }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Windows x64 | |
| runner: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| - name: macOS Apple Silicon | |
| runner: macos-14 | |
| target: aarch64-apple-darwin | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: sccache | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install sccache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: release-${{ matrix.target }} | |
| cache-targets: "false" | |
| save-if: ${{ github.ref == 'refs/heads/main' }} | |
| - name: Build release binaries | |
| run: | | |
| cargo build --profile dist --features gpui-full --target ${{ matrix.target }} -p codirigent | |
| cargo build --profile dist --target ${{ matrix.target }} -p codirigent-hook | |
| check-unwraps: | |
| name: Check for new unwrap() calls | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for new unwrap() calls | |
| shell: bash | |
| run: | | |
| # Count unwraps in production code only (exclude #[cfg(test)] blocks and test dirs). | |
| count_prod_unwraps() { | |
| local ref="$1" | |
| local total=0 | |
| while IFS= read -r file; do | |
| # Find the first #[cfg(test)] line; count unwraps only before it | |
| test_line=$(git show "$ref:$file" | grep -n '#\[cfg(test)\]' | head -1 | cut -d: -f1) | |
| if [ -n "$test_line" ]; then | |
| count=$(git show "$ref:$file" | head -n "$((test_line - 1))" | grep -v '///' | grep -c '\.unwrap()' || true) | |
| else | |
| count=$(git show "$ref:$file" | grep -v '///' | grep -c '\.unwrap()' || true) | |
| fi | |
| total=$((total + count)) | |
| done < <(git ls-tree -r --name-only "$ref" -- crates/ | grep '/src/.*\.rs$' | grep -v '/tests/') | |
| echo "$total" | |
| } | |
| CURRENT=$(count_prod_unwraps HEAD) | |
| BASELINE=$(count_prod_unwraps origin/main) | |
| echo "Baseline unwraps (production): $BASELINE" | |
| echo "Current unwraps (production): $CURRENT" | |
| if [ "$CURRENT" -gt "$BASELINE" ]; then | |
| echo "❌ New unwrap() calls in production code! ($((CURRENT - BASELINE)) added)" | |
| echo "Please use safe error handling instead. See docs/coding-guidelines/error-handling.md" | |
| exit 1 | |
| else | |
| echo "✅ No new unwrap() calls in production code" | |
| fi |