Skip to content

Commit

Permalink
Using Docker to build executable
Browse files Browse the repository at this point in the history
  • Loading branch information
csjones committed Nov 18, 2024
1 parent 953a88e commit b0a99d2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
run: |
swift build --configuration release --static-swift-stdlib --enable-dead-strip
SWIFTFORMAT_BIN_PATH=`swift build --configuration release --show-bin-path`
strip "$SWIFTFORMAT_BIN_PATH/swiftformat"
mv $SWIFTFORMAT_BIN_PATH/swiftformat "${HOME}/swiftformat_linux"
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
Expand All @@ -42,16 +43,21 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Static Linux SDKs
run: |
swift sdk install \
https://download.swift.org/swift-6.0.2-release/static-sdk/swift-6.0.2-RELEASE/swift-6.0.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz \
--checksum aa5515476a403797223fc2aad4ca0c3bf83995d5427fb297cab1d93c68cee075
- name: Build aarch64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export ARM64 binary
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64
target: builder
outputs: type=local,dest=artifacts
- name: Install cross-binutils for aarch64
run: sudo apt install -y binutils-aarch64-linux-gnu
- name: Strip andMove binary
run: |
swift build --configuration release --enable-dead-strip --static-swift-stdlib --swift-sdk aarch64-swift-linux-musl
SWIFTFORMAT_BIN_PATH=`swift build --configuration release --show-bin-path --swift-sdk aarch64-swift-linux-musl`
mv $SWIFTFORMAT_BIN_PATH/swiftformat "${HOME}/swiftformat_linux_aarch64"
aarch64-linux-gnu-strip artifacts/workspace/swiftformat
mv artifacts/workspace/swiftformat "${HOME}/swiftformat_linux_aarch64"
- name: Upload aarch64 Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions Scripts/build-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pushd "$(dirname "${BASH_SOURCE[0]}")/.." > /dev/null
BUILD_ARGS=(
--product swiftformat
--configuration release
-Xlinker -S
)

if [[ -z "$TARGETPLATFORM" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions Scripts/spm-artifact-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ chmod +x $LINUX_AARCH64_EXECUTABLE
mkdir -p $LINUX_AARCH64_BINARY_OUTPUT_DIR
cp $LINUX_AARCH64_EXECUTABLE $LINUX_AARCH64_BINARY_OUTPUT_DIR

# Create ZIP
zip -9yr - $ARTIFACT_BUNDLE > "${ARTIFACT_BUNDLE}.zip"
# Create ZIP using 7z
7z a -tzip -mx=9 "${ARTIFACT_BUNDLE}.zip" "$ARTIFACT_BUNDLE"

rm -rf $ARTIFACT_BUNDLE

0 comments on commit b0a99d2

Please sign in to comment.