Skip to content

Commit 134a689

Browse files
committed
debug: release wf
1 parent 9d309a2 commit 134a689

File tree

3 files changed

+117
-79
lines changed

3 files changed

+117
-79
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ jobs:
2323
- os: macos
2424
arch: arm64
2525
runner: macos-latest
26-
- os: macos
27-
arch: x64
28-
runner: macos-13
29-
- os: windows
30-
arch: x64
31-
runner: windows-2025
3226

3327
steps:
3428
- name: Checkout code
@@ -115,6 +109,17 @@ jobs:
115109
echo "Building Windows x64 artifacts"
116110
pnpm make:windows
117111
112+
- name: Display symlink debug log
113+
if: always()
114+
working-directory: apps/desktop
115+
run: |
116+
echo "=== Symlink Debug Log ==="
117+
if [ -f symlink-debug.log ]; then
118+
cat symlink-debug.log
119+
else
120+
echo "No symlink-debug.log file found"
121+
fi
122+
118123
- name: Get version from package.json
119124
id: package_version
120125
working-directory: apps/desktop
@@ -138,76 +143,3 @@ jobs:
138143
path: |
139144
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/*.exe
140145
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/*.nupkg
141-
142-
release:
143-
name: Create Release
144-
needs: build
145-
runs-on: ubuntu-latest
146-
permissions:
147-
contents: write
148-
149-
steps:
150-
- name: Checkout code
151-
uses: actions/checkout@v4
152-
153-
- name: Get version from package.json
154-
id: package_version
155-
working-directory: apps/desktop
156-
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
157-
158-
- name: Download all artifacts
159-
uses: actions/download-artifact@v4
160-
with:
161-
path: artifacts
162-
163-
- name: List artifacts
164-
run: |
165-
echo "=== Full artifacts directory structure ==="
166-
find artifacts -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.exe" -o -name "*.nupkg" -o -name "RELEASES" \) | sort
167-
echo ""
168-
echo "=== Detailed file listing ==="
169-
find artifacts -type f \( -name "*.dmg" -o -name "*.zip" -o -name "*.exe" -o -name "*.nupkg" -o -name "RELEASES" \) -exec ls -la {} \;
170-
171-
- name: Create Release
172-
uses: softprops/action-gh-release@v2
173-
with:
174-
draft: true
175-
prerelease: true
176-
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
177-
name: Amical Desktop v${{ steps.package_version.outputs.version }}
178-
body: |
179-
## Amical Desktop v${{ steps.package_version.outputs.version }}
180-
181-
### What's New
182-
- Please update this section with actual changes
183-
184-
### Downloads
185-
186-
#### macOS
187-
- **Apple Silicon (M1/M2/M3)**: Download the DMG or ZIP file for arm64
188-
- **Intel**: Download the DMG or ZIP file for x64
189-
190-
#### Windows
191-
- **Windows (x64)**: Download the .exe installer for 64-bit Windows
192-
193-
### Installation
194-
195-
**macOS**:
196-
- **DMG**: Download and open the DMG file, then drag Amical to your Applications folder
197-
- **ZIP**: Download and extract the ZIP file, then drag Amical to your Applications folder
198-
199-
**Windows**:
200-
- Download and run the .exe installer
201-
- Follow the installation wizard
202-
- The app will be installed to your user AppData folder and a shortcut will be created
203-
204-
The ZIP files are primarily for automatic updates. We recommend using the DMG files for initial installation on macOS.
205-
files: |
206-
artifacts/macos-arm64/*.dmg
207-
artifacts/macos-arm64/zip/darwin/arm64/*.zip
208-
artifacts/macos-x64/*.dmg
209-
artifacts/macos-x64/zip/darwin/x64/*.zip
210-
artifacts/windows-x64/*.exe
211-
artifacts/windows-x64/*.nupkg
212-
env:
213-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ dist
3232
npm-debug.log*
3333
yarn-debug.log*
3434
yarn-error.log*
35+
symlink-debug.log
3536

3637
# Misc
3738
.DS_Store

apps/desktop/forge.config.ts

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import {
1919
rmSync,
2020
lstatSync,
2121
readlinkSync,
22+
writeFileSync,
23+
appendFileSync,
2224
} from "node:fs";
2325
import { join, normalize } from "node:path";
2426
// Use flora-colossus for finding all dependencies of EXTERNAL_DEPENDENCIES
@@ -129,45 +131,144 @@ const config: ForgeConfig = {
129131
`Found ${nativeModuleDependenciesToPackage.length} dependencies to copy`,
130132
);
131133

134+
// Create debug log file for copy operations
135+
const copyDebugLogPath = join(projectRoot, "symlink-debug.log");
136+
const copyTimestamp = new Date().toISOString();
137+
const copyDebugHeader = `========== Copy Dependencies Debug ==========\n` +
138+
`Timestamp: ${copyTimestamp}\n` +
139+
`Platform: ${platform}\n` +
140+
`Arch: ${arch}\n` +
141+
`Total Dependencies: ${nativeModuleDependenciesToPackage.length}\n` +
142+
`===========================================\n\n`;
143+
writeFileSync(copyDebugLogPath, copyDebugHeader);
144+
132145
// Copy all required dependencies
133146
for (const dep of nativeModuleDependenciesToPackage) {
134147
const rootDepPath = join(rootNodeModules, dep);
135148
const localDepPath = join(localNodeModules, dep);
136149

150+
const copyDebugInfo: any = {
151+
dependency: dep,
152+
sourcePath: rootDepPath,
153+
targetPath: localDepPath,
154+
sourceExists: existsSync(rootDepPath),
155+
targetExists: existsSync(localDepPath),
156+
};
157+
158+
// Check source stats if it exists
159+
if (copyDebugInfo.sourceExists) {
160+
const sourceStats = lstatSync(rootDepPath);
161+
copyDebugInfo.sourceIsSymlink = sourceStats.isSymbolicLink();
162+
copyDebugInfo.sourceIsDirectory = sourceStats.isDirectory();
163+
164+
if (sourceStats.isSymbolicLink()) {
165+
try {
166+
copyDebugInfo.sourceSymlinkTarget = readlinkSync(rootDepPath);
167+
} catch (e) {
168+
copyDebugInfo.sourceSymlinkTarget = `Error reading symlink: ${e}`;
169+
}
170+
}
171+
}
172+
173+
// Check target stats if it exists
174+
if (copyDebugInfo.targetExists) {
175+
const targetStats = lstatSync(localDepPath);
176+
copyDebugInfo.targetIsSymlink = targetStats.isSymbolicLink();
177+
copyDebugInfo.targetIsDirectory = targetStats.isDirectory();
178+
179+
if (targetStats.isSymbolicLink()) {
180+
try {
181+
copyDebugInfo.targetSymlinkTarget = readlinkSync(localDepPath);
182+
} catch (e) {
183+
copyDebugInfo.targetSymlinkTarget = `Error reading symlink: ${e}`;
184+
}
185+
}
186+
}
187+
188+
appendFileSync(copyDebugLogPath, `\nCopy operation for: ${dep}\n`);
189+
appendFileSync(copyDebugLogPath, JSON.stringify(copyDebugInfo, null, 2) + "\n");
190+
137191
try {
138192
// Skip if source doesn't exist
139193
if (!existsSync(rootDepPath)) {
140194
console.log(`Skipping ${dep}: not found in root node_modules`);
195+
appendFileSync(copyDebugLogPath, `>>> SKIPPED: Source not found\n`);
141196
continue;
142197
}
143198

144199
// Skip if target already exists (don't override)
145200
if (existsSync(localDepPath)) {
146201
console.log(`Skipping ${dep}: already exists locally`);
202+
appendFileSync(copyDebugLogPath, `>>> SKIPPED: Target already exists\n`);
147203
continue;
148204
}
149205

150206
// Copy the package
151207
console.log(`Copying ${dep}...`);
208+
appendFileSync(copyDebugLogPath, `>>> COPYING with options: { recursive: true, dereference: true, force: true }\n`);
152209
cpSync(rootDepPath, localDepPath, { recursive: true, dereference: true, force: true });
153210
console.log(`✓ Successfully copied ${dep}`);
211+
appendFileSync(copyDebugLogPath, `>>> SUCCESS: Copied successfully\n`);
212+
213+
// Check what was actually copied
214+
if (existsSync(localDepPath)) {
215+
const afterCopyStats = lstatSync(localDepPath);
216+
const afterCopyInfo = {
217+
isSymlink: afterCopyStats.isSymbolicLink(),
218+
isDirectory: afterCopyStats.isDirectory(),
219+
};
220+
appendFileSync(copyDebugLogPath, `>>> After copy stats: ${JSON.stringify(afterCopyInfo)}\n`);
221+
}
154222
} catch (error) {
155223
console.error(`Failed to copy ${dep}:`, error);
224+
appendFileSync(copyDebugLogPath, `>>> ERROR: ${error}\n`);
156225
}
157226
}
227+
228+
appendFileSync(copyDebugLogPath, `\n========== End of Copy Dependencies ==========\n`);
158229

159230
// Second pass: Replace any symlinks with dereferenced copies
160231
console.log("Checking for symlinks in copied dependencies...");
232+
233+
// Create debug log file
234+
const debugLogPath = join(projectRoot, "symlink-debug.log");
235+
const timestamp = new Date().toISOString();
236+
const debugHeader = `\n========== Symlink Detection Debug ==========\n` +
237+
`Timestamp: ${timestamp}\n` +
238+
`Platform: ${platform}\n` +
239+
`Arch: ${arch}\n` +
240+
`Process: ${process.platform}-${process.arch}\n` +
241+
`===========================================\n\n`;
242+
appendFileSync(debugLogPath, debugHeader);
243+
161244
for (const dep of nativeModuleDependenciesToPackage) {
162245
const localDepPath = join(localNodeModules, dep);
163246

164247
try {
165248
if (existsSync(localDepPath)) {
166249
const stats = lstatSync(localDepPath);
250+
251+
// Log detailed stat info for debugging
252+
const debugInfo = {
253+
dependency: dep,
254+
path: localDepPath,
255+
isSymbolicLink: stats.isSymbolicLink(),
256+
isDirectory: stats.isDirectory(),
257+
isFile: stats.isFile(),
258+
mode: stats.mode,
259+
size: stats.size,
260+
forceProcessing: dep === "@amical/smart-whisper",
261+
willProcess: stats.isSymbolicLink() || dep === "@amical/smart-whisper",
262+
};
263+
264+
appendFileSync(debugLogPath, `Checking: ${dep}\n`);
265+
appendFileSync(debugLogPath, JSON.stringify(debugInfo, null, 2) + "\n\n");
266+
167267
//! for w/e reason sym links are persisting in ci, while locally this is working
168268
//! this is a temp bypass
169269
if (stats.isSymbolicLink() || dep === "@amical/smart-whisper") {
170270
console.log(`Found symlink for ${dep}, replacing with dereferenced copy...`);
271+
appendFileSync(debugLogPath, `>>> PROCESSING ${dep} (isSymlink: ${stats.isSymbolicLink()}, forced: ${dep === "@amical/smart-whisper"})\n`);
171272

172273
// Read where the symlink points to
173274
const symlinkTarget = readlinkSync(localDepPath);
@@ -187,12 +288,16 @@ const config: ForgeConfig = {
187288
});
188289

189290
console.log(`✓ Successfully replaced symlink for ${dep} with actual content`);
291+
appendFileSync(debugLogPath, `>>> SUCCESS: Replaced ${dep}\n\n`);
190292
}
191293
}
192294
} catch (error) {
193295
console.error(`Failed to check/replace symlink for ${dep}:`, error);
296+
appendFileSync(debugLogPath, `>>> ERROR processing ${dep}: ${error}\n\n`);
194297
}
195298
}
299+
300+
appendFileSync(debugLogPath, `========== End of Symlink Detection ==========\n\n`);
196301

197302
// Prune onnxruntime-node to keep only the required binary
198303
const targetPlatform = platform;

0 commit comments

Comments
 (0)