Makefile 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .PHONY: generate realclean cover viewcover test lint check_diffs imports tidy
  2. generate:
  3. @go generate
  4. @$(MAKE) generate-jwa generate-jwe generate-jwk generate-jws generate-jwt
  5. generate-%:
  6. @echo "> Generating for $(patsubst generate-%,%,$@)"
  7. @go generate $(shell pwd -P)/$(patsubst generate-%,%,$@)
  8. realclean:
  9. rm coverage.out
  10. test-cmd:
  11. go test -v -race $(TESTOPTS)
  12. test:
  13. $(MAKE) TESTOPTS=./... test-cmd
  14. $(MAKE) -f $(PWD)/Makefile -C examples test-cmd
  15. $(MAKE) -f $(PWD)/Makefile -C bench/performance test-cmd
  16. cover-cmd:
  17. $(MAKE) test-cmd
  18. $(MAKE) -f $(PWD)/Makefile -C examples TESTOPTS= test-cmd
  19. $(MAKE) -f $(PWD)/Makefile -C bench/performance TESTOPTS= test-cmd
  20. $(MAKE) -f $(PWD)/Makefile -C cmd/jwx TESTOPTS= test-cmd
  21. @# This is NOT cheating. tools to generate code, and tools to
  22. @# run tests don't need to be included in the final result.
  23. @cat coverage.out.tmp | grep -v "internal/jose" | grep -v "internal/jwxtest" | grep -v "internal/cmd" > coverage.out
  24. @rm coverage.out.tmp
  25. cover:
  26. $(MAKE) cover-stdlib
  27. cover-stdlib:
  28. $(MAKE) cover-cmd TESTOPTS="-coverpkg=./... -coverprofile=coverage.out.tmp ./..."
  29. cover-goccy:
  30. $(MAKE) cover-cmd TESTOPTS="-tags jwx_goccy -coverpkg=./... -coverprofile=coverage.out.tmp ./..."
  31. cover-es256k:
  32. $(MAKE) cover-cmd TESTOPTS="-tags jwx_es256k -coverpkg=./... -coverprofile=coverage.out.tmp ./..."
  33. cover-all:
  34. $(MAKE) cover-cmd TESTOPTS="-tags jwx_goccy,jwx_es256k -coverpkg=./... -coverprofile=coverage.out.tmp ./..."
  35. smoke-cmd:
  36. $(MAKE) test-cmd
  37. $(MAKE) -f $(PWD)/Makefile -C examples test-cmd
  38. $(MAKE) -f $(PWD)/Makefile -C bench/performance test-cmd
  39. $(MAKE) -f $(PWD)/Makefile -C cmd/jwx test-cmd
  40. smoke:
  41. $(MAKE) smoke-stdlib
  42. smoke-stdlib:
  43. $(MAKE) smoke-cmd TESTOPTS="-short ./..."
  44. smoke-goccy:
  45. $(MAKE) smoke-cmd TESTOPTS="-short -tags jwx_goccy ./..."
  46. smoke-es256k:
  47. $(MAKE) smoke-cmd TESTOPTS="-short -tags jwx_es256k ./..."
  48. smoke-all:
  49. $(MAKE) smoke-cmd TESTOPTS="-short -tags jwx_goccy,jwx_es256k ./..."
  50. viewcover:
  51. go tool cover -html=coverage.out
  52. lint:
  53. golangci-lint run ./...
  54. check_diffs:
  55. ./scripts/check-diff.sh
  56. imports:
  57. goimports -w ./
  58. tidy:
  59. ./scripts/tidy.sh