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:
|
||||
validate:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
|
@ -36,8 +32,31 @@ jobs:
|
|||
- name: Lint
|
||||
run: pnpm lint
|
||||
|
||||
- name: Test
|
||||
run: pnpm test
|
||||
|
||||
- name: 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
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CSC_LINK: ${{ secrets.MAC_CERTS }}
|
||||
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
|
||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
run: pnpm dist:mac
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-macos
|
||||
path: release/**
|
||||
if-no-files-found: error
|
||||
run: pnpm dist:mac --publish always
|
||||
|
||||
package-win:
|
||||
runs-on: windows-latest
|
||||
|
|
@ -68,11 +62,6 @@ jobs:
|
|||
run: pnpm build
|
||||
|
||||
- name: Package Windows
|
||||
run: pnpm dist:win
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-windows
|
||||
path: release/**
|
||||
if-no-files-found: error
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: pnpm dist:win --publish always
|
||||
|
|
|
|||
|
|
@ -32,12 +32,16 @@ export async function extractCwd(filePath: string): Promise<string | null> {
|
|||
const entry = JSON.parse(line) as ChatHistoryEntry;
|
||||
// Only conversational entries have cwd
|
||||
if ('cwd' in entry && entry.cwd) {
|
||||
rl.close();
|
||||
fileStream.destroy();
|
||||
return entry.cwd;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error(`Error extracting cwd from ${filePath}:`, error);
|
||||
} finally {
|
||||
rl.close();
|
||||
fileStream.destroy();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,15 @@ function createSessionLine(cwd: string): string {
|
|||
describe('ProjectPathResolver', () => {
|
||||
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) {
|
||||
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;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue