diff --git a/packages/tool-cache/__tests__/data/archive-content/file-with-ç-character.txt b/packages/tool-cache/__tests__/data/archive-content/file-with-ç-character.txt new file mode 100644 index 00000000..5803ea15 --- /dev/null +++ b/packages/tool-cache/__tests__/data/archive-content/file-with-ç-character.txt @@ -0,0 +1 @@ +file-with-ç-character.txt \ No newline at end of file diff --git a/packages/tool-cache/__tests__/data/archive-content/file.txt b/packages/tool-cache/__tests__/data/archive-content/file.txt new file mode 100644 index 00000000..f2da98ad --- /dev/null +++ b/packages/tool-cache/__tests__/data/archive-content/file.txt @@ -0,0 +1 @@ +file.txt contents \ No newline at end of file diff --git a/packages/tool-cache/__tests__/data/archive-content/folder/nested-file.txt b/packages/tool-cache/__tests__/data/archive-content/folder/nested-file.txt new file mode 100644 index 00000000..37922426 --- /dev/null +++ b/packages/tool-cache/__tests__/data/archive-content/folder/nested-file.txt @@ -0,0 +1 @@ +folder/nested-file.txt contents \ No newline at end of file diff --git a/packages/tool-cache/__tests__/data/archive-content/test.xar b/packages/tool-cache/__tests__/data/archive-content/test.xar new file mode 100644 index 00000000..5175658d Binary files /dev/null and b/packages/tool-cache/__tests__/data/archive-content/test.xar differ diff --git a/packages/tool-cache/__tests__/data/test.xar b/packages/tool-cache/__tests__/data/test.xar deleted file mode 100644 index a2470147..00000000 Binary files a/packages/tool-cache/__tests__/data/test.xar and /dev/null differ diff --git a/packages/tool-cache/__tests__/tool-cache.test.ts b/packages/tool-cache/__tests__/tool-cache.test.ts index 4f3ef411..322e8007 100644 --- a/packages/tool-cache/__tests__/tool-cache.test.ts +++ b/packages/tool-cache/__tests__/tool-cache.test.ts @@ -350,15 +350,18 @@ describe('@actions/tool-cache', function() { } else if (IS_MAC) { it('extract .xar', async () => { const tempDir = path.join(tempPath, 'test-install.xar') - + const sourcePath = path.join(__dirname, 'data', 'archive-content') + const targetPath = path.join(tempDir, 'test.xar') await io.mkdirP(tempDir) - // copy the .xar file to the test dir - const _xarFile: string = path.join(tempDir, 'test.xar') - await io.cp(path.join(__dirname, 'data', 'test.xar'), _xarFile) + // Create test archive + const xarPath = await io.which('xar', true) + await exec.exec(`${xarPath}`, ['-cf', targetPath, '.'], { + cwd: sourcePath + }) // extract/cache - const extPath: string = await tc.extractXar(_xarFile, undefined, '-x') + const extPath: string = await tc.extractXar(targetPath, undefined, '-x') await tc.cacheDir(extPath, 'my-xar-contents', '1.1.0') const toolPath: string = tc.find('my-xar-contents', '1.1.0')