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