danger / danger/swift

[Feature Request] Include a pre-built executable in each release and use in the homebrew tap

Open
#476 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
1.1k
Forks
152
Avg merge
9h 54m
Merged PRs (30d)
2

Description

### Summary
Include a pre-built executable in each release. Use that pre-built artifact in the homebrew tap.

### Why
* Fetching the dependencies and building danger-swift can take a long time, even with the swiftpm approach, especially on CI such as Xcode Cloud where cache is per workflow/branch
* The homebrew tap builds from source https://github.com/danger/swift/blob/master/Scripts/create_homebrew_tap.sh
* The danger-js homebrew tap already serves a pre-built binary https://github.com/danger/homebrew-tap/blob/master/danger-js.rb

### How

Building a universal binary for Intel and Apple Silicon macs should be a matter of:
```
swift build --configuration release --arch arm64 --arch x86_64
```

Inspecting the resulting executable:
```
file .build/apple/Products/Release/danger-swift
.build/apple/Products/Release/danger-swift: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64]
.build/apple/Products/Release/danger-swift (for architecture x86_64): Mach-O 64-bit executable x86_64
.build/apple/Products/Release/danger-swift (for architecture arm64): Mach-O 64-bit executable arm64
```

```
du -h .build/apple/Products/Release/danger-swift
1.4M .build/apple/Products/Release/danger-swift
```

Since the third-party dependencies are statically linked, the executable is standalone:
```
otool -L .build/apple/Products/Release/danger-swift
.build/apple/Products/Release/danger-swift:
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1775.118.101)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1775.118.101)
@rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 1205.0.24)
@rpath/libswiftCoreFoundation.dylib (compatibility version 1.0.0, current version 1.6.0, weak)
@rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 2.0.0, weak)
@rpath/libswiftDarwin.dylib (compatibility version 1.0.0, current version 0.0.0, weak)
@rpath/libswiftDispatch.dylib (compatibility version 1.0.0, current version 4.100.1)
@rpath/libswiftFoundation.dylib (compatibility version 1.0.0, current version 25.102.0)
@rpath/libswiftIOKit.dylib (compatibility version 1.0.0, current version 1.0.0, weak)
@rpath/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 3.0.0)
@rpath/libswiftXPC.dylib (compatibility version 1.0.0, current version 1.1.0, weak)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.