From 245edefcec4c79fac9dc9cdf173e1c8f141f6506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Thu, 12 Dec 2024 09:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20=E8=B0=83=E6=95=B4=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20x3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test.yml | 62 +++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3eae1722..98ab5a0b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,10 +1,29 @@ name: Build Test on: workflow_dispatch: + input: + version: + description: "Version to build" + required: true + default: "0.1.0" jobs: - test_ssh: - runs-on: ubuntu-latest + build-tauri: + strategy: + fail-fast: false + matrix: + settings: + - platform: windows-latest + args: "--verbose" + target: "windows" + - platform: macos-latest + args: "--target x86_64-apple-darwin" + target: "macos-intel" + - platform: macos-latest + args: "--target aarch64-apple-darwin" + target: "macos-arm" + runs-on: ${{ matrix.settings.platform }} + steps: - name: Checkout uses: actions/checkout@v4 @@ -12,5 +31,40 @@ jobs: uses: webfactory/ssh-agent@v0.5.3 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Run SSH command - run: ssh -T git@github.com + - name: Add Rust targets(macOS Intel) + if: matrix.settings.target == 'macos-intel' + run: rustup target add x86_64-apple-darwin + - name: Add Rust targets(macOS ARM) + if: matrix.settings.target == 'macos-arm' + run: rustup target add aarch64-apple-darwin + + - name: Rust setup + uses: dtolnay/rust-toolchain@stable + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./src-tauri -> target" + + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: 23.3.0 + - name: setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 9.15.0 + - name: Install frontend dependencies + run: pnpm install + + - name: Build app + run: pnpm tauri build -- ${{ matrix.settings.args }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_DIST_DIR: dist/${{ matrix.settings.target }} + TAURI_DIST_TARGET: ${{ matrix.settings.target }} + TAURI_VERSION: ${{ github.event.inputs.version }} + + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: tauri-${{ matrix.settings.target }}