Skip to content

Commit

Permalink
Compress launcher binaries with upx
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Nov 14, 2024
1 parent 93baa85 commit ffbc534
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
with:
go-version: '1.23'
cache: false
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: Maven Install
run: ./mvnw install -B -V -DskipTests -Dair.check.skip-all
- name: Maven Tests
Expand Down
9 changes: 9 additions & 0 deletions launcher/src/main/go/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ build_for_os_and_arch() {

echo "Building for ${os}/${arch} into ${path}/${EXECUTABLE_NAME}"
CGO_ENABLED=0 GOOS="${os}" GOARCH="${arch}" go build -ldflags="-s -w -extldflags=-static -X launcher/args.Version=$(git describe HEAD)" -o "${DIR}/${OUTPUT_DIR}${path}/${EXECUTABLE_NAME}" .

echo "Compressing binary with upx"
if [[ "${os}" == "darwin" ]]; then
echo "Skipping upx for MacOS"
else
upx "${DIR}/${OUTPUT_DIR}${path}/${EXECUTABLE_NAME}"
fi

echo "Done building for ${os}/${arch}, size: $(du -sh "${DIR}/${OUTPUT_DIR}${path}/${EXECUTABLE_NAME}" | cut -f1)"
}

build_for_os_and_arch "linux" "amd64"
Expand Down

0 comments on commit ffbc534

Please sign in to comment.