ソースを参照

make test-all-php-versions (#9576)

Convinience command to test all supported versions of PHP at once
Used for https://github.com/FreshRSS/FreshRSS/pull/9567
Alexandre Alapetite 6 時間 前
親
コミット
735c3690b1
2 ファイル変更、40 行追加、0 行削除
  1. 21 0
      Docker/Dockerfile-tests
  2. 19 0
      Makefile

+ 21 - 0
Docker/Dockerfile-tests

@@ -0,0 +1,21 @@
+# Base images for `make test-all-php-versions`
+ARG PHP_VERSION=8.5
+FROM php:${PHP_VERSION}-cli
+
+ENV TZ=UTC
+
+RUN apt-get update && \
+	apt-get install --yes --no-install-recommends \
+		libgmp-dev \
+		libicu-dev \
+		libonig-dev \
+		libpq-dev \
+		libzip-dev && \
+	docker-php-ext-install \
+		gmp \
+		intl \
+		mbstring \
+		pdo_mysql \
+		pdo_pgsql \
+		zip && \
+	rm -rf /var/lib/apt/lists/*

+ 19 - 0
Makefile

@@ -7,6 +7,9 @@ endif
 PORT ?= 8080
 NETWORK ?= freshrss-network
 
+# PHP versions tested by test-all-php-versions
+PHP_VERSIONS ?= 8.2 8.3 8.4 8.5 8.6-rc
+
 # detect docker or podman
 DOCKER ?= $(shell which docker 2>/dev/null || which podman 2>/dev/null)
 
@@ -135,6 +138,22 @@ typos-test: bin/typos
 .PHONY: test-all
 test-all: composer-test npm-test typos-test ## Run all tests
 
+.PHONY: test-all-php-versions
+test-all-php-versions: ## Run the test suite with every supported PHP version (Docker)
+	@set -eu; \
+	for v in $(PHP_VERSIONS); do \
+		echo "===== PHP $$v ====="; \
+		$(DOCKER) build --quiet \
+			--build-arg PHP_VERSION=$$v \
+			--tag docker.io/freshrss/tests:php$$v \
+			--file Docker/Dockerfile-tests . ; \
+		$(DOCKER) run --rm \
+			--volume $(shell pwd):/var/www/FreshRSS:z \
+			--workdir /var/www/FreshRSS \
+			docker.io/freshrss/tests:php$$v \
+			sh -c "php --version | head -1 ; bin/composer test" ; \
+	done
+
 .PHONY: fix-all
 fix-all: composer-fix npm-fix ## Run all fixes