🐛 Refactoring actions
This commit is contained in:
147
.github/actions/setup-env/action.yml
vendored
Normal file
147
.github/actions/setup-env/action.yml
vendored
Normal file
@@ -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/cache-apt-pkgs-action@v1.4.3
|
||||
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-
|
||||
31
.github/actions/setup-node.yml
vendored
31
.github/actions/setup-node.yml
vendored
@@ -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
|
||||
40
.github/actions/setup-rust-cache.yml
vendored
40
.github/actions/setup-rust-cache.yml
vendored
@@ -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/restore@v4.2.0
|
||||
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/save@v4.2.0
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/bin/
|
||||
~/.cargo/registry/index/
|
||||
~/.cargo/registry/cache/
|
||||
~/.cargo/git/db/
|
||||
src-tauri/target/
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
45
.github/actions/setup-rust.yml
vendored
45
.github/actions/setup-rust.yml
vendored
@@ -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
|
||||
11
.github/actions/setup-ubuntu-deps.yml
vendored
11
.github/actions/setup-ubuntu-deps.yml
vendored
@@ -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/cache-apt-pkgs-action@v1.4.3
|
||||
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
|
||||
21
.github/actions/setup-windows.yml
vendored
21
.github/actions/setup-windows.yml
vendored
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user