ci: fix Linux runner test failures (shallow clone, git identity, node-pty prebuild)
- checkout with fetch-depth: 0: the git log paging test needs the full repository history (default shallow clone yields one commit) - configure a global git identity on the runner: src/git.ts deliberately never sets one and revert/cherry-pick rely on ambient config - tests/unit.spec.ts: node-pty@1.1.0 ships a prebuilt spawn-helper only for darwin/win32; on linux node-gyp compiles it into build/Release. Align the assertion with ensureSpawnHelper's candidate list instead of hardcoding the prebuilds/ path (the Linux test run was red for this reason)
This commit is contained in:
@@ -11,6 +11,9 @@ jobs:
|
|||||||
timeout-minutes: 20
|
timeout-minutes: 20
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# Tests run git log against this repository and need the full history.
|
||||||
|
fetch-depth: 0
|
||||||
- uses: pnpm/action-setup@v4
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 11
|
version: 11
|
||||||
@@ -18,6 +21,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
# The plugin's git revert/cherry-pick spawn git without setting an
|
||||||
|
# identity (deliberate, see tests/smoke.spec.ts) and rely on ambient
|
||||||
|
# config; the runner has none by default.
|
||||||
|
- name: Configure git identity for tests
|
||||||
|
run: |
|
||||||
|
git config --global user.name "dsh-better-sidebar-ci"
|
||||||
|
git config --global user.email "ci@dsh.invalid"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
- name: Typecheck
|
- name: Typecheck
|
||||||
|
|||||||
+11
-5
@@ -865,15 +865,21 @@ describe('pty helpers', () => {
|
|||||||
if (process.platform === 'win32') return
|
if (process.platform === 'win32') return
|
||||||
ensureSpawnHelper()
|
ensureSpawnHelper()
|
||||||
ensureSpawnHelper()
|
ensureSpawnHelper()
|
||||||
const { existsSync } = require('node:fs') as typeof import('node:fs')
|
const { existsSync, statSync } = require('node:fs') as typeof import('node:fs')
|
||||||
const { dirname, join } = require('node:path') as typeof import('node:path')
|
const { dirname, join } = require('node:path') as typeof import('node:path')
|
||||||
const { createRequire } = require('node:module') as typeof import('node:module')
|
const { createRequire } = require('node:module') as typeof import('node:module')
|
||||||
const entry = createRequire(import.meta.url).resolve('node-pty')
|
const entry = createRequire(import.meta.url).resolve('node-pty')
|
||||||
const root = dirname(dirname(entry))
|
const root = dirname(dirname(entry))
|
||||||
const helper = join(root, 'prebuilds', `${process.platform}-${process.arch}`, 'spawn-helper')
|
// node-pty ships a prebuilt spawn-helper for darwin/win32; on other
|
||||||
expect(existsSync(helper)).toBe(true)
|
// platforms (linux) node-gyp compiles it into build/Release. Mirror
|
||||||
const { statSync } = require('node:fs') as typeof import('node:fs')
|
// ensureSpawnHelper's candidate list: either location is acceptable.
|
||||||
expect((statSync(helper).mode & 0o111) !== 0).toBe(true)
|
const candidates = [
|
||||||
|
join(root, 'prebuilds', `${process.platform}-${process.arch}`, 'spawn-helper'),
|
||||||
|
join(root, 'build', 'Release', 'spawn-helper'),
|
||||||
|
]
|
||||||
|
const helper = candidates.find(existsSync)
|
||||||
|
expect(helper).toBeTruthy()
|
||||||
|
expect((statSync(helper!).mode & 0o111) !== 0).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user