refactor: 思考与执行过程一个气泡只留一个 + 工具图标按 Stitch 全工具版风格重做 #42
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] | |
| tags: ['v*'] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| quality: | |
| name: Typecheck · Lint · Unit | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Typecheck | |
| run: npm run typecheck | |
| - name: Lint | |
| run: npm run lint | |
| - name: Unit tests | |
| run: npm test | |
| e2e: | |
| name: Build · E2E (Electron) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| env: | |
| # GitHub CI containers can't enable Chromium's user-namespace sandbox | |
| ELECTRON_DISABLE_SANDBOX: '1' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install Electron runtime system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends \ | |
| libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 \ | |
| libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \ | |
| libxrandr2 libgbm1 libasound2t64 libpango-1.0-0 libcairo2 \ | |
| libgtk-3-0 libx11-xcb1 xvfb | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Rebuild native modules for Electron ABI | |
| run: npx electron-builder install-app-deps | |
| - name: Build | |
| run: npm run build | |
| - name: E2E tests | |
| run: xvfb-run -a npm run test:e2e | |
| # ---- Packaging ---------------------------------------------------------- | |
| # Release jobs run on manual dispatch or on v* tag pushes only. | |
| # electron-builder cannot cross-compile macOS packages on Windows/Linux, | |
| # so the macOS builds run on macOS runners (one native job per arch). | |
| # | |
| # CSC_IDENTITY_AUTO_DISCOVERY=false lets the build succeed without a | |
| # signing certificate (CI runners have no keychain identity). When the | |
| # CSC_LINK secrets are set, electron-builder still signs with those certs. | |
| # | |
| # --publish never: artifacts are collected via upload-artifact. Without a | |
| # GH_TOKEN (electron-builder does not read GITHUB_TOKEN) the default | |
| # publish policy would try to create a GitHub Publisher and fail the | |
| # build. Add GH_TOKEN + drop the flag when release publishing is wanted. | |
| release-windows: | |
| name: Package Windows (NSIS + Portable) | |
| runs-on: windows-latest | |
| timeout-minutes: 40 | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Rebuild native modules for Electron ABI | |
| run: npx electron-builder install-app-deps | |
| - name: Build (electron-vite) | |
| run: npm run build | |
| - name: Prepare signing env (if certificate configured) | |
| shell: bash | |
| run: | | |
| if [ -n "${{ secrets.WIN_CSC_LINK }}" ]; then | |
| echo "CSC_LINK=${{ secrets.WIN_CSC_LINK }}" >> "$GITHUB_ENV" | |
| echo "CSC_KEY_PASSWORD=${{ secrets.WIN_CSC_KEY_PASSWORD }}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Package Windows installer | |
| run: npm run dist:win -- --publish never | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: 'false' | |
| - name: Upload Windows artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ourcode-ide-windows-x64 | |
| path: | | |
| release/*.exe | |
| if-no-files-found: error | |
| release-macos-arm64: | |
| name: Package macOS (Apple Silicon) | |
| runs-on: macos-latest | |
| timeout-minutes: 40 | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Rebuild native modules for Electron ABI | |
| run: npx electron-builder install-app-deps | |
| - name: Build (electron-vite) | |
| run: npm run build | |
| - name: Prepare signing env (if certificate configured) | |
| shell: bash | |
| run: | | |
| if [ -n "${{ secrets.MAC_CSC_LINK }}" ]; then | |
| echo "CSC_LINK=${{ secrets.MAC_CSC_LINK }}" >> "$GITHUB_ENV" | |
| echo "CSC_KEY_PASSWORD=${{ secrets.MAC_CSC_KEY_PASSWORD }}" >> "$GITHUB_ENV" | |
| echo "APPLE_ID=${{ secrets.APPLE_ID }}" >> "$GITHUB_ENV" | |
| echo "APPLE_APP_SPECIFIC_PASSWORD=${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" >> "$GITHUB_ENV" | |
| echo "APPLE_TEAM_ID=${{ secrets.APPLE_TEAM_ID }}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Package macOS app (arm64) | |
| run: npm run dist:mac -- --arm64 --publish never | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: 'false' | |
| - name: Upload macOS arm64 artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ourcode-ide-macos-arm64 | |
| path: | | |
| release/*.dmg | |
| release/*.zip | |
| if-no-files-found: error | |
| release-macos-x64: | |
| name: Package macOS (Intel) | |
| # macos-13 is GitHub's Intel (x64) macOS runner; keeps native modules | |
| # (better-sqlite3, node-pty) compiled natively per arch. | |
| runs-on: macos-13 | |
| timeout-minutes: 40 | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Rebuild native modules for Electron ABI | |
| run: npx electron-builder install-app-deps | |
| - name: Build (electron-vite) | |
| run: npm run build | |
| - name: Prepare signing env (if certificate configured) | |
| shell: bash | |
| run: | | |
| if [ -n "${{ secrets.MAC_CSC_LINK }}" ]; then | |
| echo "CSC_LINK=${{ secrets.MAC_CSC_LINK }}" >> "$GITHUB_ENV" | |
| echo "CSC_KEY_PASSWORD=${{ secrets.MAC_CSC_KEY_PASSWORD }}" >> "$GITHUB_ENV" | |
| echo "APPLE_ID=${{ secrets.APPLE_ID }}" >> "$GITHUB_ENV" | |
| echo "APPLE_APP_SPECIFIC_PASSWORD=${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}" >> "$GITHUB_ENV" | |
| echo "APPLE_TEAM_ID=${{ secrets.APPLE_TEAM_ID }}" >> "$GITHUB_ENV" | |
| fi | |
| - name: Package macOS app (x64) | |
| run: npm run dist:mac -- --x64 --publish never | |
| env: | |
| CSC_IDENTITY_AUTO_DISCOVERY: 'false' | |
| - name: Upload macOS x64 artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ourcode-ide-macos-x64 | |
| path: | | |
| release/*.dmg | |
| release/*.zip | |
| if-no-files-found: error |