Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

add: linux/arm64 target + checksums #59

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
brew install mingw-w64
# Go Build
- name: Build Binary
run: make build-cross
run: make build-cross gen-checksum
# Create Git Release
- name: Extract Tag from Ref
if: startsWith(github.ref, 'refs/tags/')
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ validate-docs:
echo "Encountered dirty repo!"; \
git diff; \
exit 1 \
;fi
;fi

gen-checksum:
$(eval ARTIFACTS_TO_PUBLISH := $(shell ls dist/*))
$$(sha256sum $(ARTIFACTS_TO_PUBLISH) > dist/checksums.txt)
16 changes: 12 additions & 4 deletions scripts/cross-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ set -ex
GO_TAGS="netgo"
LD_FLAGS="-s -w -X github.com/gptscript-ai/knowledge/version.Version=${GIT_TAG}"

export CGO_ENABLED=1

if [ "$(go env GOOS)" = "linux" ]; then
CGO_ENABLED=1 GOARCH=amd64 go build -o dist/knowledge-linux-amd64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}\" -extldflags \"-static\" " .
# Linux: amd64, arm64
GOARCH=amd64 go build -o dist/knowledge-linux-amd64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}\" -extldflags \"-static\" " .
GOARCH=arm64 go build -o dist/knowledge-linux-arm64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}\" -extldflags \"-static\" " .
else
CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -o dist/knowledge-windows-amd64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}" .
CGO_ENABLED=1 GOARCH=amd64 go build -o dist/knowledge-darwin-amd64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}" .
CGO_ENABLED=1 GOARCH=arm64 go build -o dist/knowledge-darwin-arm64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}" .

# Windows: amd64
CC=x86_64-w64-mingw32-gcc GOOS=windows GOARCH=amd64 go build -o dist/knowledge-windows-amd64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}" .

# Darwin: amd64, arm64
GOARCH=amd64 go build -o dist/knowledge-darwin-amd64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}" .
GOARCH=arm64 go build -o dist/knowledge-darwin-arm64 -tags "${GO_TAGS}" -ldflags "${LD_FLAGS}" .
fi