Thanks to visit codestin.com
Credit goes to github.com

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

Build for windows when building on linux #126

Merged
merged 1 commit into from
Sep 15, 2020
Merged
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
16 changes: 8 additions & 8 deletions ci/steps/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ popd() { builtin popd >/dev/null; }
set -euo pipefail
cd "$(dirname "$0")"

export GOARCH=amd64
tag=$(git describe --tags)

build() {
echo "Building coder-cli for $GOOS-$GOARCH..."

tmpdir=$(mktemp -d)
go build -ldflags "-X main.version=${tag}" -o "$tmpdir/coder" ../../cmd/coder

Expand All @@ -33,12 +34,11 @@ build() {
# Darwin builds do not work from Linux, so only try to build them from Darwin.
# See: https://github.com/cdr/coder-cli/issues/20
if [[ "$(uname)" == "Darwin" ]]; then
GOOS=linux build
CGO_ENABLED=1 GOOS=darwin build
GOOS=windows GOARCH=386 build
exit 0
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 build
else
echo "Warning: Darwin builds don't work on Linux."
echo "Please use an OSX machine to build Darwin tars."
fi

echo "Warning: Darwin builds don't work on Linux."
echo "Please use an OSX machine to build Darwin tars."
GOOS=linux build
GOOS=linux GOARCH=amd64 build
GOOS=windows GOARCH=386 build