TidGi-Desktop/.github/workflows/release.yml
lin onetwo 9a6f3480f5
Feat/watch fs (#649)
* Add watch-filesystem-adaptor plugin and worker IPC

Introduces the watch-filesystem-adaptor TiddlyWiki plugin, enabling tag-based routing of tiddlers to sub-wikis by querying workspace info via worker thread IPC. Adds workerServiceCaller utility for worker-to-main service calls, updates workerAdapter and bindServiceAndProxy to support explicit service registration for workers, and documents the new IPC architecture. Updates wikiWorker and startNodeJSWiki to preload workspace ID and load the new plugin. Also updates the plugin build script to compile and copy the new plugin.

* test: wiki operation steps

* Add per-wiki labeled logging and console hijack

Introduces labeled loggers for each wiki, writing logs to separate files. Adds a logFor method to NativeService for logging with labels, updates interfaces, and hijacks worker thread console methods to redirect logs to main process for wiki-specific logging. Refactors workspaceID usage to workspace object for improved context.

* Update log handling for wiki worker and tests

Enhanced logging tests to check all log files, including wiki logs. Adjusted logger to write wiki worker logs to the main log directory. Updated e2e app script comment for correct usage.

* Enable worker thread access to main process services

Introduces a proxy system allowing worker threads to call main process services with full type safety and observable support. Adds worker-side service proxy creation, auto-attaches proxies to global.service, and updates service registration to use IPC descriptors. Documentation is added for usage and architecture.

* Update ErrorDuringStart.md

* chore: upgrade ipc cat and allow clean vite cache

* Refactor wiki worker initialization and service readiness

Moved wiki worker implementation from wikiWorker.ts to wikiWorker/index.ts and deleted the old file. Added servicesReady.ts to manage worker service readiness and callbacks, and integrated notifyServicesReady into the worker lifecycle. Updated console hijack logic to wait for service readiness before hijacking. Improved worker management in Wiki service to support detaching workers and notifying readiness.

* Refactor wiki logging to use centralized logger

Removed per-wiki loggers and console hijacking in favor of a single labeled logger. All wiki logs, including errors, are now written to a unified log file. Updated worker and service code to route logs through the main logger and removed obsolete log file naming and management logic.

* fix: ipc cat log error

* Refactor wiki test paths and improve file save logic

Updated test step to use wikiTestRootPath for directory replacements and added wikiTestRootPath to paths.ts for clarity. Improved error handling and directory logic in watch-filesystem-adaptor.ts, including saving tiddlers directly to sub-wiki folders, more informative logging, and ensuring cleanup after file writes is properly awaited.

* rename

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* feat: basic watch-fs

* feat: check file not exist

* refactor: use exponential-backoff

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* Initial commit when init a new git.

* fix: cleanup

* Refactor test setup and cleanup to separate file

Moved Before and After hooks from application.ts to a new cleanup.ts file for better organization and separation of concerns. Also removed unused imports and related code from application.ts. Minor type simplification in agent.ts for row parsing.

* test: modify and rename

* feat: enableFileSystemWatch

* refactor: unused utils.ts

* Update watch-filesystem-adaptor.ts

* refactor: use node-sentinel-file-watcher

* refactor: extract to two classes

* The logFor method lacks JSDoc describing the level parameter's

* Update startNodeJSWiki.ts

* fix: napi build

* Update electron-rebuild command in workflows

Changed the electron-rebuild command in release and test GitHub Actions workflows to use a comma-separated list for native modules instead of multiple -w flags. This simplifies the rebuild step for better-sqlite3 and nsfw modules.

* lint

* not build nsfw, try use prebuild

* Update package.json

* Update workerAdapter.ts

* remove subWikiPlugin.ts as we use new filesystem adaptor that supports tag based sub wiki

* fix: build

* fix: wrong type

* lint

* remove `act(...)` warnings

* uninstall chokidar

* refactor and test

* lint

* remove unused logic, as we already use ipc syncadaptor, not afriad of wiki status change

* Update translation.json

* test: increast timeout in CI

* Update application.ts

* fix: AI's wrong cleanup logic hidden by as unknown as

* fix: AI's wrong  as unknown as

* Update agent.feature

* Update wikiSearchPlugin.ts

* fix: A dynamic import callback was not specified.
2025-10-28 13:25:46 +08:00

155 lines
5 KiB
YAML

name: Release App
on:
push:
tags:
- "v*.*.*"
paths-ignore:
- "README.md"
- "docs/**"
- ".vscode"
pull_request:
branches:
- master
paths-ignore:
- "docs/**"
- "README.md"
- ".vscode"
concurrency:
group: release-ci-group
cancel-in-progress: true
jobs:
test:
uses: ./.github/workflows/test.yml
build:
needs: test
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: x64
- os: ubuntu-latest
platform: linux
arch: arm64
- os: macos-latest
platform: mac
arch: x64
- os: macos-latest
platform: mac
arch: arm64
- os: windows-latest
platform: win
arch: x64
- os: windows-latest
platform: win
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Install Node.js
uses: actions/setup-node@v5
with:
node-version: lts/*
# Windows specific: Set up CV dependency for pngquant-bin
# Also sets up MSVC (Microsoft Visual C++) compiler for native modules (nsfw, better-sqlite3)
- name: Set up CV dependency for pngquant-bin
if: matrix.platform == 'win'
uses: ilammy/msvc-dev-cmd@v1
# Install dependencies for x64 architectures
- name: Install dependencies (x64)
if: matrix.arch == 'x64'
run: |
${{ matrix.platform == 'linux' && 'pnpm install && pnpm remove registry-js' || 'pnpm install' }}
env:
npm_config_arch: x64
# Install dependencies for arm64 architectures
- name: Install dependencies (arm64)
if: matrix.arch == 'arm64'
run: pnpm install dugite --force
env:
npm_config_arch: ${{ matrix.platform == 'win' && 'ia32' || 'arm64' }}
- name: Build plugins
run: pnpm run build:plugin
# Install C++ build tools for native modules (Linux only)
# macOS: GitHub Actions runners come with Xcode Command Line Tools pre-installed
# Windows: MSVC is set up by msvc-dev-cmd action above
- name: Install build dependencies (Linux)
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential
- name: Install dependencies
run: pnpm install
- name: Rebuild native modules for Electron
run: pnpm exec electron-rebuild -f -w better-sqlite3,nsfw
- name: Make ${{ matrix.platform }} (${{ matrix.arch }})
run: |
pnpm exec electron-forge make --platform=${{ matrix.platform == 'mac' && 'darwin' || matrix.platform == 'win' && 'win32' || 'linux' }} --arch=${{ matrix.arch }}
env:
NODE_ENV: production
# macOS specific environment variables
APPLE_ID: ${{ matrix.platform == 'mac' && secrets.APPLE_ID || '' }}
APPLE_ID_PASSWORD: ${{ matrix.platform == 'mac' && secrets.APPLE_ID_PASSWORD || '' }}
# Windows specific environment variables
CSC_LINK: ${{ matrix.platform == 'win' && secrets.WIN_CERT || '' }}
CSC_KEY_PASSWORD: ${{ matrix.platform == 'win' && secrets.WIN_CERT_PASS || '' }}
# Common environment variables
CI: true
CI_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
# Only need 1 set of analyzer reports (linux x64)
ANALYZE: ${{ matrix.platform == 'linux' && matrix.arch == 'x64' }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload analyzer reports and packaged apps as workflow artifacts (only linux x64)
- name: Upload analyzer reports
if: matrix.platform == 'linux' && matrix.arch == 'x64'
uses: actions/upload-artifact@v4
with:
name: analyzer-reports-${{ matrix.platform }}-${{ matrix.arch }}
path: |
.vite/renderer/bundle-analyzer-renderer.html
.vite/main/bundle-analyzer-main.html
if-no-files-found: ignore
- name: Upload packaged apps
if: (matrix.platform == 'mac' && matrix.arch == 'x64') || (matrix.platform == 'win' && matrix.arch == 'x64')
uses: actions/upload-artifact@v4
with:
name: packaged-apps-${{ matrix.platform }}-${{ matrix.arch }}
path: out/make/**
if-no-files-found: ignore
# Create Release (upload artifacts from all builds)
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
generate_release_notes: true
files: |
${{ matrix.platform == 'win' && 'out/make/**/*.exe' || 'out/make/**/*' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Bundle analysis is handled by Vite configs when ANALYZE=true