From 74a6c86c4ff54bd8e192b3a7483c33e40438ef54 Mon Sep 17 00:00:00 2001 From: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Tue, 17 Nov 2020 15:19:48 +0000 Subject: [PATCH] Add a make target for running a local compile (#1123) It's often useful to be able to run a compile outside of the unit or Hatchet tests when developing the buildpack or debugging. Whilst running the compile locally inside Docker won't fully replicate a compile on the platform, for many use-cases it's close enough and importantly gives a faster development feedback loop, since buildpack changes don't have to be committed/pushed prior to triggering a compile. Closes @W-8436406@. --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index af1a761..ccbf6b1 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ # These targets are not files -.PHONY: check test builder-image buildenv deploy-runtimes tools +.PHONY: check test compile builder-image buildenv deploy-runtimes tools STACK ?= heroku-18 STACKS ?= heroku-16 heroku-18 heroku-20 TEST_CMD ?= test/run-versions && test/run-features && test/run-deps +FIXTURE ?= test/fixtures/requirements-standard ENV_FILE ?= builds/dockerenv.default BUILDER_IMAGE_PREFIX := heroku-python-build @@ -21,6 +22,13 @@ test: @docker run --rm -it -v $(PWD):/buildpack:ro -e "STACK=$(STACK)" "$(STACK_IMAGE_TAG)" bash -c 'cp -r /buildpack /buildpack_test && cd /buildpack_test && $(TEST_CMD)' @echo +compile: + @echo "Running compile using: STACK=$(STACK) FIXTURE=$(FIXTURE)" + @echo + @docker run --rm -it -v $(PWD):/src:ro -e "STACK=$(STACK)" -w /buildpack "$(STACK_IMAGE_TAG)" \ + bash -c 'cp -r /src/{bin,vendor} /buildpack && cp -r /src/$(FIXTURE) /build && mkdir /cache /env && bin/compile /build /cache /env' + @echo + builder-image: @echo "Generating binary builder image for $(STACK)..." @echo