perf: 配置代码分割,将大的第三方库单独打包 #111
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: PR 检查 | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: windows | |
| arch: x86_64 | |
| runner: windows-latest | |
| - platform: macos | |
| arch: x86_64 | |
| runner: macos-15-intel | |
| - platform: macos | |
| arch: aarch64 | |
| runner: macos-latest | |
| - platform: linux | |
| arch: x86_64 | |
| runner: ubuntu-22.04 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v4 | |
| - name: 安装 Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: 安装 Rust 稳定版 | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: 安装 pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| run_install: false | |
| - name: 获取 pnpm store 目录 | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: 设置 pnpm 缓存 | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Rust 缓存 | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: './src-tauri -> target' | |
| - name: 安装 Ubuntu 依赖 | |
| if: matrix.platform == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev | |
| - name: 安装前端依赖 | |
| run: pnpm install | |
| - name: 类型检查 | |
| run: pnpm run build | |
| - name: Tauri 构建测试 | |
| run: pnpm run tauri build | |
| - name: 上传构建产物 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform }}-${{ matrix.arch }}-build | |
| path: src-tauri/target/release/bundle/ | |
| if-no-files-found: warn | |
| retention-days: 7 | |