@@ -4,10 +4,10 @@ import commandLineArgs from "command-line-args";
4
4
import commandLineUsage from "command-line-usage" ;
5
5
import { spawnSync } from "child_process" ;
6
6
import { fileURLToPath } from "url" ;
7
- import { styleText } from ' node:util' ;
7
+ import { styleText } from " node:util" ;
8
8
import * as path from "path" ;
9
9
import * as fs from "fs" ;
10
- import * as os from 'os' ;
10
+ import * as os from "os" ;
11
11
import core from "@actions/core"
12
12
13
13
const optionDefinitions = [
@@ -77,7 +77,7 @@ const GITHUB_ACTIONS_OUTPUT = "GITHUB_ACTIONS_OUTPUT" in process.env;
77
77
function log ( ...args ) {
78
78
const text = args . join ( " " )
79
79
if ( GITHUB_ACTIONS_OUTPUT )
80
- core . notice ( styleText ( "yellow" , text ) )
80
+ core . info ( styleText ( "yellow" , text ) )
81
81
else
82
82
console . log ( styleText ( "yellow" , text ) )
83
83
}
@@ -106,9 +106,9 @@ function sh(binary, args) {
106
106
const cmd = `${ binary } ${ args . join ( " " ) } ` ;
107
107
if ( GITHUB_ACTIONS_OUTPUT ) {
108
108
core . startGroup ( binary ) ;
109
- core . notice ( cmd ) ;
109
+ core . notice ( styleText ( "blue" , cmd ) ) ;
110
110
} else {
111
- console . log ( styleText ( "cyan " , cmd ) ) ;
111
+ console . log ( styleText ( "blue " , cmd ) ) ;
112
112
}
113
113
try {
114
114
const result = spawnSync ( binary , args , SPAWN_OPTIONS ) ;
@@ -131,9 +131,29 @@ async function runTests() {
131
131
} ) ;
132
132
}
133
133
134
+ function jsvuOSName ( ) {
135
+ const osName = ( ) => {
136
+ switch ( os . platform ( ) ) {
137
+ case "win32" : return "win" ;
138
+ case "darwin" : return "mac" ;
139
+ case "linux" : return "linux" ;
140
+ default : throw new Error ( "Unsupported OS" ) ;
141
+ }
142
+ } ;
143
+ const osArch = ( ) => {
144
+ switch ( os . arch ( ) ) {
145
+ case "x64" : return "64" ;
146
+ case "ia32" : return "32" ;
147
+ case "arm64" : return "64arm" ;
148
+ default : throw new Error ( "Unsupported architecture" ) ;
149
+ }
150
+ } ;
151
+ return `${ osName ( ) } ${ osArch ( ) } `
152
+ }
153
+
134
154
function testSetup ( ) {
135
155
const jsvuOS = "mac64arm" ;
136
- sh ( "jsvu" , [ `--engines=${ SHELL_NAME } ` , `--os=${ jsvuOS } ` ] ) ;
156
+ sh ( "jsvu" , [ `--engines=${ SHELL_NAME } ` , `--os=${ jsvuOSName ( ) } ` ] ) ;
137
157
const shellBinary = path . join ( os . homedir ( ) , ".jsvu/bin" , SHELL_NAME ) ;
138
158
if ( ! fs . existsSync ( shellBinary ) )
139
159
throw new Error ( `Could not find shell binary: ${ shellBinary } ` ) ;
0 commit comments