Skip to content

Commit

Permalink
ci: make tidy and diffutils for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
tzaffi authored May 25, 2023
1 parent 79d1e3a commit e7e76fc
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ ARCH := $(shell ./scripts/archtype.sh)
OS_TYPE := $(shell ./scripts/ostype.sh)
S3_RELEASE_BUCKET = $$S3_RELEASE_BUCKET

GOLANG_VERSIONS := $(shell ./scripts/get_golang_version.sh all)
GOLANG_VERSION_BUILD := $(firstword $(GOLANG_VERSIONS))
GOLANG_VERSION_SUPPORT := $(lastword $(GOLANG_VERSIONS))
GOLANG_VERSION_BUILD_MAJOR := $(shell echo $(GOLANG_VERSION_BUILD) | cut -d'.' -f1,2)
CURRENT_GO_VERSION := $(shell go version | cut -d " " -f 3 | tr -d 'go')
CURRENT_GO_VERSION_MAJOR := $(shell echo $(CURRENT_GO_VERSION) | cut -d'.' -f1,2)

# If build number already set, use it - to ensure same build number across multiple platforms being built
BUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh)
FULLBUILDNUMBER ?= $(shell ./scripts/compute_build_number.sh -f)
Expand Down Expand Up @@ -101,10 +108,19 @@ fix: build
lint: deps
$(GOPATH1)/bin/golangci-lint run -c .golangci.yml

check_go_version:
@if [ $(CURRENT_GO_VERSION_MAJOR) != $(GOLANG_VERSION_BUILD_MAJOR) ]; then \
echo "Wrong major version of Go installed ($(CURRENT_GO_VERSION_MAJOR)). Please use $(GOLANG_VERSION_BUILD_MAJOR)"; \
exit 1; \
fi

tidy: check_go_version
go mod tidy -compat=$(GOLANG_VERSION_SUPPORT)

check_shell:
find . -type f -name "*.sh" -exec shellcheck {} +

sanity: fix lint fmt
sanity: fix lint fmt tidy

cover:
go test $(GOTAGS) -coverprofile=cover.out $(UNIT_TEST_SOURCES)
Expand Down
1 change: 1 addition & 0 deletions scripts/configure_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ elif [ "${OS}" = "darwin" ]; then
install_or_upgrade automake
install_or_upgrade python3
install_or_upgrade lnav
install_or_upgrade diffutils
lnav -i "$SCRIPTPATH/algorand_node_log.json"
fi
elif [ "${OS}" = "windows" ]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/get_golang_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and parsed as an array to check against the system's golang version depending
# upon the context in which the project is being built.
#
# "dev" is to be used to satisfy the minium requirement we have to successfully
# "dev" is to be used to satisfy the minimum requirement we have to successfully
# build the project.
#
# The default is to return the pinned version needed for our production builds.
Expand Down
11 changes: 11 additions & 0 deletions scripts/travis/codegen_verification.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,16 @@ else
echo Enlistment is clean
fi

echo Checking Tidiness...
make tidy
if [[ -n $(git status --porcelain) ]]; then
echo Dirty after go mod tidy - did you forget to run make tidy?
git status -s
git --no-pager diff
exit 1
else
echo All tidy
fi

# test binary compatibility
"${SCRIPTPATH}/../../test/platform/test_linux_amd64_compatibility.sh"

0 comments on commit e7e76fc

Please sign in to comment.