SwiftLintPlugin causes SPM tests to fail on Ubuntu (Github actions)
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
Adding the SwiftLintPlugin to an SPM project causes the swift test command to fail on Ubuntu with the error:
error: a prebuild command cannot use executables built from source, including executable target 'swiftlint'
The other issue I found that mentions "prebuild" is #5243, so this bug may provide a second reason to switch from "prebuild" to "build".
Github action and output
You can see this bug in the Ubuntu tests for my public project Monotonic.
Github action
name: Ubuntu tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: swift-actions/setup-swift@v1.25.0
with:
swift-version: "5.9"
- name: Run tests
run: swift test
Output
Run swift test
[2](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:2)
swift test
[3](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:3)
shell: /usr/bin/bash -e {0}
[4](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:5)
Fetching https://github.com/samalone/websocket-actor-system.git
[5](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:6)
[1/702] Fetching websocket-actor-system
[6](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:7)
Fetched https://github.com/samalone/websocket-actor-system.git (0.21s)
[7](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:8)
Fetching https://github.com/apple/swift-nio.git
[8](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:9)
Fetching https://github.com/samalone/nio-async-websockets
[9](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:10)
Fetching https://github.com/jpsim/SourceKitten.git
[10](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:11)
[1/34] Fetching nio-async-websockets
[11](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:12)
[35/15820] Fetching nio-async-websockets, sourcekitten
[12](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:13)
[15821/79458] Fetching nio-async-websockets, sourcekitten, swift-nio
[13](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:14)
Fetched https://github.com/samalone/nio-async-websockets (3.71s)
[14](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:15)
Fetching https://github.com/realm/SwiftLint
[15](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:16)
Fetched https://github.com/jpsim/SourceKitten.git (3.73s)
[16](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:17)
Fetching https://github.com/drmohundro/SWXMLHash.git
[17](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:18)
Fetched https://github.com/apple/swift-nio.git (3.81s)
[18](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:19)
Fetching https://github.com/apple/swift-collections
[19](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:20)
[1/2766] Fetching swxmlhash
[20](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:21)
Fetched https://github.com/drmohundro/SWXMLHash.git (0.26s)
[21](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:22)
Fetching https://github.com/jpsim/Yams.git
[22](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:23)
[1/12426] Fetching swift-collections
[23](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:24)
[10812/134715] Fetching swift-collections, swiftlint
[24](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:25)
[11062/143529] Fetching swift-collections, swiftlint, yams
[25](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:26)
Fetched https://github.com/apple/swift-collections (0.88s)
[26](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:27)
Fetching https://github.com/apple/swift-syntax.git
[27](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:28)
[18752/131103] Fetching swiftlint, yams
[28](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:29)
Fetched https://github.com/jpsim/Yams.git (1.05s)
[29](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:30)
Fetching https://github.com/apple/swift-nio-transport-services.git
[30](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:31)
[13452/122289] Fetching swiftlint
[31](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:32)
[13453/176004] Fetching swiftlint, swift-syntax
[32](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:33)
[19031/178040] Fetching swiftlint, swift-syntax, swift-nio-transport-services
[33](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:34)
Fetched https://github.com/apple/swift-nio-transport-services.git (0.35s)
[34](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:35)
Fetching https://github.com/apple/swift-atomics
[35](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:36)
[27087/176004] Fetching swiftlint, swift-syntax
[36](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:37)
[51740/177549] Fetching swiftlint, swift-syntax, swift-atomics
[37](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:38)
Fetched https://github.com/apple/swift-atomics (0.53s)
[38](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:39)
Fetching https://github.com/krzyzanowskim/CryptoSwift.git
[39](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:40)
[69076/176004] Fetching swiftlint, swift-syntax
[40](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:41)
[70837/188528] Fetching swiftlint, swift-syntax, cryptoswift
[41](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:42)
Fetched https://github.com/krzyzanowskim/CryptoSwift.git (1.86s)
[42](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:43)
Fetching https://github.com/apple/swift-argument-parser
[43](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:44)
[76813/176004] Fetching swiftlint, swift-syntax
[44](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:45)
[76951/187341] Fetching swiftlint, swift-syntax, swift-argument-parser
[45](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:46)
Fetched https://github.com/apple/swift-argument-parser (1.05s)
[46](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:47)
Fetching https://github.com/scottrhoyt/SwiftyTextTable.git
[47](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:48)
[78173/176004] Fetching swiftlint, swift-syntax
[48](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:49)
[78174/176933] Fetching swiftlint, swift-syntax, swiftytexttable
[49](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:50)
Fetched https://github.com/scottrhoyt/SwiftyTextTable.git (0.28s)
[50](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:51)
Fetching https://github.com/apple/swift-log.git
[51](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:52)
[79166/176004] Fetching swiftlint, swift-syntax
[52](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:53)
[79397/179156] Fetching swiftlint, swift-syntax, swift-log
[53](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:54)
Fetched https://github.com/apple/swift-log.git (0.55s)
[54](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:55)
Fetching https://github.com/JohnSundell/CollectionConcurrencyKit.git
[55](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:56)
Fetched https://github.com/apple/swift-syntax.git (5.09s)
[56](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:57)
[28127/122289] Fetching swiftlint
[57](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:58)
[28128/122372] Fetching swiftlint, collectionconcurrencykit
[58](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:59)
Fetched https://github.com/JohnSundell/CollectionConcurrencyKit.git (0.20s)
[59](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:60)
[28647/122289] Fetching swiftlint
[60](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:61)
Fetched https://github.com/realm/SwiftLint (17.45s)
[61](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:62)
Computing version for https://github.com/realm/SwiftLint
[62](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:63)
Computed https://github.com/realm/SwiftLint at 0.54.0 (0.82s)
...
[941](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:942)
[1012/1015] Compiling swiftlint SwiftLintError.swift
[942](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:943)
[1013/1015] Compiling swiftlint SwiftPMCompilationDB.swift
[943](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:944)
[1015/1017] Wrapping AST for swiftlint for debugging
[944](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:945)
[1016/1017] Linking swiftlint
[945](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:946)
Build complete! (160.69s)
[946](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:947)
Building for debugging...
[947](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:948)
Build complete! (0.13s)
[948](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:949)
Building for debugging...
[949](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:950)
Build complete! (0.13s)
[950](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:951)
Building for debugging...
[951](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:952)
Build complete! (0.13s)
[952](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:953)
error: a prebuild command cannot use executables built from source, including executable target 'swiftlint'
[953](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:954)
error: build stopped due to build-tool plugin failures
[954](https://github.com/samalone/monotonic/actions/runs/7031653172/job/19133726682#step:4:955)
Error: Process completed with exit code 1.
Environment
- SwiftLint version 0.54.0
- Installation method used? SPM plugin
- Swift 5.9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported failure with the SwiftLintPlugin and swift test on Ubuntu using the linked GitHub Actions example. Inspect the plugin's prebuild command configuration and related issue #5243; done means SPM tests complete successfully on Ubuntu without the reported executable-target error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- build-system, ci-cd, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100