forked from peaceiris/actions-hugo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(peaceirisGH-608) Fix package url for v0.102.0 & v0.103.0
Prior to this change, the URL building for versions of hugo was deterministic as the URLs for the packages were set to a project-specific standard. That URL creation began to fail for macOS in [0.102.0] and for Windows in [0.103.0]. It does not fail for Linux because the hugo releases for Linux continue to include the old package naming as an alias. This change: - Updates the `get-os` function to take the hugo version as additional input, altering the return value based on the version. - Updates the `get-arch` function to take the operating system name and hugo version as additional input, altering the return value based on both. Including the OS name is required for handling macOS. - Fixes peaceiris#608 - Fixes peaceiris#605 [0.102.0]: https://github.com/gohugoio/hugo/releases/tag/v0.102.0 [0.103.0]: https://github.com/gohugoio/hugo/releases/tag/v0.103.0
- Loading branch information
1 parent
a2eba60
commit e70fd02
Showing
5 changed files
with
101 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,63 @@ | ||
import getArch from '../src/get-arch'; | ||
|
||
describe('getArch', () => { | ||
test('processor architecture', () => { | ||
expect(getArch('x64')).toBe('64bit'); | ||
expect(getArch('arm')).toBe('ARM'); | ||
expect(getArch('arm64')).toBe('ARM64'); | ||
test('processor architecture < 0.102.0', () => { | ||
expect(getArch('x64', 'linux', '0.101.0')).toBe('64bit'); | ||
expect(getArch('x64', 'macOS', '0.101.0')).toBe('64bit'); | ||
expect(getArch('x64', 'windows', '0.101.0')).toBe('64bit'); | ||
|
||
expect(getArch('arm', 'linux', '0.101.0')).toBe('ARM'); | ||
expect(getArch('arm', 'macOS', '0.101.0')).toBe('ARM'); | ||
expect(getArch('arm', 'windows', '0.101.0')).toBe('ARM'); | ||
|
||
expect(getArch('arm64', 'linux', '0.101.0')).toBe('ARM64'); | ||
expect(getArch('arm64', 'macOS', '0.101.0')).toBe('ARM64'); | ||
expect(getArch('arm64', 'windows', '0.101.0')).toBe('ARM64'); | ||
}); | ||
|
||
test('processor architecture === 0.102.z', () => { | ||
expect(getArch('x64', 'linux', '0.102.0')).toBe('64bit'); | ||
expect(getArch('x64', 'macOS', '0.102.0')).toBe('universal'); | ||
expect(getArch('x64', 'windows', '0.102.0')).toBe('64bit'); | ||
|
||
expect(getArch('arm', 'macOS', '0.102.0')).toBe('universal'); | ||
|
||
expect(getArch('arm64', 'linux', '0.102.0')).toBe('ARM64'); | ||
expect(getArch('arm64', 'macOS', '0.102.0')).toBe('universal'); | ||
expect(getArch('arm64', 'windows', '0.102.0')).toBe('ARM64'); | ||
}); | ||
|
||
test('processor architecture === 0.103.z', () => { | ||
expect(getArch('x64', 'linux', '0.103.0')).toBe('amd64'); | ||
expect(getArch('x64', 'darwin', '0.103.0')).toBe('universal'); | ||
expect(getArch('x64', 'windows', '0.103.0')).toBe('amd64'); | ||
|
||
expect(getArch('arm', 'darwin', '0.103.0')).toBe('universal'); | ||
|
||
expect(getArch('arm64', 'linux', '0.103.0')).toBe('arm64'); | ||
expect(getArch('arm64', 'darwin', '0.103.0')).toBe('universal'); | ||
expect(getArch('arm64', 'windows', '0.103.0')).toBe('arm64'); | ||
}); | ||
|
||
test('processor architecture > 0.103.0', () => { | ||
expect(getArch('x64', 'linux', '0.104.0')).toBe('amd64'); | ||
expect(getArch('x64', 'darwin', '0.104.0')).toBe('universal'); | ||
expect(getArch('x64', 'windows', '0.104.0')).toBe('amd64'); | ||
|
||
expect(getArch('arm', 'darwin', '0.104.0')).toBe('universal'); | ||
|
||
expect(getArch('arm64', 'linux', '0.104.0')).toBe('arm64'); | ||
expect(getArch('arm64', 'darwin', '0.104.0')).toBe('universal'); | ||
expect(getArch('arm64', 'windows', '0.104.0')).toBe('arm64'); | ||
}); | ||
|
||
test('exception', () => { | ||
expect(() => { | ||
getArch('mips'); | ||
getArch('mips', 'linux', '0.101.0'); | ||
}).toThrowError('mips is not supported'); | ||
|
||
expect(() => { | ||
getArch('arm', 'linux', '0.102.0') | ||
}).toThrowError('arm is not supported'); | ||
}); | ||
}); |
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
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