mirror of
https://github.com/Xevion/byte-me.git
synced 2025-12-06 05:14:37 -06:00
120 lines
3.5 KiB
YAML
120 lines
3.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
name: Build (${{ matrix.os }}${{ matrix.target && format(' / {0}', matrix.target) || '' }})
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-22.04
|
|
target: x86_64-unknown-linux-gnu
|
|
artifact_name: byte-me-linux-x86_64
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
artifact_name: byte-me-windows-x86_64
|
|
artifact_extension: .exe
|
|
- os: macos-latest
|
|
target: aarch64-apple-darwin
|
|
artifact_name: byte-me-macos-aarch64
|
|
- os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
artifact_name: byte-me-macos-x86_64
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v5
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt, clippy
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Use sccache
|
|
if: runner.os != 'Linux' && github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
uses: mozilla-actions/sccache-action@v0.0.9
|
|
|
|
- name: Configure sccache
|
|
if: runner.os != 'Linux' && github.event_name != 'release' && github.event_name != 'workflow_dispatch'
|
|
run: |
|
|
# Enable GitHub Actions for cache storage
|
|
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
|
|
# Use sccache for rustc
|
|
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
|
|
|
|
- name: Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.24.0
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: 22.21.1
|
|
cache: "pnpm"
|
|
|
|
- name: Install frontend dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Install backend dependencies
|
|
run: cargo fetch --manifest-path src-tauri/Cargo.toml
|
|
|
|
- name: Install Tauri CLI
|
|
uses: Xevion/cache-cargo-install-action@main
|
|
with:
|
|
tool: tauri-cli@2
|
|
locked: true
|
|
|
|
- name: Cache apt packages
|
|
if: runner.os == 'Linux'
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /var/cache/apt/archives
|
|
key: ${{ runner.os }}-apt-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-apt-
|
|
|
|
- name: Install Linux dependencies
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
# Update package list and install dependencies in one command to reduce time
|
|
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
libxdo-dev \
|
|
libglib2.0-dev \
|
|
libwebkit2gtk-4.1-dev \
|
|
libayatana-appindicator3-dev \
|
|
librsvg2-dev \
|
|
patchelf \
|
|
musl-tools
|
|
|
|
- name: Generate frontend bindings
|
|
run: pnpm run generate-types
|
|
|
|
- name: Build app (tauri)
|
|
run: cargo tauri build --target ${{ matrix.target }}
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v5
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: |
|
|
src-tauri/target/${{ matrix.target }}/release/byte-me${{ matrix.artifact_extension }}
|
|
src-tauri/target/${{ matrix.target }}/release/bundle/**/*
|
|
if-no-files-found: error
|