Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ jobs:

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.path }}"
run: ls -lach "${{ steps.test-action.outputs.path }}"
6 changes: 4 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ describe('action', () => {
setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
})

it('downloads 14.0.0', async () => {
it('downloads 15.0.0', async () => {
// Set the action's inputs as return values from core.getInput()
getInputMock.mockImplementation(name => {
switch (name) {
case 'version':
return '14.0.0'
return '15.0.0'
case 'unzip-to':
return tmpDir
case 'platform':
return 'linux_x64'
default:
return ''
}
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ inputs:
description: 'Where to unzip the Qt Creator files to'
required: true
default: 'qt-creator'
platform:
description: 'Overwrite platform detection'
required: false

# Define your outputs here.
outputs:
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function downloadQtC(urls: string[]): Promise<string[]> {
}
return packages.map(packageName => `${tmpDir}/${packageName}`)
} catch (error) {
core.warning((error as Error).message)
errors.push((error as Error).message)
}
}
Expand Down Expand Up @@ -73,16 +74,18 @@ export async function run(): Promise<void> {
try {
const version: string = core.getInput('version')
const destination: string = core.getInput('unzip-to')
const platformInput: string = core.getInput('platform')

if (!(process.platform in PlatformMap)) {
if (!platformInput && !(process.platform in PlatformMap)) {
core.setFailed(`Unsupported platform: ${process.platform}`)
return
}

const platformName: string =
PlatformMap[process.platform as keyof typeof PlatformMap]
const arch = process.platform === 'darwin' ? 'x64' : process.arch
const platform = `${platformName}_${arch}`

const platform = platformInput ? platformInput : `${platformName}_${arch}`

// Extract the major and minor versions
const [major, minor] = version.split('.').slice(0, 2)
Expand Down Expand Up @@ -115,6 +118,6 @@ export async function run(): Promise<void> {
)
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
core.setFailed((error as Error).message)
}
}
Loading