2019-05-19 21:00:40 -04:00
|
|
|
.DEFAULT_GOAL = test
|
|
|
|
.PHONY: FORCE
|
2019-06-04 21:55:20 -04:00
|
|
|
|
2019-09-23 15:17:07 -04:00
|
|
|
# enable consistent Go 1.12/1.13 GOPROXY behavior.
|
|
|
|
export GOPROXY = https://proxy.golang.org
|
2019-09-21 01:35:45 -04:00
|
|
|
|
2022-08-24 22:10:51 +02:00
|
|
|
BINARY = golangci-lint
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
BINARY := $(BINARY).exe
|
|
|
|
endif
|
|
|
|
|
2019-05-19 21:00:40 -04:00
|
|
|
# Build
|
|
|
|
|
2022-08-24 22:10:51 +02:00
|
|
|
build: $(BINARY)
|
2019-12-29 21:32:33 -05:00
|
|
|
.PHONY: build
|
|
|
|
|
|
|
|
build_race:
|
2022-08-24 22:10:51 +02:00
|
|
|
go build -race -o $(BINARY) ./cmd/golangci-lint
|
2019-12-29 21:32:33 -05:00
|
|
|
.PHONY: build_race
|
|
|
|
|
2019-05-19 21:00:40 -04:00
|
|
|
clean:
|
2022-08-24 22:10:51 +02:00
|
|
|
rm -f $(BINARY)
|
2019-09-24 14:44:57 -04:00
|
|
|
rm -f test/path
|
|
|
|
rm -f tools/Dracula.itermcolors
|
2019-09-25 10:26:46 -04:00
|
|
|
rm -f tools/svg-term
|
2019-09-24 14:44:57 -04:00
|
|
|
rm -rf tools/node_modules
|
2019-12-29 21:32:33 -05:00
|
|
|
.PHONY: clean
|
2019-05-19 21:00:40 -04:00
|
|
|
|
|
|
|
# Test
|
2019-09-09 21:54:56 +03:00
|
|
|
test: export GOLANGCI_LINT_INSTALLED = true
|
2019-03-23 20:51:38 +08:00
|
|
|
test: build
|
2022-08-24 22:10:51 +02:00
|
|
|
GL_TEST_RUN=1 ./$(BINARY) run -v
|
2020-05-09 15:15:34 +03:00
|
|
|
GL_TEST_RUN=1 go test -v -parallel 2 ./...
|
2019-05-19 21:00:40 -04:00
|
|
|
.PHONY: test
|
2019-03-23 20:51:38 +08:00
|
|
|
|
2022-01-04 00:57:05 +03:00
|
|
|
# ex: T=gofmt.go make test_fix
|
|
|
|
# the value of `T` is the name of a file from `test/testdata/fix`
|
|
|
|
test_fix: build
|
|
|
|
GL_TEST_RUN=1 go test -v ./test -count 1 -run TestFix/$T
|
|
|
|
.PHONY: test_fix
|
|
|
|
|
2019-12-29 21:32:33 -05:00
|
|
|
test_race: build_race
|
2022-08-24 22:10:51 +02:00
|
|
|
GL_TEST_RUN=1 ./$(BINARY) run -v --timeout=5m
|
2019-05-19 21:00:40 -04:00
|
|
|
.PHONY: test_race
|
2018-11-10 15:51:59 +03:00
|
|
|
|
2018-06-28 21:27:07 +03:00
|
|
|
test_linters:
|
2022-08-20 18:53:45 +02:00
|
|
|
GL_TEST_RUN=1 go test -v ./test -count 1 -run TestSourcesFromTestdata/$T
|
2019-05-19 21:00:40 -04:00
|
|
|
.PHONY: test_linters
|
2018-06-28 21:27:07 +03:00
|
|
|
|
2022-08-23 04:49:39 +08:00
|
|
|
test_linters_sub:
|
|
|
|
GL_TEST_RUN=1 go test -v ./test -count 1 -run TestSourcesFromTestdataSubDir/$T
|
|
|
|
.PHONY: test_linters_sub
|
|
|
|
|
2019-05-19 21:00:40 -04:00
|
|
|
# Maintenance
|
2018-06-02 14:04:54 +03:00
|
|
|
|
2020-05-17 00:08:16 +03:00
|
|
|
fast_generate: assets/github-action-config.json
|
2021-02-07 19:18:33 +01:00
|
|
|
.PHONY: fast_generate
|
2018-09-01 14:16:30 +03:00
|
|
|
|
2020-05-17 00:08:16 +03:00
|
|
|
fast_check_generated:
|
|
|
|
$(MAKE) --always-make fast_generate
|
2021-08-19 17:11:34 +03:00
|
|
|
git checkout -- go.mod go.sum # can differ between go1.16 and go1.17
|
2020-05-17 00:08:16 +03:00
|
|
|
git diff --exit-code # check no changes
|
|
|
|
|
2019-05-19 21:00:40 -04:00
|
|
|
# Non-PHONY targets (real files)
|
|
|
|
|
2022-08-24 22:10:51 +02:00
|
|
|
$(BINARY): FORCE
|
2019-05-19 21:00:40 -04:00
|
|
|
go build -o $@ ./cmd/golangci-lint
|
|
|
|
|
2020-05-16 14:10:03 +03:00
|
|
|
# TODO: migrate to docs/
|
2019-09-24 14:44:57 -04:00
|
|
|
tools/svg-term: tools/package.json tools/package-lock.json
|
2019-09-09 15:37:06 +01:00
|
|
|
cd tools && npm ci
|
2019-05-19 21:00:40 -04:00
|
|
|
ln -sf node_modules/.bin/svg-term $@
|
|
|
|
|
2020-05-16 14:10:03 +03:00
|
|
|
# TODO: migrate to docs/
|
2019-09-24 14:44:57 -04:00
|
|
|
tools/Dracula.itermcolors:
|
2019-05-19 21:00:40 -04:00
|
|
|
curl -fL -o $@ https://raw.githubusercontent.com/dracula/iterm/master/Dracula.itermcolors
|
|
|
|
|
2020-05-16 14:10:03 +03:00
|
|
|
# TODO: migrate to docs/
|
2020-05-09 15:30:54 +03:00
|
|
|
assets/demo.svg: tools/svg-term tools/Dracula.itermcolors
|
|
|
|
./tools/svg-term --cast=183662 --out assets/demo.svg --window --width 110 --height 30 --from 2000 --to 20000 --profile ./tools/Dracula.itermcolors --term iterm2
|
2019-05-19 21:00:40 -04:00
|
|
|
|
2022-08-24 22:10:51 +02:00
|
|
|
assets/github-action-config.json: FORCE $(BINARY)
|
2021-02-17 05:17:41 +01:00
|
|
|
# go run ./scripts/gen_github_action_config/main.go $@
|
|
|
|
cd ./scripts/gen_github_action_config/; go run ./main.go ../../$@
|
2020-05-09 15:30:54 +03:00
|
|
|
|
2019-05-19 21:00:40 -04:00
|
|
|
go.mod: FORCE
|
2019-09-21 01:35:45 -04:00
|
|
|
go mod tidy
|
|
|
|
go mod verify
|
2019-05-19 21:00:40 -04:00
|
|
|
go.sum: go.mod
|
2020-05-16 14:41:39 +03:00
|
|
|
|
2024-03-13 00:19:26 +01:00
|
|
|
website_copy_jsonschema:
|
2024-03-19 21:35:21 +01:00
|
|
|
go run ./scripts/website/copy_jsonschema/
|
2024-03-13 00:19:26 +01:00
|
|
|
.PHONY: website_copy_jsonschema
|
|
|
|
|
2024-03-11 20:24:12 +01:00
|
|
|
website_expand_templates:
|
|
|
|
go run ./scripts/website/expand_templates/
|
|
|
|
.PHONY: website_expand_templates
|
|
|
|
|
|
|
|
website_dump_info:
|
|
|
|
go run ./scripts/website/dump_info/
|
2024-03-14 18:25:27 +01:00
|
|
|
.PHONY: website_dump_info
|
2020-05-19 14:38:46 +03:00
|
|
|
|
|
|
|
update_contributors_list:
|
2020-07-11 19:22:01 -05:00
|
|
|
cd .github/contributors && npm run all
|
|
|
|
|