-
Notifications
You must be signed in to change notification settings - Fork 104
We should avoid setting GO env variables #3231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
28 | ||
29 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,12 @@ | |
|
||
SHELL := /bin/bash | ||
WEBROOT := frontends/web | ||
GOPATH ?= $(HOME)/go | ||
PATH := $(PATH):$(GOPATH)/bin | ||
|
||
catch: | ||
@echo "Choose a make target." | ||
envinit: | ||
# Keep golangci-lint version in sync with what's in .github/workflows/ci.yml. | ||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.61.0 | ||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.61.0 | ||
go install github.com/vektra/mockery/[email protected] | ||
go install github.com/matryer/[email protected] | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
|
@@ -84,8 +82,11 @@ clean: | |
cd frontends/qt && $(MAKE) clean | ||
cd frontends/android && $(MAKE) clean | ||
cd backend/mobileserver && $(MAKE) clean | ||
|
||
# The container image only supports amd64 bercause of "thyrlian/android-sdk" | ||
# that downloads amd64 specific binaries | ||
dockerinit: | ||
./scripts/container.sh build --pull --force-rm -t shiftcrypto/bitbox-wallet-app . | ||
./scripts/container.sh build --platform linux/amd64 --pull -t shiftcrypto/bitbox-wallet-app:$(shell cat .containerversion) . | ||
dockerdev: | ||
./scripts/dockerdev.sh | ||
locize-push: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export ANDROID_SDK_ROOT := /opt/android-sdk | ||
export ANDROID_NDK_HOME := /opt/android-sdk/ndk/21.2.6472646 | ||
# gomodcache location for gomobile build pkgs. Set to tmp folder, because writing access is needed. | ||
export GOMODCACHE_ROOT := /tmp/gomodcache/pkg/mod |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
include ../../android-env.mk.inc | ||
|
||
# GOMODCACHE to /tmp directory, because gomobile needs to write pkgs. | ||
# Also set -glflags to fix the vendor issue with gomobile, see: https://github.com/golang/go/issues/67927#issuecomment-2241523694 | ||
# Set -glflags to fix the vendor issue with gomobile, see: https://github.com/golang/go/issues/67927#issuecomment-2241523694 | ||
build-android: | ||
GOMODCACHE=${GOMODCACHE_ROOT} ANDROID_HOME=${ANDROID_SDK_ROOT} gomobile bind -x -a -glflags="-mod=readonly" -ldflags="-s -w" -target android . | ||
ANDROID_HOME=${ANDROID_SDK_ROOT} gomobile bind -x -a -glflags="-mod=readonly" -ldflags="-s -w" -target android . | ||
build-ios: | ||
GOMODCACHE=${GOMODCACHE_ROOT} gomobile bind -x -a -glflags="-mod=readonly" -ldflags="-s -w" -target ios,iossimulator . | ||
gomobile bind -x -a -glflags="-mod=readonly" -ldflags="-s -w" -target ios,iossimulator . | ||
clean: | ||
rm -f mobileserver.aar mobileserver-sources.jar |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ if [ "$OS_NAME" == "linux" ]; then | |
# Which docker image to use to run the CI. Defaults to Docker Hub. | ||
# Overwrite with CI_IMAGE=docker/image/path environment variable. | ||
# Keep this in sync with .github/workflows/ci.yml. | ||
: "${CI_IMAGE:=shiftcrypto/bitbox-wallet-app:26}" | ||
: "${CI_IMAGE:=shiftcrypto/bitbox-wallet-app:$(cat .containerversion)}" | ||
# Time image pull to compare in the future. | ||
time docker pull "$CI_IMAGE" | ||
|
||
|
@@ -22,24 +22,18 @@ if [ "$OS_NAME" == "linux" ]; then | |
# CI (https://github.com/actions/checkout/issues/760) | ||
docker run --privileged \ | ||
-v $HOME/.gradle:/root/.gradle \ | ||
-v ${GITHUB_BUILD_DIR}:/opt/go/${GO_SRC_DIR}/ \ | ||
-v ${GITHUB_BUILD_DIR}:/root/go/${GO_SRC_DIR}/ \ | ||
-i "${CI_IMAGE}" \ | ||
bash -c "git config --global --add safe.directory \$GOPATH/${GO_SRC_DIR} && make -C \$GOPATH/${GO_SRC_DIR} ${WHAT}" | ||
bash -c "git config --global --add safe.directory \$(go env GOPATH)/${GO_SRC_DIR} && make -C \$(go env GOPATH)/${GO_SRC_DIR} ${WHAT}" | ||
fi | ||
|
||
# The following is executed only on macOS machines. | ||
if [ "$OS_NAME" == "osx" ]; then | ||
# GitHub CI installs Go and Qt directly in the macos action, before executing | ||
# this script. | ||
go version | ||
export GOPATH=~/go | ||
export PATH="$PATH:~/go/bin" | ||
mkdir -p $GOPATH/$(dirname $GO_SRC_DIR) | ||
# GitHub checkout action (git clone) seem to require current work dir | ||
# to be the root of the repo during its clean up phase. So, we push it | ||
# here and pop in the end. | ||
pushd ../ && cp -a bitbox-wallet-app $GOPATH/$(dirname $GO_SRC_DIR) | ||
cd $GOPATH/$GO_SRC_DIR | ||
make "$WHAT" | ||
popd | ||
export PATH="~/go/bin:$PATH" | ||
mkdir -p $(go env GOPATH)/$(dirname $GO_SRC_DIR) | ||
cp -a ../bitbox-wallet-app $(go env GOPATH)/$(dirname $GO_SRC_DIR) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems wrong, there should be no need to copy the repo somewhere else. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is that something from how go used to work? that the go code had to be copied to a certain directory structure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is this comment earlier:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Go modules has been introduced, the repo can live anywhere. There is, or was, a catch with gomobile, which isn't compatible with modules:
This forced us to turn off modules, which required the repo to be again in the GOPATH like it was required in the past. However, I guess for this PR, you could just leave it as is, as changing this is unrelated to this PR. |
||
make -C $(go env GOPATH)/$GO_SRC_DIR "$WHAT" | ||
fi |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.