From 570d0f077ccd8c314c7367d84a0fd45448680e05 Mon Sep 17 00:00:00 2001 From: zenix Date: Wed, 16 Mar 2022 21:49:47 +0900 Subject: [PATCH] feature: add github release flow for dnum --- .github/workflows/release.yml | 72 +++++++++++++++++++++++++++++++++++ Makefile | 67 ++++++++++++++++++++++++++++++-- 2 files changed, 136 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0ea9a52a..65b4a8366 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -119,3 +119,75 @@ jobs: asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz asset_name: bbgo-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz asset_content_type: application/octet-stream + - name: Upload slim Linux amd64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz + asset_name: bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz + asset_content_type: application/octet-stream + - name: Upload slim Linux arm64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-linux-arm64.tar.gz + asset_name: bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-linux-arm64.tar.gz + asset_content_type: application/octet-stream + - name: Upload slim Darwin amd64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz + asset_name: bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz + asset_content_type: application/octet-stream + - name: Upload slim Darwin arm64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz + asset_name: bbgo-slim-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz + asset_content_type: application/octet-stream + - name: Upload Linux amd64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz + asset_name: bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz + asset_content_type: application/octet-stream + - name: Upload Linux arm64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-linux-arm64.tar.gz + asset_name: bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-linux-arm64.tar.gz + asset_content_type: application/octet-stream + - name: Upload Darwin amd64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz + asset_name: bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz + asset_content_type: application/octet-stream + - name: Upload Darwin arm64 dnum + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/${{ steps.get_version.outputs.VERSION }}/bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz + asset_name: bbgo-dnum-${{ steps.get_version.outputs.VERSION }}-darwin-arm64.tar.gz + asset_content_type: application/octet-stream diff --git a/Makefile b/Makefile index e0062b183..1d09e4b04 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,48 @@ bbgo-slim-darwin-amd64: $(BIN_DIR) bbgo-slim-darwin: bbgo-slim-darwin-amd64 bbgo-slim-darwin-arm64 +# build native bbgo +bbgo-dnum: static + go build -tags web,release,dnum -o $(BIN_DIR)/bbgo ./cmd/bbgo + +# build native bbgo (slim version) +bbgo-slim-dnum: + go build -tags release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +# build cross-compile linux bbgo +bbgo-dnum-linux: bbgo-dnum-linux-amd64 bbgo-dnum-linux-arm64 + +bbgo-dnum-linux-amd64: $(BIN_DIR) pkg/server/assets.go + GOOS=linux GOARCH=amd64 go build -tags web,release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-dnum-linux-arm64: $(BIN_DIR) pkg/server/assets.go + GOOS=linux GOARCH=arm64 go build -tags web,release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +# build cross-compile linux bbgo (slim version) +bbgo-slim-dnum-linux: bbgo-slim-dnum-linux-amd64 bbgo-slim-dnum-linux-arm64 + +bbgo-slim-dnum-linux-amd64: $(BIN_DIR) + GOOS=linux GOARCH=amd64 go build -tags release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-slim-dnum-linux-arm64: $(BIN_DIR) + GOOS=linux GOARCH=arm64 go build -tags release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-dnum-darwin: bbgo-dnum-darwin-arm64 bbgo-dnum-darwin-amd64 + +bbgo-dnum-darwin-arm64: $(BIN_DIR) pkg/server/assets.go + GOOS=darwin GOARCH=arm64 go build -tags web,release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-dnum-darwin-amd64: $(BIN_DIR) pkg/server/assets.go + GOOS=darwin GOARCH=amd64 go build -tags web,release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-slim-dnum-darwin-arm64: $(BIN_DIR) + GOOS=darwin GOARCH=arm64 go build -tags release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-slim-dnum-darwin-amd64: $(BIN_DIR) + GOOS=darwin GOARCH=amd64 go build -tags release,dnum -o $(BIN_DIR)/$@ ./cmd/bbgo + +bbgo-slim-dnum-darwin: bbgo-slim-dnum-darwin-amd64 bbgo-slim-dnum-darwin-arm64 + clean: rm -rf $(BUILD_DIR) $(DIST_DIR) $(FRONTEND_EXPORT_DIR) @@ -108,17 +150,37 @@ ifeq ($(SIGN),1) gpg --yes --detach-sign --armor $@ endif +$(DIST_DIR)/$(VERSION)/bbgo-slim-dnum-$(VERSION)-%.tar.gz: bbgo-slim-dnum-% $(DIST_DIR)/$(VERSION) + tar -C $(BIN_DIR) -cvzf $@ $< +ifeq ($(SIGN),1) + gpg --yes --detach-sign --armor $@ +endif + +$(DIST_DIR)/$(VERSION)/bbgo-dnum-$(VERSION)-%.tar.gz: bbgo-dnum-% $(DIST_DIR)/$(VERSION) + tar -C $(BIN_DIR) -cvzf $@ $< +ifeq ($(SIGN),1) + gpg --yes --detach-sign --armor $@ +endif + dist-bbgo-linux: \ $(DIST_DIR)/$(VERSION)/bbgo-$(VERSION)-linux-arm64.tar.gz \ $(DIST_DIR)/$(VERSION)/bbgo-$(VERSION)-linux-amd64.tar.gz \ $(DIST_DIR)/$(VERSION)/bbgo-slim-$(VERSION)-linux-arm64.tar.gz \ - $(DIST_DIR)/$(VERSION)/bbgo-slim-$(VERSION)-linux-amd64.tar.gz + $(DIST_DIR)/$(VERSION)/bbgo-slim-$(VERSION)-linux-amd64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-dnum-$(VERSION)-linux-arm64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-dnum-$(VERSION)-linux-amd64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-slim-dnum-$(VERSION)-linux-arm64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-slim-dnum-$(VERSION)-linux-amd64.tar.gz dist-bbgo-darwin: \ $(DIST_DIR)/$(VERSION)/bbgo-$(VERSION)-darwin-arm64.tar.gz \ $(DIST_DIR)/$(VERSION)/bbgo-$(VERSION)-darwin-amd64.tar.gz \ $(DIST_DIR)/$(VERSION)/bbgo-slim-$(VERSION)-darwin-arm64.tar.gz \ - $(DIST_DIR)/$(VERSION)/bbgo-slim-$(VERSION)-darwin-amd64.tar.gz + $(DIST_DIR)/$(VERSION)/bbgo-slim-$(VERSION)-darwin-amd64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-dnum-$(VERSION)-darwin-arm64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-dnum-$(VERSION)-darwin-amd64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-slim-dnum-$(VERSION)-darwin-arm64.tar.gz \ + $(DIST_DIR)/$(VERSION)/bbgo-slim-dnum-$(VERSION)-darwin-amd64.tar.gz dist: static dist-bbgo-linux dist-bbgo-darwin desktop @@ -180,4 +242,3 @@ protobuf: protobuf-py: python -m grpc_tools.protoc -I$(PWD)/pkg/pb --python_out=$(PWD)/python/bbgo --grpc_python_out=$(PWD)/python/bbgo $(PWD)/pkg/pb/bbgo.proto -