Skip to content

Commit

Permalink
move pre-build to shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarak Ben Youssef committed Feb 21, 2024
1 parent 59fe8d0 commit eb922b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
VERSION: ${{github.ref_name}}
COMMIT: ${{ github.sha }}
with:
pre_command: make generate && make install-cross-build-tools
pre_command: make generate && make install-cross-build-tools && sh pre_build.sh
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "1.20"
project_path: ./cmd/flow
build_command: make --directory=./../.. build
build_flags: GO111MODULE=on CGO_ENABLED=1 CGO_FLAGS="-O2 -D__BLST_PORTABLE__" CC=$(C_COMP)
ldflags: -X "github.com/onflow/flow-cli/build.commit=${{ env.COMMIT }}" -X "github.com/onflow/flow-cli/build.semver=${{ env.VERSION }}" -X "github.com/onflow/flow-cli/internal/command.mixpanelToken=${{ env.MIXPANEL_PROJECT_TOKEN }}" -X "github.com/onflow/flow-cli/internal/accounts.accountToken=${{ env.LILICO_TOKEN }}"
17 changes: 0 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,5 @@ install-cross-build-tools:
echo "this target only works on Debian or Linux, host runs on" $(UNAME) ; \
fi

# INPUT_GOARCH is a variable set by the wangyoucao577 action
# https://github.com/wangyoucao577/go-release-action/blob/v1.40/action.yml#L109
C_COMP := clang
ifeq ($(INPUT_GOARCH), arm64)
C_COMP := aarch64-linux-gnu-gcc
endif
ifeq ($(INPUT_GOARCH), amd64)
C_COMP := x86_64-linux-gnu-gcc
endif

.PHONY: build
build:
GO111MODULE=on \
CGO_ENABLED=1 \
CGO_FLAGS="-O2 -D__BLST_PORTABLE__" \
CC=$(C_COMP) \
GOARCH=$(INPUT_GOARCH) \
go build -C ./cmd/flow

13 changes: 13 additions & 0 deletions pre_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# Exit as soon as any command fails
set -e

# INPUT_GOARCH is a variable set by the wangyoucao577 action
# https://github.com/wangyoucao577/go-release-action/blob/v1.40/action.yml#L109
C_COMP="clang"
if [ "${INPUT_GOARCH}" = "arm64" ]; then
C_COMP="aarch64-linux-gnu-gcc"
elif [ "${INPUT_GOARCH}" = "amd64" ]; then
C_COMP="x86_64-linux-gnu-gcc"
fi

0 comments on commit eb922b8

Please sign in to comment.