fix(windows): 修复 Git 记录鼠标滚轮偶发无法滚动 #239
Workflow file for this run
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: macOS CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: macos-ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changes: | |
| name: Classify changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| full: ${{ steps.classify.outputs.full }} | |
| comments: ${{ steps.classify.outputs.comments }} | |
| metadata: ${{ steps.classify.outputs.metadata }} | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Test CI change classifier | |
| shell: bash | |
| run: ./scripts/test-classify-ci-changes.sh | |
| - name: Classify changed paths | |
| id: classify | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PUSH_BASE_SHA: ${{ github.event.before }} | |
| shell: bash | |
| run: | | |
| if [[ "$EVENT_NAME" == "workflow_dispatch" ]]; then | |
| { | |
| echo "full=true" | |
| echo "comments=false" | |
| echo "metadata=false" | |
| } >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| base_sha="$PUSH_BASE_SHA" | |
| if [[ "$EVENT_NAME" == "pull_request" ]]; then | |
| base_sha="$PR_BASE_SHA" | |
| fi | |
| ./scripts/classify-ci-changes.sh "$base_sha" "$GITHUB_SHA" >> "$GITHUB_OUTPUT" | |
| - name: Set up Rust for comment verification | |
| if: steps.classify.outputs.full == 'false' && steps.classify.outputs.comments == 'true' | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Validate text-only changes | |
| if: steps.classify.outputs.full == 'false' && steps.classify.outputs.comments == 'true' | |
| shell: bash | |
| run: | | |
| git diff --check "${{ github.event.pull_request.base.sha || github.event.before }}" "$GITHUB_SHA" | |
| ./scripts/verify-rust-core-comments.sh | |
| - name: Validate lightweight metadata changes | |
| if: steps.classify.outputs.full == 'false' && steps.classify.outputs.metadata == 'true' | |
| shell: bash | |
| run: | | |
| git diff --check "${{ github.event.pull_request.base.sha || github.event.before }}" "$GITHUB_SHA" | |
| ruby -c Casks/lithe.rb | |
| ruby -c scripts/update-homebrew-cask.rb | |
| swift-tests: | |
| name: Swift tests | |
| needs: changes | |
| if: needs.changes.outputs.full == 'true' | |
| runs-on: macos-14 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v7 | |
| - name: Set up Swift | |
| uses: swift-actions/setup-swift@v2 | |
| with: | |
| swift-version: "6.2" | |
| - name: Restore SwiftPM dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: | | |
| .build/checkouts | |
| .build/repositories | |
| ~/.cache/org.swift.swiftpm | |
| key: swiftpm-${{ runner.os }}-6.2-${{ hashFiles('Package.resolved') }} | |
| - name: Run Swift tests | |
| id: swift-tests-primary | |
| continue-on-error: true | |
| timeout-minutes: 8 | |
| run: ./scripts/test-macos.sh | |
| - name: Retry Swift tests after a failed attempt | |
| if: steps.swift-tests-primary.outcome == 'failure' | |
| timeout-minutes: 8 | |
| run: ./scripts/test-macos.sh --skip-build | |
| rust-tests: | |
| name: Rust Core and database tests | |
| needs: changes | |
| if: needs.changes.outputs.full == 'true' | |
| runs-on: macos-14 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v7 | |
| - name: Set up Swift | |
| uses: swift-actions/setup-swift@v2 | |
| with: | |
| swift-version: "6.2" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Restore Cargo dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: | | |
| ~/.cargo/git | |
| ~/.cargo/registry | |
| key: cargo-dependencies-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock') }} | |
| - name: Run Rust Core tests and verify the Swift bridge | |
| run: ./scripts/verify-rust-core.sh | |
| - name: Test database helpers | |
| run: | | |
| cargo fmt --manifest-path rust/Cargo.toml --all -- --check | |
| cargo test --manifest-path rust/Cargo.toml -p lithe-db-sidecar | |
| cargo test --manifest-path rust/Cargo.toml -p lithe-db-mcp | |
| release-build: | |
| name: Release configuration | |
| needs: changes | |
| if: needs.changes.outputs.full == 'true' | |
| runs-on: macos-14 | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Check out source | |
| uses: actions/checkout@v7 | |
| - name: Set up Swift | |
| uses: swift-actions/setup-swift@v2 | |
| with: | |
| swift-version: "6.2" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-apple-darwin,x86_64-apple-darwin | |
| - name: Restore SwiftPM dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: | | |
| .build/checkouts | |
| .build/repositories | |
| ~/.cache/org.swift.swiftpm | |
| key: swiftpm-${{ runner.os }}-6.2-${{ hashFiles('Package.resolved') }} | |
| - name: Restore Cargo dependencies | |
| uses: actions/cache@v6 | |
| with: | |
| path: | | |
| ~/.cargo/git | |
| ~/.cargo/registry | |
| key: cargo-dependencies-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock') }} | |
| - name: Resolve host architecture | |
| shell: zsh {0} | |
| run: | | |
| case "$(uname -m)" in | |
| arm64) swift_triple="arm64-apple-macosx" ;; | |
| x86_64) swift_triple="x86_64-apple-macosx" ;; | |
| *) print -u2 -- "Unsupported host architecture: $(uname -m)"; exit 1 ;; | |
| esac | |
| print -r -- "LITHE_SWIFT_TRIPLE=$swift_triple" >> "$GITHUB_ENV" | |
| - name: Check packaging scripts and metadata | |
| shell: zsh {0} | |
| run: | | |
| for script in scripts/*.sh; do | |
| if [[ "$(head -n 1 "$script")" == "#!/bin/zsh" ]]; then | |
| zsh -n "$script" | |
| fi | |
| done | |
| ruby -c scripts/update-homebrew-cask.rb | |
| plutil -lint Resources/Info.plist | |
| - name: Build release configuration | |
| run: ./scripts/build-macos.sh --configuration release --triple "$LITHE_SWIFT_TRIPLE" | |
| gate: | |
| name: macOS CI gate | |
| needs: | |
| - changes | |
| - swift-tests | |
| - rust-tests | |
| - release-build | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Verify required jobs | |
| env: | |
| CHANGES_RESULT: ${{ needs.changes.result }} | |
| SWIFT_RESULT: ${{ needs.swift-tests.result }} | |
| RUST_RESULT: ${{ needs.rust-tests.result }} | |
| RELEASE_RESULT: ${{ needs.release-build.result }} | |
| shell: bash | |
| run: | | |
| [[ "$CHANGES_RESULT" == "success" ]] | |
| for result in "$SWIFT_RESULT" "$RUST_RESULT" "$RELEASE_RESULT"; do | |
| [[ "$result" == "success" || "$result" == "skipped" ]] | |
| done |