mirror of
https://github.com/Xevion/smart-rgb.git
synced 2025-12-09 16:08:41 -06:00
Update source files
This commit is contained in:
187
.github/workflows/builds.yml
vendored
Normal file
187
.github/workflows/builds.yml
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
name: Builds
|
||||
on:
|
||||
- push
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
RUST_VERSION: "stable"
|
||||
jobs:
|
||||
desktop:
|
||||
name: Desktop (${{ matrix.target.os }} / ${{ matrix.target.arch }})
|
||||
runs-on: ${{ matrix.target.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- os: linux
|
||||
arch: x86_64
|
||||
runner: ubuntu-22.04
|
||||
rust_target: x86_64-unknown-linux-gnu
|
||||
- os: macos
|
||||
arch: x86_64
|
||||
runner: macos-15-intel
|
||||
rust_target: x86_64-apple-darwin
|
||||
- os: macos
|
||||
arch: aarch64
|
||||
runner: macos-latest
|
||||
rust_target: aarch64-apple-darwin
|
||||
- os: windows
|
||||
arch: x86_64
|
||||
runner: windows-latest
|
||||
rust_target: x86_64-pc-windows-msvc
|
||||
- os: windows
|
||||
arch: aarch64
|
||||
runner: windows-latest
|
||||
rust_target: aarch64-pc-windows-msvc
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ env.RUST_VERSION }}
|
||||
components: rustfmt, clippy
|
||||
targets: ${{ matrix.target.rust_target }}
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
key: ${{ matrix.target.rust_target }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
- name: Install frontend dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
working-directory: frontend
|
||||
- name: Cache Tauri CLI (macOS only)
|
||||
if: matrix.target.os == 'macos'
|
||||
id: cache-tauri-cli
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cargo/bin/cargo-tauri
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-tauri-cli-2
|
||||
- name: Install cargo-binstall
|
||||
if: matrix.target.os != 'macos'
|
||||
uses: taiki-e/install-action@cargo-binstall
|
||||
- name: Install Tauri CLI (via binstall)
|
||||
if: matrix.target.os != 'macos'
|
||||
run: cargo binstall tauri-cli --version '^2' --no-confirm
|
||||
- name: Install Tauri CLI (from source on macOS)
|
||||
if: matrix.target.os == 'macos' && steps.cache-tauri-cli.outputs.cache-hit != 'true'
|
||||
run: cargo install tauri-cli --version '^2' --locked
|
||||
env:
|
||||
CARGO_PROFILE_RELEASE_LTO: false
|
||||
- name: Cache apt packages
|
||||
if: matrix.target.os == 'linux'
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
/var/cache/apt/archives/*.deb
|
||||
key: ${{ matrix.target.runner }}-apt-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ matrix.target.runner }}-apt-
|
||||
- name: Install Linux dependencies
|
||||
if: matrix.target.os == 'linux'
|
||||
run: |
|
||||
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libglib2.0-dev \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
libayatana-appindicator3-dev \
|
||||
librsvg2-dev \
|
||||
patchelf
|
||||
- name: Build desktop app
|
||||
run: cargo tauri build --target ${{ matrix.target.rust_target }}
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: iron-borders-${{ matrix.target.os }}-${{ matrix.target.arch }}
|
||||
path: |
|
||||
target/${{ matrix.target.rust_target }}/release/*.exe
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/appimage/*.AppImage
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/deb/*.deb
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/rpm/*.rpm
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/macos/*.app
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/dmg/*.dmg
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/msi/*.msi
|
||||
target/${{ matrix.target.rust_target }}/release/bundle/nsis/*.exe
|
||||
if-no-files-found: ignore
|
||||
browser:
|
||||
name: Browser (WASM)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: ${{ env.RUST_VERSION }}
|
||||
targets: x86_64-unknown-linux-gnu, wasm32-unknown-unknown
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 20
|
||||
cache: pnpm
|
||||
cache-dependency-path: frontend/pnpm-lock.yaml
|
||||
- name: Install frontend dependencies
|
||||
run: pnpm install --frozen-lockfile --prefer-offline
|
||||
working-directory: frontend
|
||||
- name: Install wasm-bindgen-cli
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: wasm-bindgen-cli@0.2.104
|
||||
- name: Install wasm-opt
|
||||
uses: taiki-e/install-action@v2
|
||||
with:
|
||||
tool: wasm-opt@0.116.1
|
||||
- name: Build WASM release
|
||||
run: |
|
||||
cargo build -p borders-wasm --profile wasm-release --target wasm32-unknown-unknown
|
||||
wasm-bindgen --out-dir pkg --out-name borders --target web target/wasm32-unknown-unknown/wasm-release/borders_wasm.wasm
|
||||
wasm-opt -Oz --enable-bulk-memory --enable-threads --all-features pkg/borders_bg.wasm -o pkg/borders_bg.wasm
|
||||
mkdir -p frontend/pkg
|
||||
cp -r pkg/* frontend/pkg/
|
||||
- name: Build frontend (root-based)
|
||||
run: pnpm run build:browser
|
||||
working-directory: frontend
|
||||
- name: Upload browser artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: iron-borders-browser
|
||||
path: frontend/dist/browser/**/*
|
||||
if-no-files-found: error
|
||||
- name: Build frontend (GitHub Pages)
|
||||
run: pnpm run build:browser
|
||||
working-directory: frontend
|
||||
env:
|
||||
GITHUB_PAGES: true
|
||||
deploy-cloudflare:
|
||||
name: Deploy to Cloudflare Pages
|
||||
needs: browser
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
steps:
|
||||
- name: Download browser artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: iron-borders-browser
|
||||
path: dist
|
||||
- name: Deploy to Cloudflare Pages
|
||||
id: deploy
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy dist --project-name=borders
|
||||
- name: Print deployment URL
|
||||
env:
|
||||
DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}
|
||||
run: echo "Deployed to $DEPLOYMENT_URL"
|
||||
Reference in New Issue
Block a user