@@ -7,6 +7,7 @@ const cp = require('child_process')
77const core = require ( '@actions/core' )
88const exec = require ( '@actions/exec' )
99const tc = require ( '@actions/tool-cache' )
10+ const common = require ( './common' )
1011const rubyInstallerVersions = require ( './windows-versions' ) . versions
1112
1213// Extract to SSD, see https://github.com/ruby/setup-ruby/pull/14
@@ -35,15 +36,19 @@ export function getAvailableVersions(platform, engine) {
3536export async function install ( platform , ruby ) {
3637 const version = ruby . split ( '-' , 2 ) [ 1 ]
3738 const url = rubyInstallerVersions [ version ]
38- console . log ( url )
3939
4040 if ( ! url . endsWith ( '.7z' ) ) {
41- throw new Error ( ' URL should end in .7z' )
41+ throw new Error ( ` URL should end in .7z: ${ url } ` )
4242 }
4343 const base = url . slice ( url . lastIndexOf ( '/' ) + 1 , url . length - '.7z' . length )
4444
45- const downloadPath = await tc . downloadTool ( url )
46- await exec . exec ( '7z' , [ 'x' , downloadPath , `-xr!${ base } \\share\\doc` , `-o${ drive } :\\` ] , { silent : true } )
45+ const downloadPath = await common . measure ( 'Downloading Ruby' , async ( ) => {
46+ console . log ( url )
47+ return await tc . downloadTool ( url )
48+ } )
49+
50+ await common . measure ( 'Extracting Ruby' , async ( ) =>
51+ exec . exec ( '7z' , [ 'x' , downloadPath , `-xr!${ base } \\share\\doc` , `-o${ drive } :\\` ] , { silent : true } ) )
4752 const rubyPrefix = `${ drive } :\\${ base } `
4853
4954 let toolchainPaths = ( version === 'mswin' ) ?
@@ -62,15 +67,17 @@ async function symLinkToEmbeddedMSYS2() {
6267 }
6368 const latestVersion = toolCacheVersions . slice ( - 1 ) [ 0 ]
6469 const hostedRuby = tc . find ( 'Ruby' , latestVersion )
65- await exec . exec ( `cmd /c mklink /D ${ msys2 } ${ hostedRuby } \\msys64` )
70+ await common . measure ( 'Linking MSYS2' , async ( ) =>
71+ exec . exec ( `cmd /c mklink /D ${ msys2 } ${ hostedRuby } \\msys64` ) )
6672}
6773
6874async function setupMingw ( version ) {
6975 core . exportVariable ( 'MAKE' , 'make.exe' )
7076
7177 if ( version . startsWith ( '2.2' ) || version . startsWith ( '2.3' ) ) {
7278 core . exportVariable ( 'SSL_CERT_FILE' , certFile )
73- await installMSYS ( version )
79+ await common . measure ( 'Installing MSYS1' , async ( ) =>
80+ installMSYS ( version ) )
7481
7582 return msysPathEntries
7683 } else {
@@ -117,7 +124,10 @@ async function setupMSWin() {
117124 await symLinkToEmbeddedMSYS2 ( )
118125 }
119126
120- return [ ...addVCVARSEnv ( ) , ...msys2PathEntries ]
127+ const VCPathEntries = await common . measure ( 'Setting up MSVC environment' , async ( ) =>
128+ addVCVARSEnv ( ) )
129+
130+ return [ ...VCPathEntries , ...msys2PathEntries ]
121131}
122132
123133/* Sets MSVC environment for use in Actions
0 commit comments