File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * 判断某个 QA 分支是否只应在 Linux 上执行。
3+ *
4+ * `fnos` 这类依赖 Bash / Linux 文件系统语义的测试在非 Linux 平台上
5+ * 没有稳定意义,因此这里统一提供平台判定 helper,避免在多个 QA 入口里散落条件。
6+ *
7+ * @param {string } [platform=process.platform] Node 运行时平台标识。
8+ * @returns {boolean } 仅当平台为 `linux` 时返回 `true`。
9+ */
10+ export function shouldRunLinuxOnlyQa ( platform = process . platform ) {
11+ return platform === 'linux'
12+ }
Original file line number Diff line number Diff line change 1+ import test from 'node:test'
2+ import assert from 'node:assert/strict'
3+
4+ import { shouldRunLinuxOnlyQa } from './qa-platform.mjs'
5+
6+ test ( 'shouldRunLinuxOnlyQa returns true on linux' , ( ) => {
7+ assert . equal ( shouldRunLinuxOnlyQa ( 'linux' ) , true )
8+ } )
9+
10+ test ( 'shouldRunLinuxOnlyQa returns false on non-linux platforms' , ( ) => {
11+ assert . equal ( shouldRunLinuxOnlyQa ( 'win32' ) , false )
12+ assert . equal ( shouldRunLinuxOnlyQa ( 'darwin' ) , false )
13+ } )
Original file line number Diff line number Diff line change 22
33import { spawnSync } from 'node:child_process'
44import { buildPnpmCommand } from './pnpm-command.mjs'
5+ import { shouldRunLinuxOnlyQa } from './qa-platform.mjs'
56
67// Turbo 版 QA 编排器。
78// 这个入口把 workspace QA 拆成可缓存、可并行的任务链,优先服务速度和 affected 场景;
@@ -332,6 +333,13 @@ function runRootPwshQa(modeValue, sinceRef) {
332333}
333334
334335function runRootFnosQa ( modeValue , sinceRef ) {
336+ if ( ! shouldRunLinuxOnlyQa ( ) ) {
337+ console . log (
338+ `[turbo:qa] skip root qa:fnos (linux only, current platform: ${ process . platform } )` ,
339+ )
340+ return
341+ }
342+
335343 if ( modeValue === 'all' ) {
336344 console . log ( '[turbo:qa] run root qa:fnos (all)' )
337345 const pnpmCommand = buildPnpmCommand ( [ 'run' , 'qa:fnos' ] )
@@ -352,6 +360,13 @@ function runRootFnosQa(modeValue, sinceRef) {
352360}
353361
354362function runRootSystemdServiceManagerQa ( modeValue , sinceRef ) {
363+ if ( ! shouldRunLinuxOnlyQa ( ) ) {
364+ console . log (
365+ `[turbo:qa] skip root qa:systemd-service-manager (linux only, current platform: ${ process . platform } )` ,
366+ )
367+ return
368+ }
369+
355370 const pathspecs = [ 'scripts/bash/systemd-service-manager' , 'package.json' ]
356371
357372 if ( modeValue === 'all' ) {
Original file line number Diff line number Diff line change 33import { spawnSync } from 'node:child_process'
44import { existsSync } from 'node:fs'
55import { buildPnpmCommand } from './pnpm-command.mjs'
6+ import { shouldRunLinuxOnlyQa } from './qa-platform.mjs'
67
78// 传统版 QA 编排器。
89// 这个入口复用各 workspace 包自身定义的 `qa` 脚本,不依赖 Turbo 任务图;
@@ -378,6 +379,13 @@ function runRootPwshQa(modeValue, sinceRef) {
378379}
379380
380381function runRootFnosQa ( modeValue , sinceRef ) {
382+ if ( ! shouldRunLinuxOnlyQa ( ) ) {
383+ console . log (
384+ `[qa] skip root qa:fnos (linux only, current platform: ${ process . platform } )` ,
385+ )
386+ return
387+ }
388+
381389 const fnosPathspecs = [ 'linux/fnos' , 'package.json' ]
382390
383391 if ( modeValue === 'all' ) {
@@ -396,6 +404,13 @@ function runRootFnosQa(modeValue, sinceRef) {
396404}
397405
398406function runRootSystemdServiceManagerQa ( modeValue , sinceRef ) {
407+ if ( ! shouldRunLinuxOnlyQa ( ) ) {
408+ console . log (
409+ `[qa] skip root qa:systemd-service-manager (linux only, current platform: ${ process . platform } )` ,
410+ )
411+ return
412+ }
413+
399414 const pathspecs = [ 'scripts/bash/systemd-service-manager' , 'package.json' ]
400415
401416 if ( modeValue === 'all' ) {
You can’t perform that action at this time.
0 commit comments