Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

:bug: Refactoring actions

Tw933d60bd673d74
diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml
new file mode 100644
index 00000000..e924aed5
--- /dev/null
+++ b/.github/actions/setup-env/action.yml
@@ -0,0 +1,147 @@
+name: Setup Development Environment
+description: One-stop setup with smart presets
+
+# Modes: full (default), node-only, rust-only, build (with cache)
+
+inputs:
+ mode:
+ description: 'Setup mode: full, node-only, rust-only, or build'
+ required: false
+ default: 'full'
+
+outputs:
+ setup-complete:
+ description: Setup completion status
+ value: 'true'
+
+runs:
+ using: composite
+ steps:
+ # 1. Setup environment flags
+ - name: Setup environment flags
+ shell: bash
+ run: |
+ MODE="${{ inputs.mode }}"
+
+ # Validate and set flags in one pass
+ case "$MODE" in
+ full)
+ echo "SETUP_NODE=true" >> $GITHUB_ENV
+ echo "SETUP_RUST=true" >> $GITHUB_ENV
+ echo "SETUP_SYSTEM=true" >> $GITHUB_ENV
+ ;;
+ node-only)
+ echo "SETUP_NODE=true" >> $GITHUB_ENV
+ echo "SETUP_RUST=false" >> $GITHUB_ENV
+ echo "SETUP_SYSTEM=false" >> $GITHUB_ENV
+ ;;
+ rust-only)
+ echo "SETUP_NODE=false" >> $GITHUB_ENV
+ echo "SETUP_RUST=true" >> $GITHUB_ENV
+ echo "SETUP_SYSTEM=false" >> $GITHUB_ENV
+ ;;
+ build)
+ echo "SETUP_NODE=true" >> $GITHUB_ENV
+ echo "SETUP_RUST=true" >> $GITHUB_ENV
+ echo "SETUP_SYSTEM=true" >> $GITHUB_ENV
+ ;;
+ *)
+ echo "❌ Invalid mode: '$MODE'. Valid modes: full, node-only, rust-only, build"
+ exit 1
+ ;;
+ esac
+
+ # 2. Node.js Environment Setup
+ - name: Install pnpm
+ if: env.SETUP_NODE == 'true'
+ uses: pnpm/action-setup@v4
+ with:
+ version: '10.15.0'
+ run_install: false
+
+ - name: Setup Node.js
+ if: env.SETUP_NODE == 'true'
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+ cache: pnpm
+
+ - name: Install dependencies
+ if: env.SETUP_NODE == 'true'
+ shell: bash
+ run: pnpm install --frozen-lockfile
+
+ # 3. Rust Environment Setup
+ - name: Setup Rust for Linux
+ if: env.SETUP_RUST == 'true' && runner.os == 'Linux'
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ toolchain: stable
+ target: x86_64-unknown-linux-gnu
+
+ - name: Setup Rust for Windows
+ if: env.SETUP_RUST == 'true' && runner.os == 'Windows'
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ toolchain: stable-x86_64-msvc
+ target: x86_64-pc-windows-msvc
+
+ - name: Setup Rust for macOS
+ if: env.SETUP_RUST == 'true' && runner.os == 'macOS'
+ uses: dtolnay/rust-toolchain@stable
+ with:
+ toolchain: stable
+ target: x86_64-apple-darwin
+
+ - name: Add macOS universal targets
+ if: env.SETUP_RUST == 'true' && runner.os == 'macOS'
+ shell: bash
+ run: rustup target add aarch64-apple-darwin
+
+ # 4. System Dependencies
+ - name: Install Ubuntu dependencies
+ if: env.SETUP_SYSTEM == 'true' && runner.os == 'Linux'
+ uses: awalsh128/[email protected]
+ with:
+ packages: >
+ libdbus-1-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev
+ build-essential curl wget file libxdo-dev libssl-dev libgtk-3-dev
+ libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
+ version: 1.1
+
+ - name: Install WIX Toolset
+ if: env.SETUP_SYSTEM == 'true' && runner.os == 'Windows'
+ shell: powershell
+ run: |
+ try {
+ # Download and install WIX Toolset v3.11
+ Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311.exe" -OutFile "wix311.exe"
+ Start-Process -FilePath "wix311.exe" -ArgumentList "/quiet" -Wait
+
+ # Add WIX to PATH
+ $wixPath = "${env:ProgramFiles(x86)}\WiX Toolset v3.11\bin"
+ if (Test-Path $wixPath) {
+ echo $wixPath >> $env:GITHUB_PATH
+ Write-Host "✅ WIX Toolset installed successfully"
+ } else {
+ Write-Warning "WIX installation path not found"
+ }
+ } catch {
+ Write-Error "Failed to install WIX Toolset: $($_.Exception.Message)"
+ exit 1
+ }
+
+ # 5. Build optimizations (caching)
+ - name: Setup Rust cache
+ if: inputs.mode == 'build'
+ uses: actions/cache@v4
+ with:
+ path: |
+ ~/.cargo/bin/
+ ~/.cargo/registry/index/
+ ~/.cargo/registry/cache/
+ ~/.cargo/git/db/
+ src-tauri/target/
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-cargo-
diff --git a/.github/actions/setup-node.yml b/.github/actions/setup-node.yml
deleted file mode 100644
index 61e34b89..00000000
--- a/.github/actions/setup-node.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: Setup Node.js Environment
-description: Install Node.js and pnpm with caching
-
-inputs:
- node-version:
- description: Node.js version to install
- required: false
- default: '22'
- pnpm-version:
- description: pnpm version to install
- required: false
- default: '10.15.0'
-
-runs:
- using: composite
- steps:
- - name: Install pnpm
- uses: pnpm/action-setup@v4
- with:
- version: ${{ inputs.pnpm-version }}
- run_install: false
-
- - name: Setup Node.js
- uses: actions/setup-node@v4
- with:
- node-version: ${{ inputs.node-version }}
- cache: pnpm
-
- - name: Install dependencies
- shell: bash
- run: pnpm install --frozen-lockfile
\ No newline at end of file
diff --git a/.github/actions/setup-rust-cache.yml b/.github/actions/setup-rust-cache.yml
deleted file mode 100644
index dc6e4272..00000000
--- a/.github/actions/setup-rust-cache.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-name: Setup Rust Cache
-description: Setup Rust dependency caching with restore and save
-
-inputs:
- save-cache:
- description: Whether to save cache after build
- required: false
- default: 'false'
-
-outputs:
- cache-hit:
- description: Whether cache was restored successfully
- value: ${{ steps.cache_restore.outputs.cache-hit }}
-
-runs:
- using: composite
- steps:
- - name: Rust cache restore
- uses: actions/cache/[email protected]
- id: cache_restore
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- src-tauri/target/
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
-
- - name: Rust cache save
- if: inputs.save-cache == 'true'
- uses: actions/cache/[email protected]
- with:
- path: |
- ~/.cargo/bin/
- ~/.cargo/registry/index/
- ~/.cargo/registry/cache/
- ~/.cargo/git/db/
- src-tauri/target/
- key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
\ No newline at end of file
diff --git a/.github/actions/setup-rust.yml b/.github/actions/setup-rust.yml
deleted file mode 100644
index 22591e30..00000000
--- a/.github/actions/setup-rust.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-name: Setup Rust Environment
-description: Install and configure Rust toolchain with platform-specific targets
-
-inputs:
- platform:
- description: Platform to setup Rust for
- required: true
- components:
- description: Additional Rust components to install
- required: false
- default: ''
-
-runs:
- using: composite
- steps:
- - name: Install Rust for Linux
- if: contains(inputs.platform, 'ubuntu')
- uses: dtolnay/rust-toolchain@stable
- with:
- toolchain: stable
- target: x86_64-unknown-linux-gnu
- components: ${{ inputs.components }}
-
- - name: Install Rust for Windows
- if: contains(inputs.platform, 'windows')
- uses: dtolnay/rust-toolchain@stable
- with:
- toolchain: stable-x86_64-msvc
- target: x86_64-pc-windows-msvc
- components: ${{ inputs.components }}
-
- - name: Install Rust for macOS
- if: contains(inputs.platform, 'macos')
- uses: dtolnay/rust-toolchain@stable
- with:
- toolchain: stable
- target: x86_64-apple-darwin
- components: ${{ inputs.components }}
-
- - name: Add macOS universal targets
- if: contains(inputs.platform, 'macos')
- shell: bash
- run: |
- rustup target add aarch64-apple-darwin
- rustup target add x86_64-apple-darwin
\ No newline at end of file
diff --git a/.github/actions/setup-ubuntu-deps.yml b/.github/actions/setup-ubuntu-deps.yml
deleted file mode 100644
index de50b161..00000000
--- a/.github/actions/setup-ubuntu-deps.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-name: Setup Ubuntu Dependencies
-description: Install system dependencies required for Tauri on Ubuntu
-
-runs:
- using: composite
- steps:
- - name: Install Ubuntu system dependencies
- uses: awalsh128/[email protected]
- with:
- packages: libdbus-1-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
- version: 1.1
\ No newline at end of file
diff --git a/.github/actions/setup-windows.yml b/.github/actions/setup-windows.yml
deleted file mode 100644
index 9a840c8c..00000000
--- a/.github/actions/setup-windows.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-name: Setup Windows Environment
-description: Install WIX Toolset and other Windows-specific dependencies
-
-runs:
- using: composite
- steps:
- - name: Install WIX Toolset
- shell: powershell
- run: |
- # Download and install WIX Toolset v3.11
- Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311.exe" -OutFile "wix311.exe"
- Start-Process -FilePath "wix311.exe" -ArgumentList "/quiet" -Wait
-
- # Add WIX to PATH
- $wixPath = "${env:ProgramFiles(x86)}\WiX Toolset v3.11\bin"
- if (Test-Path $wixPath) {
- echo $wixPath >> $env:GITHUB_PATH
- echo "WIX Toolset installed successfully"
- } else {
- echo "Warning: WIX installation path not found"
- }
\ No newline at end of file
diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yaml
index fb1f4a09..82e9a19c 100644
--- a/.github/workflows/pake-cli.yaml
+++ b/.github/workflows/pake-cli.yaml
@@ -69,20 +69,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Setup Node.js Environment
- uses: ./.github/actions/setup-node.yml
+ - name: Setup Build Environment
+ uses: ./.github/actions/setup-env
with:
- node-version: ${{ env.NODE_VERSION }}
- pnpm-version: ${{ env.PNPM_VERSION }}
-
- - name: Setup Rust Environment
- uses: ./.github/actions/setup-rust.yml
- with:
- platform: ${{ inputs.platform }}
-
- - name: Setup Ubuntu Dependencies
- if: contains(inputs.platform, 'ubuntu')
- uses: ./.github/actions/setup-ubuntu-deps.yml
+ mode: build
- name: Cache Node dependencies
uses: actions/cache@v4
diff --git a/.github/workflows/quality-and-test.yml b/.github/workflows/quality-and-test.yml
index e9be8312..b24d14dd 100644
--- a/.github/workflows/quality-and-test.yml
+++ b/.github/workflows/quality-and-test.yml
@@ -34,17 +34,8 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- - name: Setup Node.js Environment
- uses: ./.github/actions/setup-node.yml
- with:
- node-version: ${{ env.NODE_VERSION }}
- pnpm-version: ${{ env.PNPM_VERSION }}
-
- - name: Setup Rust Environment
- uses: ./.github/actions/setup-rust.yml
- with:
- platform: ubuntu-latest
- components: rustfmt
+ - name: Setup Development Environment
+ uses: ./.github/actions/setup-env
- name: Auto-fix Prettier formatting
@@ -73,8 +64,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Setup Node.js Environment
- uses: ./.github/actions/setup-node.yml
+ - name: Setup Build Environment
+ uses: ./.github/actions/setup-env
+ with:
+ mode: build
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
@@ -104,27 +97,26 @@ jobs:
- uses: actions/checkout@v4
- name: Setup Rust Environment
- uses: ./.github/actions/setup-rust.yml
+ uses: ./.github/actions/setup-env
with:
- platform: ${{ matrix.os }}
- components: rustfmt, clippy
+ mode: rust-only
+
+ - name: Install Rust components
+ shell: bash
+ run: rustup component add rustfmt clippy
- uses: rui314/setup-mold@v1
if: matrix.os == 'ubuntu-latest'
- - uses: taiki-e/install-action@v1
+ - uses: taiki-e/install-action@v1 # cspell:disable-line
with:
tool: cargo-hack
- - name: Setup Ubuntu Dependencies
- if: matrix.os == 'ubuntu-latest'
- uses: ./.github/actions/setup-ubuntu-deps.yml
-
- name: Check Rust formatting
run: cargo fmt --all -- --color=always --check
- name: Run Clippy lints
- run: cargo hack --feature-powerset --exclude-features cli-build --no-dev-deps clippy
+ run: cargo hack --feature-powerset --exclude-features cli-build --no-dev-deps clippy # cspell:disable-line
cli-tests:
name: CLI Tests (${{ matrix.os }})
@@ -137,25 +129,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Setup Node.js Environment
- uses: ./.github/actions/setup-node.yml
+ - name: Setup Build Environment
+ uses: ./.github/actions/setup-env
with:
- node-version: ${{ env.NODE_VERSION }}
- pnpm-version: ${{ env.PNPM_VERSION }}
-
- - name: Setup Rust Environment
- uses: ./.github/actions/setup-rust.yml
+ mode: build
with:
- platform: ${{ matrix.os }}
-
-
- - name: Setup Ubuntu Dependencies
- if: matrix.os == 'ubuntu-latest'
- uses: ./.github/actions/setup-ubuntu-deps.yml
-
- - name: Setup Windows Environment
- if: matrix.os == 'windows-latest'
- uses: ./.github/actions/setup-windows.yml
- name: Build CLI
run: pnpm run cli:build
@@ -188,30 +166,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- - name: Setup Node.js Environment
- uses: ./.github/actions/setup-node.yml
+ - name: Setup Build Environment
+ uses: ./.github/actions/setup-env
with:
- node-version: ${{ env.NODE_VERSION }}
- pnpm-version: ${{ env.PNPM_VERSION }}
-
- - name: Setup Rust Environment
- uses: ./.github/actions/setup-rust.yml
+ mode: build
with:
- platform: ${{ matrix.os }}
-
- - name: Add macOS targets
- if: matrix.os == 'macos-latest'
- run: |
- rustup target add aarch64-apple-darwin
- rustup target add x86_64-apple-darwin
-
- - name: Setup Ubuntu Dependencies
- if: matrix.os == 'ubuntu-latest'
- uses: ./.github/actions/setup-ubuntu-deps.yml
- - name: Setup Windows Environment
- if: matrix.os == 'windows-latest'
- uses: ./.github/actions/setup-windows.yml
- name: Build CLI
run: pnpm run cli:build
diff --git a/.github/workflows/single-app.yaml b/.github/workflows/single-app.yaml
index 8a0d132d..2808a28c 100644
--- a/.github/workflows/single-app.yaml
+++ b/.github/workflows/single-app.yaml
@@ -78,14 +78,9 @@ jobs:
target: ${{ matrix.target }}
- name: Setup Node.js Environment
- uses: ./.github/actions/setup-node.yml
+ uses: ./.github/actions/setup-env
with:
- node-version: ${{ env.NODE_VERSION }}
- pnpm-version: ${{ env.PNPM_VERSION }}
-
- - name: Setup Ubuntu Dependencies
- if: matrix.os == 'ubuntu-latest'
- uses: ./.github/actions/setup-ubuntu-deps.yml
+ mode: node-only
- name: Rust cache restore
uses: actions/cache/[email protected]