Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main]

# Cancel previous runs on same branch/PR
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
# ── Rust: build check ─────────────────────────────────────────────
rust-build-check:
name: Rust Build Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Linux system dependencies (Tauri)
run: |
sudo apt-get update
if apt-cache show libwebkit2gtk-4.1-dev >/dev/null 2>&1; then
WEBKIT_PKG=libwebkit2gtk-4.1-dev
else
WEBKIT_PKG=libwebkit2gtk-4.0-dev
fi

if apt-cache show libappindicator3-dev >/dev/null 2>&1; then
APPINDICATOR_PKG=libappindicator3-dev
else
APPINDICATOR_PKG=libayatana-appindicator3-dev
fi

sudo apt-get install -y --no-install-recommends \
pkg-config \
libglib2.0-dev \
libgtk-3-dev \
"$WEBKIT_PKG" \
"$APPINDICATOR_PKG" \
librsvg2-dev \
patchelf

- uses: dtolnay/rust-toolchain@stable

- uses: swatinem/rust-cache@v2
with:
shared-key: "ci-check"

- name: Check compilation
run: cargo check --all-targets

# ── Frontend: build ────────────────────────────────────────────────
frontend-build:
name: Frontend Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build web UI
run: pnpm build:web
82 changes: 62 additions & 20 deletions .github/workflows/desktop-package.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,74 @@
name: Desktop Package

on:
# Triggered automatically when Release Please publishes a release
release:
types: [published]
# Manual trigger for ad-hoc builds
workflow_dispatch:
push:
tags:
- "v*"
inputs:
tag_name:
description: "Tag name to build (e.g. v0.2.0). Leave empty to build from HEAD."
required: false
type: string

permissions:
contents: write

jobs:
# ── Resolve version info ───────────────────────────────────────────
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
release_tag: ${{ steps.meta.outputs.release_tag }}
upload_to_release: ${{ steps.meta.outputs.upload_to_release }}
steps:
- uses: actions/checkout@v4

- name: Resolve version metadata
id: meta
shell: bash
run: |
set -euo pipefail

if [[ "${{ github.event_name }}" == "release" ]]; then
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG#v}"
UPLOAD="true"
elif [[ -n "${{ inputs.tag_name }}" ]]; then
TAG="${{ inputs.tag_name }}"
VERSION="${TAG#v}"
UPLOAD="false"
else
VERSION="$(jq -r '.version' package.json)"
TAG="v${VERSION}"
UPLOAD="false"
fi

echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "release_tag=$TAG" >> "$GITHUB_OUTPUT"
echo "upload_to_release=$UPLOAD" >> "$GITHUB_OUTPUT"

# ── Build per platform ─────────────────────────────────────────────
package:
name: Package (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.os }}
needs: prepare

strategy:
fail-fast: false
matrix:
platform:
- os: macos-15-intel
name: macos-x64
target: x86_64-apple-darwin
build_command: pnpm desktop:build:x86_64
- os: macos-15
name: macos-arm64
target: aarch64-apple-darwin
build_command: pnpm build:web && cd src/apps/desktop && pnpm tauri build --target aarch64-apple-darwin --bundles dmg
- os: macos-15-intel
name: macos-x64
target: x86_64-apple-darwin
build_command: pnpm desktop:build:x86_64
- os: windows-latest
name: windows-x64
target: x86_64-pc-windows-msvc
Expand All @@ -34,6 +77,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare.outputs.release_tag }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
Expand All @@ -52,8 +97,7 @@ jobs:
- name: Cache Rust build
uses: swatinem/rust-cache@v2
with:
workspaces: |
. -> target
shared-key: "package-${{ matrix.platform.name }}"

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand All @@ -64,24 +108,25 @@ jobs:
- name: Upload bundles
uses: actions/upload-artifact@v4
with:
name: bitfun-${{ matrix.platform.name }}-bundle
name: bitfun-${{ needs.prepare.outputs.release_tag }}-${{ matrix.platform.name }}-bundle
if-no-files-found: error
path: |
target/*/release/bundle
target/release/bundle
src/apps/desktop/target/release/bundle

release:
name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: package
# ── Upload assets to GitHub Release ────────────────────────────────
upload-release-assets:
name: Upload Release Assets
needs: [prepare, package]
if: needs.prepare.outputs.upload_to_release == 'true'
runs-on: ubuntu-latest

steps:
- name: Download bundled artifacts
uses: actions/download-artifact@v4
with:
pattern: bitfun-*-bundle
pattern: bitfun-${{ needs.prepare.outputs.release_tag }}-*-bundle
path: release-assets
merge-multiple: true

Expand All @@ -90,14 +135,11 @@ jobs:
echo "Release assets:"
find release-assets -type f | sort

- name: Publish release
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
generate_release_notes: true
tag_name: ${{ needs.prepare.outputs.release_tag }}
files: |
release-assets/**/*.dmg
release-assets/**/*setup.exe
overwrite_files: true
fail_on_unmatched_files: true
Loading
Loading