Skip to content

Commit 078eb0d

Browse files
Set dependent versions based on PHP version desired LRN-43664
1 parent ad913f9 commit 078eb0d

File tree

2 files changed

+34
-14
lines changed

2 files changed

+34
-14
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
ARG PHP_VERSION=8.3
22
ARG DEBIAN_VERSION=bookworm
3+
ARG COMPOSER_VERSION=2.7.6
34

4-
FROM composer:2.7.1 as composer
5+
FROM composer:${COMPOSER_VERSION} as composer
56

67
FROM php:${PHP_VERSION}-cli-${DEBIAN_VERSION}
78

Makefile

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
ARGS_PHPUNIT ?=
22

33
DOCKER := $(if $(LRN_SDK_NO_DOCKER),,$(shell which docker))
4-
PHP_VERSION = 8.3
5-
DEBIAN_VERSION = bookworm
6-
IMAGE = php-cli-composer:$(PHP_VERSION)
4+
5+
# PHP Evolution
6+
SUPPORTED_PHP_VERSIONS = 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3
7+
PHP_VERSION = $(lastword ${SUPPORTED_PHP_VERSIONS})
8+
DEBIAN_VERSION-7.1 = buster
9+
DEBIAN_VERSION-7.2 = buster
10+
DEBIAN_VERSION-7.3 = bullseye
11+
DEBIAN_VERSION-7.4 = bullseye
12+
DEBIAN_VERSION-8.0 = bullseye
13+
DEBIAN_VERSION-def = bookworm
14+
DEBIAN_VERSION = $(or $(DEBIAN_VERSION-$(PHP_VERSION)),$(DEBIAN_VERSION-def))
15+
COMPOSER_VERSION-7.1 = 2.2
16+
COMPOSER_VERSION-def = 2.7.6
17+
COMPOSER_VERSION = $(or $(COMPOSER_VERSION-$(PHP_VERSION)),$(COMPOSER_VERSION-def))
18+
19+
IMAGE = php-cli-composer:$(PHP_VERSION)-$(DEBIAN_VERSION)-$(COMPOSER_VERSION)
720

821
TARGETS = all build devbuild prodbuild \
922
quickstart check-quickstart install-vendor \
@@ -28,8 +41,14 @@ $(TARGETS): $(if $(shell docker image ls -q --filter reference=$(IMAGE)),,docker
2841
$(DKR) make -e MAKEFLAGS="$(MAKEFLAGS)" $@
2942

3043
docker-build:
31-
docker image build --progress plain --build-arg PHP_VERSION=$(PHP_VERSION) --build-arg DEBIAN_VERSION=$(DEBIAN_VERSION) -t $(IMAGE) .
32-
.PHONY: docker-build
44+
docker image build \
45+
--progress plain \
46+
--build-arg PHP_VERSION=$(PHP_VERSION) \
47+
--build-arg DEBIAN_VERSION=$(DEBIAN_VERSION) \
48+
--build-arg COMPOSER_VERSION=$(COMPOSER_VERSION) \
49+
-t $(IMAGE) .
50+
.PHONY: docker-build lrn-test-all lrn-test-clean
51+
3352

3453
else
3554
DIST_PREFIX = learnosity_sdk-
@@ -64,19 +83,19 @@ prodbuild: install-vendor
6483
release:
6584
@./release.sh
6685

67-
lint: install-vendor
86+
lint: build
6887
$(PHPCS) src
6988

70-
test: install-vendor
71-
$(PHPUNIT) --do-not-cache-result $(ARGS_PHPUNIT)
89+
test: build
90+
$(PHPUNIT) $(if $(subst 7.1,,$(PHP_TARGET)),--do-not-cache-result) $(ARGS_PHPUNIT)
7291

73-
test-coverage: install-vendor
92+
test-coverage: build
7493
XDEBUG_MODE=coverage $(PHPUNIT) --do-not-cache-result $(ARGS_PHPUNIT)
7594

76-
test-unit: install-vendor
95+
test-unit: build
7796
$(PHPUNIT) --do-not-cache-result --testsuite unit $(ARGS_PHPUNIT)
7897

79-
test-integration-env: install-vendor
98+
test-integration-env: build
8099
$(PHPUNIT) --do-not-cache-result --testsuite integration $(ARGS_PHPUNIT)
81100

82101
###
@@ -104,8 +123,8 @@ dist-test: dist-zip install-vendor
104123
###
105124
# install vendor rules
106125
###
107-
install-vendor: vendor/autoload.php
108-
vendor/autoload.php: composer.json
126+
install-vendor: composer.lock
127+
composer.lock: composer.json
109128
$(COMPOSER) install $(COMPOSER_INSTALL_FLAGS) $(VENDOR_FLAGS)
110129

111130
clean: clean-dist clean-test clean-vendor

0 commit comments

Comments
 (0)