Makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. .PHONY: test examples clean test_full pebble pebble_setup pebble_start pebble_wait pebble_stop boulder boulder_setup boulder_start boulder_stop
  2. # some variables for path injection, if already set will not override
  3. GOPATH ?= $(HOME)/go
  4. BOULDER_PATH ?= $(GOPATH)/src/github.com/letsencrypt/boulder
  5. PEBBLE_PATH ?= $(GOPATH)/src/github.com/letsencrypt/pebble
  6. TEST_PATH ?= github.com/eggsampler/acme/v3
  7. CLIENT ?= unknown
  8. # tests the code against an already running ca instance
  9. # to actually do a test against pebble or boulder, including , see the 'pebble' or 'boulder' targets
  10. test:
  11. -go clean -testcache
  12. CGO_ENABLED=1 go test -v -race -coverprofile=coverage-$(CLIENT).out -covermode=atomic $(TEST_PATH)
  13. examples:
  14. go build -o /dev/null examples/certbot/certbot.go
  15. go build -o /dev/null examples/autocert/autocert.go
  16. go build -o /dev/null examples/zerossl/zerossl.go
  17. go build -o /dev/null examples/ari/renewalinfo.go
  18. clean:
  19. rm -f coverage*.out
  20. test_full: clean examples pebble pebble_stop boulder boulder_stop
  21. # sets up & runs pebble (in docker), tests, then stops pebble
  22. pebble: CLIENT = pebble
  23. pebble: pebble_setup pebble_start pebble_wait test pebble_stop
  24. pebble_setup:
  25. CLIENT=pebble
  26. mkdir -p $(PEBBLE_PATH)
  27. -git clone --depth 1 https://github.com/letsencrypt/pebble.git $(PEBBLE_PATH)
  28. (cd $(PEBBLE_PATH); git checkout -f main && git reset --hard HEAD && git pull -q)
  29. make pebble_stop
  30. # runs an instance of pebble using docker
  31. pebble_start:
  32. docker-compose -f $(PEBBLE_PATH)/docker-compose.yml up -d
  33. # waits until pebble responds
  34. pebble_wait:
  35. while ! wget --delete-after -q --no-check-certificate "https://localhost:14000/dir" ; do sleep 1 ; done
  36. # stops the running pebble instance
  37. pebble_stop:
  38. docker-compose -f $(PEBBLE_PATH)/docker-compose.yml down
  39. # sets up & runs boulder (in docker), tests, then stops boulder
  40. boulder: CLIENT = boulder
  41. boulder: boulder_setup boulder_start boulder_wait test boulder_stop
  42. # NB: this edits docker-compose.yml
  43. boulder_setup:
  44. mkdir -p $(BOULDER_PATH)
  45. -git clone --depth 1 https://github.com/letsencrypt/boulder.git $(BOULDER_PATH)
  46. (cd $(BOULDER_PATH); git checkout -f main && git reset --hard HEAD && git pull -q)
  47. make boulder_stop
  48. (cd $(BOULDER_PATH); docker compose run --rm bsetup)
  49. # runs an instance of boulder
  50. boulder_start:
  51. docker-compose -f $(BOULDER_PATH)/docker-compose.yml -f $(BOULDER_PATH)/docker-compose.next.yml -f docker-compose.boulder-temp.yml up -d
  52. # waits until boulder responds
  53. boulder_wait:
  54. while ! wget --delete-after -q --no-check-certificate "http://localhost:4001/directory" ; do sleep 1 ; done
  55. # stops the running docker instance
  56. boulder_stop:
  57. docker-compose -f $(BOULDER_PATH)/docker-compose.yml -f $(BOULDER_PATH)/docker-compose.next.yml -f docker-compose.boulder-temp.yml down