From fbe206ff736a659c58763918c1226c7ae80ffe06 Mon Sep 17 00:00:00 2001 From: msojocs Date: Sat, 6 Jul 2024 15:26:14 +0800 Subject: [PATCH] feat: ci for module --- .github/workflows/release.yml | 4 ++-- .mocharc.js | 4 ++-- docker/entrypoint | 4 +++- test/runner/module-windows.ts | 9 ++++++++- test/spec/wcc/module/module.spec.ts | 6 ++++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c85631e..4047926 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: push: tags: - v* - branches: [ master, dev, ci] + branches: [ master, dev, ci, module] pull_request: branches: [ master ] # # Allows you to run this workflow manually from the Actions tab @@ -66,7 +66,7 @@ jobs: echo "------------------------" ls -l build mkdir -p tmp/build - mv build/{wcc,wcsc} tmp/build + mv build/{wcc,wcsc,wcc_module.node} tmp/build cd tmp/build ls -l diff --git a/.mocharc.js b/.mocharc.js index 027aacc..766fabc 100644 --- a/.mocharc.js +++ b/.mocharc.js @@ -4,7 +4,7 @@ module.exports = { 'ts-node/register' ], recursive: true, - // spec: "./test/spec/**/*.spec.ts", - spec: "test/spec/wcc/module/module.spec.ts", + spec: "./test/spec/**/*.spec.ts", + // spec: "test/spec/wcc/module/module.spec.ts", timeout: 20000, } \ No newline at end of file diff --git a/docker/entrypoint b/docker/entrypoint index 10bbbc4..cf1f4d3 100755 --- a/docker/entrypoint +++ b/docker/entrypoint @@ -9,5 +9,7 @@ cd build cmake .. cmake --build . --config Release --target wcc cmake --build . --config Release --target wcsc +cmake --build . --config Release --target wcc_module readelf -s ./wcc | grep -oP "GLIBC.*" | sort | uniq -readelf -s ./wcsc | grep -oP "GLIBC.*" | sort | uniq \ No newline at end of file +readelf -s ./wcsc | grep -oP "GLIBC.*" | sort | uniq +readelf -s ./wcc_module.node | grep -oP "GLIBC.*" | sort | uniq \ No newline at end of file diff --git a/test/runner/module-windows.ts b/test/runner/module-windows.ts index 75985d4..fc76465 100644 --- a/test/runner/module-windows.ts +++ b/test/runner/module-windows.ts @@ -2,6 +2,7 @@ import * as fs from 'fs' import { request } from "http"; import { CompilerOptions } from './types'; import path from 'path' +import { execFileSync } from 'child_process'; // 预先启动wine focker环境,再使用HTTP协议,最后销毁容器 const HTTP = { @@ -68,5 +69,11 @@ const wccNative = async (optionsPath: string) => { export default { wcsc: wcscNative, - wcc: wccNative + wcc: wccNative, + start: () => { + execFileSync(path.resolve(__dirname, './nwjs/wine-prepare.sh'), { stdio: 'inherit' }) + }, + close: () => { + request('http://localhost:8083/close').end() + } } \ No newline at end of file diff --git a/test/spec/wcc/module/module.spec.ts b/test/spec/wcc/module/module.spec.ts index cbc8dac..986fa61 100644 --- a/test/spec/wcc/module/module.spec.ts +++ b/test/spec/wcc/module/module.spec.ts @@ -5,11 +5,13 @@ import path from 'path'; import linux from '../../../runner/module-linux' import windows from '../../../runner/module-windows' import * as fs from 'fs' -import { execFileSync } from 'child_process'; describe("wcc - module", function () { this.beforeAll(() => { - // execFileSync(path.resolve(__dirname, '../../../runner/nwjs/wine-prepare.sh'), { stdio: 'inherit' }) + windows.start() + }) + this.afterAll(() => { + windows.close() }) describe("llw: linux output should deep equal with wine", function () { // afterEach(function(){