ci: fix Nan test failure on Linux (#42863)
ci: Nan test failure on Linux
This commit is contained in:
parent
4e10eeb87e
commit
dab006b1cf
2 changed files with 11 additions and 2 deletions
|
@ -152,7 +152,7 @@ jobs:
|
||||||
unzip -:o dist.zip
|
unzip -:o dist.zip
|
||||||
- name: Setup Linux for Headless Testing
|
- name: Setup Linux for Headless Testing
|
||||||
run: sh -e /etc/init.d/xvfb start
|
run: sh -e /etc/init.d/xvfb start
|
||||||
- name: Run Node.js Tests
|
- name: Run Nan Tests
|
||||||
run: |
|
run: |
|
||||||
cd src
|
cd src
|
||||||
node electron/script/nan-spec-runner.js
|
node electron/script/nan-spec-runner.js
|
||||||
|
|
|
@ -17,6 +17,14 @@ const args = require('minimist')(process.argv.slice(2), {
|
||||||
string: ['only']
|
string: ['only']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getNodeGypVersion = () => {
|
||||||
|
const nanPackageJSONPath = path.join(NAN_DIR, 'package.json');
|
||||||
|
const nanPackageJSON = JSON.parse(fs.readFileSync(nanPackageJSONPath, 'utf8'));
|
||||||
|
const { devDependencies } = nanPackageJSON;
|
||||||
|
const nodeGypVersion = devDependencies['node-gyp'];
|
||||||
|
return nodeGypVersion || 'latest';
|
||||||
|
};
|
||||||
|
|
||||||
async function main () {
|
async function main () {
|
||||||
const outDir = utils.getOutDir({ shouldLog: true });
|
const outDir = utils.getOutDir({ shouldLog: true });
|
||||||
const nodeDir = path.resolve(BASE, 'out', outDir, 'gen', 'node_headers');
|
const nodeDir = path.resolve(BASE, 'out', outDir, 'gen', 'node_headers');
|
||||||
|
@ -90,7 +98,8 @@ async function main () {
|
||||||
env.LDFLAGS = ldflags;
|
env.LDFLAGS = ldflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { status: buildStatus, signal } = cp.spawnSync(NPX_CMD, ['node-gyp', 'rebuild', '--verbose', '--directory', 'test', '-j', 'max'], {
|
const nodeGypVersion = getNodeGypVersion();
|
||||||
|
const { status: buildStatus, signal } = cp.spawnSync(NPX_CMD, [`node-gyp@${nodeGypVersion}`, 'rebuild', '--verbose', '--directory', 'test', '-j', 'max'], {
|
||||||
env,
|
env,
|
||||||
cwd: NAN_DIR,
|
cwd: NAN_DIR,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
|
Loading…
Reference in a new issue