Refactor CI workflows and enhance test cleanup process
- Simplified the CI workflow by consolidating the validate job to run only on Ubuntu. - Introduced a new test job that runs on both Ubuntu and Windows, including steps for dependency installation and testing. - Updated the release workflow to directly publish macOS and Windows packages without intermediate artifact uploads. - Improved the test cleanup process to include a delay and enhanced error handling for file removal on Windows.
This commit is contained in:
parent
070e79a8ec
commit
fc48f6e099
4 changed files with 44 additions and 26 deletions
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
|
|
@ -8,11 +8,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate:
|
||||||
strategy:
|
runs-on: ubuntu-latest
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, windows-latest]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -36,8 +32,31 @@ jobs:
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: pnpm lint
|
run: pnpm lint
|
||||||
|
|
||||||
- name: Test
|
|
||||||
run: pnpm test
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: pnpm build
|
run: pnpm build
|
||||||
|
|
||||||
|
test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --no-frozen-lockfile
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: pnpm test
|
||||||
|
|
|
||||||
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
|
|
@ -31,19 +31,13 @@ jobs:
|
||||||
|
|
||||||
- name: Package macOS
|
- name: Package macOS
|
||||||
env:
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CSC_LINK: ${{ secrets.MAC_CERTS }}
|
CSC_LINK: ${{ secrets.MAC_CERTS }}
|
||||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
run: pnpm dist:mac
|
run: pnpm dist:mac --publish always
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: release-macos
|
|
||||||
path: release/**
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
package-win:
|
package-win:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
@ -68,11 +62,6 @@ jobs:
|
||||||
run: pnpm build
|
run: pnpm build
|
||||||
|
|
||||||
- name: Package Windows
|
- name: Package Windows
|
||||||
run: pnpm dist:win
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Upload artifacts
|
run: pnpm dist:win --publish always
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: release-windows
|
|
||||||
path: release/**
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,16 @@ export async function extractCwd(filePath: string): Promise<string | null> {
|
||||||
const entry = JSON.parse(line) as ChatHistoryEntry;
|
const entry = JSON.parse(line) as ChatHistoryEntry;
|
||||||
// Only conversational entries have cwd
|
// Only conversational entries have cwd
|
||||||
if ('cwd' in entry && entry.cwd) {
|
if ('cwd' in entry && entry.cwd) {
|
||||||
|
rl.close();
|
||||||
fileStream.destroy();
|
fileStream.destroy();
|
||||||
return entry.cwd;
|
return entry.cwd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Error extracting cwd from ${filePath}:`, error);
|
logger.error(`Error extracting cwd from ${filePath}:`, error);
|
||||||
|
} finally {
|
||||||
|
rl.close();
|
||||||
|
fileStream.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,15 @@ function createSessionLine(cwd: string): string {
|
||||||
describe('ProjectPathResolver', () => {
|
describe('ProjectPathResolver', () => {
|
||||||
const tempDirs: string[] = [];
|
const tempDirs: string[] = [];
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(async () => {
|
||||||
|
// Allow Windows file handles from readline/streams to be released
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
||||||
for (const tempDir of tempDirs) {
|
for (const tempDir of tempDirs) {
|
||||||
fs.rmSync(tempDir, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
|
try {
|
||||||
|
fs.rmSync(tempDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
|
||||||
|
} catch {
|
||||||
|
// Ignore cleanup failures to prevent cascading test errors on Windows
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tempDirs.length = 0;
|
tempDirs.length = 0;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue