Skip to content

Commit e1ff8a1

Browse files
authored
Build: Use go tool and separate module file, go run to remove some build scripts (#6491)
1 parent a5fcf54 commit e1ff8a1

37 files changed

+164
-305
lines changed

.github/actions/setup-test/action.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,3 @@ runs:
2828
sudo dpkg-reconfigure -f noninteractive man-db
2929
sudo apt-get install -y --no-upgrade expect
3030
shell: bash
31-
- name: Cache gotestsum
32-
id: cache-gotestsum
33-
uses: actions/cache@v4
34-
with:
35-
path: ~/go/bin/gotestsum
36-
key: gotestsum-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('scripts/buildtools/versions') }}
37-
- name: Install gotestsum
38-
if: steps.cache-gotestsum.outputs.cache-hit != 'true'
39-
run: ./scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
40-
shell: bash

.github/workflows/ci-nightly.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,10 @@ jobs:
102102
- name: Run tests
103103
run: |
104104
./scripts/configure_dev.sh
105-
./scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
106105
PACKAGES="$(go list ./... | grep -v /go-algorand/test/)"
107106
export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n')
108107
mkdir -p test_results/${{ matrix.platform }}_test_nightly/${PARTITION_ID}
109-
gotestsum --format standard-quiet \
108+
go tool -modfile=tool.mod gotestsum --format standard-quiet \
110109
--junitfile ~/test_results/${{ matrix.platform }}_test_nightly/${PARTITION_ID}/results.xml \
111110
--jsonfile ~/test_results/${{ matrix.platform }}_test_nightly/${PARTITION_ID}/testresults.json \
112111
-- --tags "sqlite_unlock_notify sqlite_omit_load_extension" \
@@ -184,7 +183,6 @@ jobs:
184183
- name: Run integration tests
185184
run: |
186185
./scripts/configure_dev.sh
187-
./scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
188186
mkdir -p ~/test_results/${{ matrix.platform }}_integration_nightly/${PARTITION_ID}
189187
TEST_RESULTS=~/test_results/${{ matrix.platform }}_integration_nightly/${PARTITION_ID} \
190188
test/scripts/run_integration_tests.sh
@@ -241,7 +239,6 @@ jobs:
241239
- name: Run E2E expect tests
242240
run: |
243241
scripts/configure_dev.sh
244-
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
245242
mkdir -p ~/test_results/${{ matrix.platform }}_e2e_expect_nightly/${PARTITION_ID}
246243
TEST_RESULTS=~/test_results/${{ matrix.platform }}_e2e_expect_nightly/${PARTITION_ID} \
247244
test/scripts/run_integration_tests.sh
@@ -308,7 +305,6 @@ jobs:
308305
- name: Run E2E subs tests
309306
run: |
310307
scripts/configure_dev.sh
311-
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
312308
mkdir -p ~/test_results/${{ matrix.platform }}_e2e_subs_nightly
313309
TEST_RESULTS=~/test_results/${{ matrix.platform }}_e2e_subs_nightly \
314310
test/scripts/run_integration_tests.sh

.github/workflows/ci-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
PACKAGES="$(go list ./... | grep -v /go-algorand/test/)"
5252
export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n')
5353
mkdir -p test_results/${{ matrix.platform }}_test/${PARTITION_ID}
54-
gotestsum --format standard-quiet \
54+
go tool -modfile=tool.mod gotestsum --format standard-quiet \
5555
--junitfile ~/test_results/${{ matrix.platform }}_test/${PARTITION_ID}/results.xml \
5656
--jsonfile ~/test_results/${{ matrix.platform }}_test/${PARTITION_ID}/testresults.json \
5757
-- --tags "sqlite_unlock_notify sqlite_omit_load_extension" $SHORTTEST \

AGENTS.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ To verify that this wasn't missed, we run verification steps, which can be found
5050
### Development Setup
5151
```bash
5252
./scripts/configure_dev.sh # Initial environment setup
53-
./scripts/buildtools/install_buildtools.sh # Install build tools
54-
make deps # Check/install dependencies
5553
```
5654

5755
### Single Test Execution

Makefile

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ GOTAGSLIST := sqlite_unlock_notify sqlite_omit_load_extension
4343
# e.g. make GOTAGSCUSTOM=msgtrace
4444
GOTAGSLIST += ${GOTAGSCUSTOM}
4545

46-
# If available, use gotestsum instead of 'go test'.
47-
ifeq (, $(shell which gotestsum))
48-
export GOTESTCOMMAND=go test
49-
else
50-
export GOTESTCOMMAND=gotestsum --format pkgname --jsonfile testresults.json --
51-
endif
46+
GOTESTCOMMAND := go tool -modfile=tool.mod gotestsum --format pkgname --jsonfile testresults.json --
5247

5348
ifeq ($(OS_TYPE), darwin)
5449
# M1 Mac--homebrew install location in /opt/homebrew
@@ -109,8 +104,8 @@ fix: build
109104
modernize:
110105
GOTOOLCHAIN=auto go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -any=false -bloop=false -rangeint=false -fmtappendf=false -waitgroup=false -stringsbuilder=false -omitzero=false -fix ./...
111106

