Update CI and release workflows, add TypeScript support, and refactor code for clarity

- Standardized quotes in CI and release workflow files for consistency.
- Introduced TypeScript job in CI workflow to check for file changes and run type checks.
- Refactored function signatures in the macOS Tauri library for improved readability.
- Updated Tauri configuration for release build commands and include external daemon binary.
- Enhanced artifact handling in release workflow for better organization and clarity.
This commit is contained in:
Jamie Pine 2025-12-10 15:21:01 -08:00
parent 651e9bae46
commit ccb5909ebd
4 changed files with 88 additions and 44 deletions

View File

@ -35,10 +35,10 @@ jobs:
with:
swap-size-mb: 3072
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
remove-dotnet: "true"
remove-codeql: "true"
remove-haskell: "true"
remove-docker-images: "true"
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
@ -82,7 +82,7 @@ jobs:
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
uses: ./.github/actions/setup-rust
with:
restore-cache: 'false'
restore-cache: "false"
- name: Run rustfmt
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
@ -90,7 +90,7 @@ jobs:
clippy:
strategy:
fail-fast: false # Don't cancel other platforms if one fails
fail-fast: false # Don't cancel other platforms if one fails
matrix:
settings:
- host: macos-13
@ -113,10 +113,10 @@ jobs:
with:
swap-size-mb: 3072
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
remove-dotnet: "true"
remove-codeql: "true"
remove-haskell: "true"
remove-docker-images: "true"
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
@ -195,10 +195,10 @@ jobs:
with:
swap-size-mb: 3072
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
remove-dotnet: "true"
remove-codeql: "true"
remove-haskell: "true"
remove-docker-images: "true"
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
@ -209,7 +209,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
# TODO: Re-enable when submodule repos are public
# OPTIONAL: Re-enable when submodule repos are public
# with:
# submodules: recursive
@ -247,3 +247,42 @@ jobs:
name: cli-${{ matrix.settings.platform }}
path: dist/*
retention-days: 7
typescript:
name: TypeScript
runs-on: ubuntu-22.04
timeout-minutes: 15
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if files have changed
uses: dorny/paths-filter@v3
continue-on-error: true
id: filter
with:
filters: |
changes:
- 'apps/tauri/**'
- 'packages/**'
- 'package.json'
- 'bun.lockb'
- 'tsconfig.json'
- '.github/workflows/ci.yml'
- name: Setup Bun
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install dependencies
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
run: bun install --frozen-lockfile
- name: TypeScript typecheck
if: steps.filter.outcome != 'success' || steps.filter.outputs.changes == 'true'
run: bun run typecheck
working-directory: apps/tauri

View File

@ -3,8 +3,8 @@ name: Release
on:
pull_request:
paths:
- '.github/workflows/release.yml'
- '.github/actions/publish-artifacts/**'
- ".github/workflows/release.yml"
- ".github/actions/publish-artifacts/**"
workflow_dispatch:
# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/release.yaml#L13-L21
@ -138,10 +138,10 @@ jobs:
with:
swap-size-mb: 3072
root-reserve-mb: 6144
remove-dotnet: 'true'
remove-codeql: 'true'
remove-haskell: 'true'
remove-docker-images: 'true'
remove-dotnet: "true"
remove-codeql: "true"
remove-haskell: "true"
remove-docker-images: "true"
- name: Symlink target to C:\
if: ${{ runner.os == 'Windows' }}
@ -182,6 +182,22 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Build daemon binary
run: cargo build --release --bin sd-daemon --target ${{ matrix.settings.target }}
- name: Prepare daemon binary for bundling (Unix)
if: runner.os != 'Windows'
run: |
mkdir -p target/release
cp target/${{ matrix.settings.target }}/release/sd-daemon target/release/sd-daemon-${{ matrix.settings.target }}
- name: Prepare daemon binary for bundling (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path target/release
Copy-Item target/${{ matrix.settings.target }}/release/sd-daemon.exe target/release/sd-daemon-${{ matrix.settings.target }}.exe
- name: Build
run: |
bun tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }}
@ -201,7 +217,7 @@ jobs:
if: ${{ runner.os == 'Linux' }}
run: |
set -eux
XZ_OPT='-T0 -7' tar -cJf apps/desktop/dist.tar.xz -C apps/desktop/dist .
XZ_OPT='-T0 -7' tar -cJf apps/tauri/dist.tar.xz -C apps/tauri/dist .
- name: Publish Artifacts
uses: ./.github/actions/publish-artifacts
@ -211,12 +227,12 @@ jobs:
target: ${{ matrix.settings.target }}
profile: release
# V2 CLI Release
# Create unified release with CLI and Desktop artifacts
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
name: Create Release
needs: cli-build
needs: [cli-build, desktop-main]
permissions:
contents: write
steps:
@ -227,21 +243,4 @@ jobs:
uses: softprops/action-gh-release@v2
with:
draft: true
files: '*/**'
# V2 Desktop release
release-desktop:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
name: Create Desktop Release
needs: desktop-main
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: '*/**'
files: "*/**"

View File

@ -59,7 +59,10 @@ where
/// This function is called from Swift when a drag session ends.
/// The `session_id` must be a valid null-terminated C string pointer.
#[no_mangle]
pub unsafe extern "C" fn rust_drag_ended_callback(session_id: *const std::ffi::c_char, was_dropped: Bool) {
pub unsafe extern "C" fn rust_drag_ended_callback(
session_id: *const std::ffi::c_char,
was_dropped: Bool,
) {
let session_id_str = unsafe {
std::ffi::CStr::from_ptr(session_id)
.to_string_lossy()

View File

@ -4,7 +4,7 @@
"identifier": "com.spacedrive.desktop",
"build": {
"beforeDevCommand": "bun run dev:with-daemon",
"beforeBuildCommand": "cargo build --release --bin sd-daemon --manifest-path ../../Cargo.toml && bun run build",
"beforeBuildCommand": "bun run build",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},
@ -62,6 +62,9 @@
"icons/icon.icns",
"icons/icon.ico"
],
"externalBin": [
"../../../target/release/sd-daemon"
],
"resources": {
"gen/**/*": "./"
},