Skip to content
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

Support Linux (amd64 only for now) #17

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
28 changes: 20 additions & 8 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.

38 changes: 26 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,37 @@ export async function run(): Promise<void> {
try {
const version: string = core.getInput('version')

// Fail the workflow run if we're not running on macOS
if (process.platform !== 'darwin') {
core.setFailed(
`Unsupported OS "${process.platform}, only "darwin" is currently supported`
)

return
}

// Determine the asset URL
let url: string

if (version !== 'latest') {
url = `https://github.com/realm/SwiftLint/releases/download/${version}/portable_swiftlint.zip`
url = `https://github.com/realm/SwiftLint/releases/download/${version}/`
} else {
url =
'https://github.com/realm/SwiftLint/releases/latest/download/portable_swiftlint.zip'
url = 'https://github.com/realm/SwiftLint/releases/latest/download/'
}

if (process.platform === 'darwin') {
// SwiftLint's binaries for Darwin are universal
url += 'portable_swiftlint.zip'
} else if (process.platform === 'linux') {
// SwiftLint's binaries for Linux are x64-only[1]
//
// [1]: https://github.com/realm/SwiftLint/issues/4531
if (process.arch === 'x64') {
edigaryev marked this conversation as resolved.
Show resolved Hide resolved
core.setFailed(
`Unsupported Linux architecture "${process.arch}", only "x64" is currently supported`
)

return
}

url += 'swiftlint_linux.zip'
} else {
core.setFailed(
`Unsupported OS "${process.platform}", only "darwin" and "linux" are currently supported`
)

return
}

// Retrieve the SwiftLint binary from the tool cache
Expand Down
Loading