mirror of
https://github.com/nxtrace/NTrace-core.git
synced 2026-12-02 17:23:14 +00:00
chore(build): add UPX compression for linux(386/amd64/arm64/armv7) binaries in cross-compile script
ci: install UPX on Linux jobs and compress linux (386/amd64/arm64/armv7) artifacts
This commit is contained in:
1 parent
3e247608cc
commit
3dcb9f747e
2 files changed
+72
No files matched your search
@@ -109,6 +109,18 @@ jobs:
|
||||
- name: Get project dependencies
|
||||
run: go mod download
|
||||
|
||||
- name: Install UPX (selected Linux targets)
|
||||
if: >
|
||||
matrix.goos == 'linux' && (
|
||||
matrix.goarch == 'amd64' ||
|
||||
matrix.goarch == '386' ||
|
||||
matrix.goarch == 'arm64' ||
|
||||
(matrix.goarch == 'arm' && matrix.goarm == '7')
|
||||
)
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y upx
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
mkdir -p dist
|
||||
@@ -117,6 +129,19 @@ jobs:
|
||||
-X github.com/nxtrace/NTrace-core/config.BuildDate=${BUILD_DATE} \
|
||||
-X github.com/nxtrace/NTrace-core/config.CommitID=${COMMIT_SHA1} \
|
||||
-checklinkname=0 -w -s"
|
||||
if command -v upx >/dev/null 2>&1; then
|
||||
case "${GOOS}-${GOARCH}-${GOARM:-}" in
|
||||
linux-amd64-*) upx -9 "dist/${ASSET_NAME}" ;;
|
||||
linux-386-*) upx -9 "dist/${ASSET_NAME}" ;;
|
||||
linux-arm64-*) upx -9 "dist/${ASSET_NAME}" ;;
|
||||
linux-arm-7) upx -9 "dist/${ASSET_NAME}" ;;
|
||||
*)
|
||||
echo "skip upx for ${GOOS}/${GOARCH}${GOARM:+/v${GOARM}}"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "upx not available; skipping compression for ${GOOS}/${GOARCH}${GOARM:+/v${GOARM}}"
|
||||
fi
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
|
||||
Reference in new issue
Block a user