refactor: 架构审计 12 项 finding 全量修复 #248
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: "StockAI CI" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test-and-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [macos-latest, ubuntu-24.04, windows-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2.2.0 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Linux system dependencies | |
| if: matrix.platform == 'ubuntu-24.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run frontend tests | |
| run: bunx vitest run | |
| - name: Run sidecar unit tests | |
| run: cd sidecar && bun test ai.test.ts strategies/parsers.test.ts | |
| - name: Build sidecar | |
| shell: bash | |
| run: | | |
| TARGET_TRIPLE=$(rustc -Vv | grep host | cut -d ' ' -f 2) | |
| # 设置 OUTFILE 以适配 build-script.ts | |
| export OUTFILE="src-tauri/bin/stockai-backend-$TARGET_TRIPLE" | |
| # 设置 BUN_TARGET (适配 macos aarch64 等) | |
| if [ "${{ matrix.platform }}" = "macos-latest" ]; then | |
| export BUN_TARGET="bun-darwin-arm64" | |
| elif [ "${{ matrix.platform }}" = "windows-latest" ]; then | |
| export BUN_TARGET="bun-windows-x64" | |
| export OUTFILE="$OUTFILE.exe" | |
| else | |
| export BUN_TARGET="bun-linux-x64" | |
| fi | |
| bun sidecar/build-script.ts | |
| - name: Verify Sidecar | |
| shell: bash | |
| run: | | |
| TARGET_TRIPLE=$(rustc -Vv | grep host | cut -d ' ' -f 2) | |
| BINARY="src-tauri/bin/stockai-backend-$TARGET_TRIPLE" | |
| if [ "${{ matrix.platform }}" = "windows-latest" ]; then BINARY="$BINARY.exe"; fi | |
| bun scripts/verify-bundle.ts "$BINARY" | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| args: --no-bundle |