From 8d1d970324f01563af3d23b3625a05be23acb0b4 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Thu, 29 May 2025 10:46:48 +0400 Subject: [PATCH] chore: update workflows to include Node.js and pnpm setup, add nodecar build and test steps --- .github/workflows/lint-rs.yml | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 2 +- package.json | 3 ++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-rs.yml b/.github/workflows/lint-rs.yml index 1491c2a..f261ce9 100644 --- a/.github/workflows/lint-rs.yml +++ b/.github/workflows/lint-rs.yml @@ -32,6 +32,15 @@ jobs: - name: Checkout repository code uses: actions/checkout@v4 + - name: Set up pnpm package manager + uses: pnpm/action-setup@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .node-version + cache: "pnpm" + - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: @@ -43,6 +52,33 @@ jobs: sudo apt-get update sudo apt install libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev + - name: Install nodecar dependencies + run: | + cd nodecar + pnpm install --frozen-lockfile + + - name: Build nodecar binary + run: | + cd nodecar + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + pnpm run build:linux-x64 + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then + pnpm run build:aarch64 + elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then + pnpm run build:win-x64 + fi + + - name: Copy nodecar binary to Tauri binaries + run: | + mkdir -p src-tauri/binaries + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + cp nodecar/dist/nodecar src-tauri/binaries/nodecar-x86_64-unknown-linux-gnu + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then + cp nodecar/dist/nodecar src-tauri/binaries/nodecar-aarch64-apple-darwin + elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then + cp nodecar/dist/nodecar.exe src-tauri/binaries/nodecar-x86_64-pc-windows-msvc.exe + fi + - name: Create empty 'dist' directory run: mkdir dist @@ -53,3 +89,7 @@ jobs: - name: Run clippy check and deny warnings run: cargo clippy --all-targets --all-features -- -D warnings working-directory: src-tauri + + - name: Run Rust unit tests + run: cargo test + working-directory: src-tauri diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7654186..80fd72f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,7 +62,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 23 + node-version-file: .node-version - name: Setup pnpm uses: pnpm/action-setup@v4 diff --git a/package.json b/package.json index 1ee3d27..4c62498 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,8 @@ "prettier --write" ], "src-tauri/**/*.rs": [ - "cd src-tauri && cargo fmt --all" + "cd src-tauri && cargo fmt --all", + "cd src-tauri && cargo test" ] } }