-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix extractTar on Windows #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8424027
fix extractTar on Windows
ericsciple 6c95eda
.
ericsciple e372509
.
ericsciple 0071524
.
ericsciple 443db38
.
ericsciple 4b8b9fd
.
ericsciple 46de6c6
Revert "."
ericsciple 9eee88d
.
ericsciple 6af6cc0
Revert "Revert ".""
ericsciple 67b788f
Update packages/tool-cache/src/tool-cache.ts
ericsciple 45be6ad
.
ericsciple File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
.
- Loading branch information
commit 6c95edaae7cc0f636aaf580f795b7f8eeb21d71c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -268,96 +268,88 @@ describe('@actions/tool-cache', function() { | |
| await io.rmRF(tempDir) | ||
| } | ||
| }) | ||
| } else { | ||
| it('extract .tar.gz', async () => { | ||
| const tempDir = path.join(tempPath, 'test-install-tar.gz') | ||
| } | ||
|
|
||
| await io.mkdirP(tempDir) | ||
| it('extract .tar.gz', async () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no changes here, just eliminated the |
||
| const tempDir = path.join(tempPath, 'test-install-tar.gz') | ||
|
|
||
| // copy the .tar.gz file to the test dir | ||
| const _tgzFile: string = path.join(tempDir, 'test.tar.gz') | ||
| await io.cp(path.join(__dirname, 'data', 'test.tar.gz'), _tgzFile) | ||
| await io.mkdirP(tempDir) | ||
|
|
||
| // extract/cache | ||
| const extPath: string = await tc.extractTar(_tgzFile) | ||
| await tc.cacheDir(extPath, 'my-tgz-contents', '1.1.0') | ||
| const toolPath: string = tc.find('my-tgz-contents', '1.1.0') | ||
| // copy the .tar.gz file to the test dir | ||
| const _tgzFile: string = path.join(tempDir, 'test.tar.gz') | ||
| await io.cp(path.join(__dirname, 'data', 'test.tar.gz'), _tgzFile) | ||
|
|
||
| expect(fs.existsSync(toolPath)).toBeTruthy() | ||
| expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'file.txt'))).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'file-with-ç-character.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'folder', 'nested-file.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.readFileSync( | ||
| path.join(toolPath, 'folder', 'nested-file.txt'), | ||
| 'utf8' | ||
| ) | ||
| ).toBe('folder/nested-file.txt contents') | ||
| }) | ||
| // extract/cache | ||
| const extPath: string = await tc.extractTar(_tgzFile) | ||
| await tc.cacheDir(extPath, 'my-tgz-contents', '1.1.0') | ||
| const toolPath: string = tc.find('my-tgz-contents', '1.1.0') | ||
|
|
||
| it('extract .tar.gz to a directory that does not exist', async () => { | ||
| const tempDir = path.join(tempPath, 'test-install-tar.gz') | ||
| const destDir = path.join(tempDir, 'not-exist') | ||
| expect(fs.existsSync(toolPath)).toBeTruthy() | ||
| expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'file.txt'))).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'file-with-ç-character.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'folder', 'nested-file.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.readFileSync(path.join(toolPath, 'folder', 'nested-file.txt'), 'utf8') | ||
| ).toBe('folder/nested-file.txt contents') | ||
| }) | ||
|
|
||
| await io.mkdirP(tempDir) | ||
| it('extract .tar.gz to a directory that does not exist', async () => { | ||
| const tempDir = path.join(tempPath, 'test-install-tar.gz') | ||
| const destDir = path.join(tempDir, 'not-exist') | ||
|
|
||
| // copy the .tar.gz file to the test dir | ||
| const _tgzFile: string = path.join(tempDir, 'test.tar.gz') | ||
| await io.cp(path.join(__dirname, 'data', 'test.tar.gz'), _tgzFile) | ||
| await io.mkdirP(tempDir) | ||
|
|
||
| // extract/cache | ||
| const extPath: string = await tc.extractTar(_tgzFile, destDir) | ||
| await tc.cacheDir(extPath, 'my-tgz-contents', '1.1.0') | ||
| const toolPath: string = tc.find('my-tgz-contents', '1.1.0') | ||
| // copy the .tar.gz file to the test dir | ||
| const _tgzFile: string = path.join(tempDir, 'test.tar.gz') | ||
| await io.cp(path.join(__dirname, 'data', 'test.tar.gz'), _tgzFile) | ||
|
|
||
| expect(extPath).toContain('not-exist') | ||
| expect(fs.existsSync(toolPath)).toBeTruthy() | ||
| expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'file.txt'))).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'file-with-ç-character.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'folder', 'nested-file.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.readFileSync( | ||
| path.join(toolPath, 'folder', 'nested-file.txt'), | ||
| 'utf8' | ||
| ) | ||
| ).toBe('folder/nested-file.txt contents') | ||
| }) | ||
| // extract/cache | ||
| const extPath: string = await tc.extractTar(_tgzFile, destDir) | ||
| await tc.cacheDir(extPath, 'my-tgz-contents', '1.1.0') | ||
| const toolPath: string = tc.find('my-tgz-contents', '1.1.0') | ||
|
|
||
| it('extract .tar.xz', async () => { | ||
| const tempDir = path.join(tempPath, 'test-install-tar.xz') | ||
| expect(extPath).toContain('not-exist') | ||
| expect(fs.existsSync(toolPath)).toBeTruthy() | ||
| expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'file.txt'))).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'file-with-ç-character.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'folder', 'nested-file.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.readFileSync(path.join(toolPath, 'folder', 'nested-file.txt'), 'utf8') | ||
| ).toBe('folder/nested-file.txt contents') | ||
| }) | ||
|
|
||
| await io.mkdirP(tempDir) | ||
| it('extract .tar.xz', async () => { | ||
| const tempDir = path.join(tempPath, 'test-install-tar.xz') | ||
|
|
||
| // copy the .tar.gz file to the test dir | ||
| const _txzFile: string = path.join(tempDir, 'test.tar.xz') | ||
| await io.cp(path.join(__dirname, 'data', 'test.tar.xz'), _txzFile) | ||
| await io.mkdirP(tempDir) | ||
|
|
||
| // extract/cache | ||
| const extPath: string = await tc.extractTar(_txzFile, undefined, 'x') | ||
| await tc.cacheDir(extPath, 'my-txz-contents', '1.1.0') | ||
| const toolPath: string = tc.find('my-txz-contents', '1.1.0') | ||
| // copy the .tar.gz file to the test dir | ||
| const _txzFile: string = path.join(tempDir, 'test.tar.xz') | ||
| await io.cp(path.join(__dirname, 'data', 'test.tar.xz'), _txzFile) | ||
|
|
||
| expect(fs.existsSync(toolPath)).toBeTruthy() | ||
| expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'bar.txt'))).toBeTruthy() | ||
| expect( | ||
| fs.existsSync(path.join(toolPath, 'foo', 'hello.txt')) | ||
| ).toBeTruthy() | ||
| expect( | ||
| fs.readFileSync(path.join(toolPath, 'foo', 'hello.txt'), 'utf8') | ||
| ).toBe('foo/hello: world') | ||
| }) | ||
| } | ||
| // extract/cache | ||
| const extPath: string = await tc.extractTar(_txzFile, undefined, 'x') | ||
| await tc.cacheDir(extPath, 'my-txz-contents', '1.1.0') | ||
| const toolPath: string = tc.find('my-txz-contents', '1.1.0') | ||
|
|
||
| expect(fs.existsSync(toolPath)).toBeTruthy() | ||
| expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'bar.txt'))).toBeTruthy() | ||
| expect(fs.existsSync(path.join(toolPath, 'foo', 'hello.txt'))).toBeTruthy() | ||
| expect( | ||
| fs.readFileSync(path.join(toolPath, 'foo', 'hello.txt'), 'utf8') | ||
| ).toBe('foo/hello: world') | ||
| }) | ||
|
|
||
| it('installs a zip and finds it', async () => { | ||
| const tempDir = path.join(__dirname, 'test-install-zip') | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had to recreate test.tar.gz with the option
--format paxotherwise bsdtar doesnt preserve UTF file names correctlyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i added a README.txt to the archive for future reference