112-
lint: deps
113-
$(GOBIN)/golangci-lint run -c .golangci.yml
107+
lint:
108+
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.1 run -c .golangci.yml
114109

115110
warninglint: custom-golangci-lint
116111
./custom-golangci-lint run -c .golangci-warnings.yml
@@ -143,7 +138,7 @@ cover:
143138
prof:
144139
cd node && go test $(GOTAGS) -cpuprofile=cpu.out -memprofile=mem.out -mutexprofile=mutex.out
145140

146-
generate: deps
141+
generate:
147142
PATH=$(GOBIN):$$PATH go generate ./...
148143

149144
msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE))
@@ -154,13 +149,13 @@ api:
154149
logic:
155150
make -C data/transactions/logic
156151

157-
158-
%/msgp_gen.go: deps ALWAYS
152+
MSGP := go run github.com/algorand/msgp@v1.1.61
153+
%/msgp_gen.go: ALWAYS
159154
@set +e; \
160-
printf "msgp: $(@D)..."; \
161-
$(GOBIN)/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \
155+
printf "$(MSGP) $(@D)..."; \
156+
$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./$@.out 2>&1; \
162157
if [ "$$?" != "0" ]; then \
163-
printf "failed:\n$(GOBIN)/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \
158+
printf "failed:\n$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \
164159
cat ./$@.out; \
165160
rm ./$@.out; \
166161
exit 1; \
@@ -234,9 +229,6 @@ else
234229
echo "OS_TYPE must be darwin for universal builds, skipping"
235230
endif
236231

237-
deps:
238-
./scripts/check_deps.sh
239-
240232
# artifacts
241233

242234
# Regenerate kmd swagger spec files
@@ -263,15 +255,15 @@ $(KMD_API_SWAGGER_SPEC): $(KMD_API_FILES) crypto/libs/$(OS_TYPE)/$(ARCH)/lib/lib
263255
touch $@; \
264256
fi
265257

266-
$(KMD_API_SWAGGER_INJECT): deps $(KMD_API_SWAGGER_SPEC) $(KMD_API_SWAGGER_SPEC).validated
258+
$(KMD_API_SWAGGER_INJECT): $(KMD_API_SWAGGER_SPEC) $(KMD_API_SWAGGER_SPEC).validated
267259
./daemon/kmd/lib/kmdapi/bundle_swagger_json.sh
268260

269261
# generated files we should make sure we clean
270262
GENERATED_FILES := \
271263
$(KMD_API_SWAGGER_INJECT) \
272264
$(KMD_API_SWAGGER_SPEC) $(KMD_API_SWAGGER_SPEC).validated
273265

274-
rebuild_kmd_swagger: deps
266+
rebuild_kmd_swagger:
275267
rm -f $(GENERATED_FILES)
276268
# we need to invoke the make here since we want to ensure that the deletion and re-creating are sequential
277269
make $(KMD_API_SWAGGER_INJECT)
@@ -418,7 +410,7 @@ dump: $(addprefix gen/,$(addsuffix /genesis.dump, $(NETWORKS)))
418410
install: build
419411
scripts/dev_install.sh -p $(GOBIN)
420412

421-
.PHONY: default fmt lint check_shell sanity cover prof deps build build-race build-e2e test fulltest shorttest clean cleango deploy node_exporter install %gen gen NONGO_BIN check-go-version rebuild_kmd_swagger universal libsodium modernize
413+
.PHONY: default fmt lint check_shell sanity cover prof build build-race build-e2e test fulltest shorttest clean cleango deploy node_exporter install %gen gen NONGO_BIN check-go-version rebuild_kmd_swagger universal libsodium modernize
422414

423415
###### TARGETS FOR CICD PROCESS ######
424416
include ./scripts/release/mule/Makefile.mule

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ We currently strive to support Debian-based distributions, with Ubuntu 24.04 as
3131
git clone https://github.com/algorand/go-algorand
3232
cd go-algorand
3333
./scripts/configure_dev.sh
34-
./scripts/buildtools/install_buildtools.sh
3534
```
3635

3736
At this point, you are ready to build go-algorand. We use `make` and have several targets to automate common tasks.

agreement/actions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
"github.com/algorand/go-algorand/protocol"
2727
)
2828

29-
//go:generate stringer -type=actionType
29+
//go:generate go tool -modfile=../tool.mod stringer -type=actionType
3030
type actionType uint8
3131

3232
const (

agreement/actiontype_string.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agreement/coservice.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/algorand/go-algorand/logging"
2323
)
2424

25-
//go:generate stringer -type=coserviceType
25+
//go:generate go tool -modfile=../tool.mod stringer -type=coserviceType
2626
const (
2727
demuxCoserviceType coserviceType = iota
2828
tokenizerCoserviceType

agreement/coservicetype_string.go

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)