generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Match process.arch on artifact names
- Loading branch information
1 parent
4263ab3
commit 493d4c8
Showing
6 changed files
with
103 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {getFilenameMatcher} from './stylua' | ||
|
||
const ARTIFACT_NAMES = [ | ||
'stylua-linux-aarch64.zip', | ||
'stylua-linux-x86_64.zip', | ||
'stylua-linux.zip', | ||
'stylua-macos-aarch64.zip', | ||
'stylua-macos-x86_64.zip', | ||
'stylua-macos.zip', | ||
'stylua-win64.zip', | ||
'stylua-windows-x86_64.zip' | ||
] | ||
|
||
const selectArtifact = ( | ||
platform: NodeJS.Platform, | ||
arch: string | ||
): string | undefined => { | ||
const matcher = getFilenameMatcher(platform, arch) | ||
return ARTIFACT_NAMES.find(name => matcher(name)) | ||
} | ||
|
||
test('matches windows x64 platform', () => { | ||
expect(selectArtifact('win32', 'x64')).toBe('stylua-windows-x86_64.zip') | ||
}) | ||
|
||
test('matches macos x64 platform', () => { | ||
expect(selectArtifact('darwin', 'x64')).toBe('stylua-macos-x86_64.zip') | ||
}) | ||
|
||
test('matches macos aarch64 platform', () => { | ||
expect(selectArtifact('darwin', 'arm64')).toBe('stylua-macos-aarch64.zip') | ||
}) | ||
|
||
test('matches linux x64 platform', () => { | ||
expect(selectArtifact('linux', 'x64')).toBe('stylua-linux-x86_64.zip') | ||
}) | ||
|
||
test('matches linux aarch64 platform', () => { | ||
expect(selectArtifact('linux', 'arm64')).toBe('stylua-linux-aarch64.zip') | ||
}) |
This file contains 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