diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index a103e71a..4d05ed64 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -30,6 +30,29 @@ jobs: - name: Format run: npm run format-check + macOS: + name: Run macOS + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Set Node.js 10.x + uses: actions/setup-node@master + with: + version: 10.x + + - name: npm install + run: npm install + + - name: Bootstrap + run: npm run bootstrap + + - name: Compile + run: npm run build + + - name: npm test + run: npm test Windows: name: Run Windows runs-on: windows-latest diff --git a/packages/tool-cache/__tests__/externals/zip-darwin b/packages/tool-cache/__tests__/externals/zip-darwin new file mode 100755 index 00000000..60424b08 Binary files /dev/null and b/packages/tool-cache/__tests__/externals/zip-darwin differ diff --git a/packages/tool-cache/__tests__/tool-cache.test.ts b/packages/tool-cache/__tests__/tool-cache.test.ts index c1fb9e8f..59315e5c 100644 --- a/packages/tool-cache/__tests__/tool-cache.test.ts +++ b/packages/tool-cache/__tests__/tool-cache.test.ts @@ -231,7 +231,9 @@ describe('@actions/tool-cache', function() { ] await exec.exec(`"${powershellPath}"`, args) } else { - const zipPath: string = path.join(__dirname, 'externals', 'zip') + const zipBin: string = + process.platform === 'darwin' ? 'zip-darwin' : 'zip' + const zipPath: string = path.join(__dirname, 'externals', zipBin) await exec.exec(`"${zipPath}`, [zipFile, '-r', '.'], {cwd: stagingDir}) } @@ -282,7 +284,9 @@ describe('@actions/tool-cache', function() { ] await exec.exec(`"${powershellPath}"`, args) } else { - const zipPath = path.join(__dirname, 'externals', 'zip') + const zipBin: string = + process.platform === 'darwin' ? 'zip-darwin' : 'zip' + const zipPath = path.join(__dirname, 'externals', zipBin) await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir}) } diff --git a/packages/tool-cache/scripts/externals/unzip-darwin b/packages/tool-cache/scripts/externals/unzip-darwin new file mode 100755 index 00000000..4ef15045 Binary files /dev/null and b/packages/tool-cache/scripts/externals/unzip-darwin differ diff --git a/packages/tool-cache/src/tool-cache.ts b/packages/tool-cache/src/tool-cache.ts index a25cdcee..c4c71f1c 100644 --- a/packages/tool-cache/src/tool-cache.ts +++ b/packages/tool-cache/src/tool-cache.ts @@ -218,7 +218,11 @@ export async function extractZip(file: string, dest?: string): Promise { if (IS_WINDOWS) { await extractZipWin(file, dest) } else { - await extractZipNix(file, dest) + if (process.platform === 'darwin') { + await extractZipDarwin(file, dest) + } else { + await extractZipNix(file, dest) + } } return dest @@ -250,6 +254,17 @@ async function extractZipNix(file: string, dest: string): Promise { await exec(`"${unzipPath}"`, [file], {cwd: dest}) } +async function extractZipDarwin(file: string, dest: string): Promise { + const unzipPath = path.join( + __dirname, + '..', + 'scripts', + 'externals', + 'unzip-darwin' + ) + await exec(`"${unzipPath}"`, [file], {cwd: dest}) +} + /** * Caches a directory and installs it into the tool cacheDir *