소스 검색

Improve test-all-php-versions for PostgreSQL (#9606)

To avoid skipped tests.
Follow-up of:
* https://github.com/FreshRSS/FreshRSS/pull/9576
* https://github.com/FreshRSS/FreshRSS/pull/9535
Alexandre Alapetite 1 일 전
부모
커밋
3c13b68dc9
6개의 변경된 파일과 25개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      .github/ISSUE_TEMPLATE/feed-report-form.yml
  2. 1 1
      .github/workflows/tests.yml
  3. 1 0
      CHANGELOG.md
  4. 1 1
      Docker/README.md
  5. 1 1
      Docker/freshrss/docker-compose-db.yml
  6. 20 1
      Makefile

+ 1 - 1
.github/ISSUE_TEMPLATE/feed-report-form.yml

@@ -49,7 +49,7 @@ body:
     attributes:
       label: System information
       description: Please complete the following information
-      value: "- Database version: [e.g. PostgreSQL 18, MySQL 8.4, SQLite]\n- PHP version: [e.g. PHP 8.2]\n- Installation type: [e.g. Docker, Docker image source, git, YunoHost]\n- Web server type: [e.g. Apache, nginx]\n- Device: [e.g. iPhone13]\n- OS: [e.g. Ubuntu 24.04, Win11, macOS 27]\n- Browser: [e.g. Firefox 157]"
+      value: "- Database version: [e.g. PostgreSQL 19, MySQL 8.4, SQLite]\n- PHP version: [e.g. PHP 8.2]\n- Installation type: [e.g. Docker, Docker image source, git, YunoHost]\n- Web server type: [e.g. Apache, nginx]\n- Device: [e.g. iPhone13]\n- OS: [e.g. Ubuntu 24.04, Win11, macOS 27]\n- Browser: [e.g. Firefox 157]"
     validations:
       required: true
   - type: textarea

+ 1 - 1
.github/workflows/tests.yml

@@ -22,7 +22,7 @@ jobs:
 
     services:
       postgres:
-        image: postgres:18-alpine@sha256:eaef288f54a90a909e49f0121d5d047a5e974e922699de4249625cf7cde34f36
+        image: postgres:19-alpine@sha256:8b0ff4cdf221f0c53d7fcda681d3b461be725c492cd881c5ec9c0ad25023f188
         env:
           POSTGRES_HOST_AUTH_METHOD: trust
         ports:

+ 1 - 0
CHANGELOG.md

@@ -61,6 +61,7 @@ See also [the FreshRSS releases](https://github.com/FreshRSS/FreshRSS/releases).
 		* Treat https Atom 1.0 namespace as Atom
 * Deployment
 	* Docker: dev image `freshrss/freshrss:oldest` updated to Alpine 3.18 with PHP 8.2.16 and Apache 2.4.62 [#9470](https://github.com/FreshRSS/FreshRSS/pull/9470)
+	* Docker: dev image `freshrss/freshrss:newest` updated with PHP 8.6.0 and Apache 2.4.71
 	* Docker: dev image `freshrss/freshrss:newest` updated to use HTTPs for downloading packages [#9584](https://github.com/FreshRSS/FreshRSS/pull/9584)
 * UI
 	* Add option to open articles on their original website by default [#9554](https://github.com/FreshRSS/FreshRSS/pull/9554)

+ 1 - 1
Docker/README.md

@@ -128,7 +128,7 @@ docker compose -f docker-compose.yml -f docker-compose-db.yml pull
 docker compose -f docker-compose.yml -f docker-compose-db.yml -f docker-compose-local.yml up -d --remove-orphans
 ```
 
-> ⚠️ Keep the same major version of your database image (e.g. `postgres:17`) when updating FreshRSS, even if our example Compose files use a newer one:
+> ⚠️ Keep the same major version of your database image (e.g. `postgres:19`) when updating FreshRSS, even if our example Compose files use a newer one:
 > a new major version of PostgreSQL refuses to start with the data of a previous one. To change it, see [Migrate database](#migrate-database).
 > If you replace your Compose files with newer copies of ours, also check that your `.env` file still uses the same variable names.
 

+ 1 - 1
Docker/freshrss/docker-compose-db.yml

@@ -3,7 +3,7 @@ volumes:
 
 services:
   freshrss-db:
-    image: postgres:18
+    image: postgres:19
     container_name: freshrss-db
     hostname: freshrss-db
     restart: unless-stopped

+ 20 - 1
Makefile

@@ -8,7 +8,10 @@ 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
+PHP_VERSIONS ?= 8.2 8.3 8.4 8.5 8.6
+
+# PostgreSQL database used by test-all-php-versions
+TESTS_PGSQL_IMAGE ?= postgres:19-alpine
 
 # detect docker or podman
 DOCKER ?= $(shell which docker 2>/dev/null || which podman 2>/dev/null)
@@ -149,6 +152,20 @@ 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; \
+	i=0; \
+	$(DOCKER) rm --force freshrss-tests-db >/dev/null 2>&1 || true; \
+	$(DOCKER) network create freshrss-tests-db-network >/dev/null 2>&1 || true; \
+	cleanup() { $(DOCKER) rm --force freshrss-tests-db >/dev/null 2>&1 || true; $(DOCKER) network rm freshrss-tests-db-network >/dev/null 2>&1 || true; }; \
+	trap cleanup EXIT INT TERM; \
+	$(DOCKER) run --detach --rm \
+		--name freshrss-tests-db \
+		--network freshrss-tests-db-network \
+		--env POSTGRES_HOST_AUTH_METHOD=trust \
+		$(TESTS_PGSQL_IMAGE) >/dev/null; \
+	until $(DOCKER) exec freshrss-tests-db pg_isready >/dev/null 2>&1; do \
+		i=$$((i + 1)); [ $$i -lt 30 ] || { echo 'PostgreSQL database did not become ready in time.' >&2; exit 1; }; \
+		sleep 1; \
+	done; \
 	for v in $(PHP_VERSIONS); do \
 		echo "===== PHP $$v ====="; \
 		$(DOCKER) build --quiet \
@@ -156,6 +173,8 @@ test-all-php-versions: ## Run the test suite with every supported PHP version (D
 			--tag docker.io/freshrss/tests:php$$v \
 			--file Docker/Dockerfile-tests . ; \
 		$(DOCKER) run --rm \
+			--network freshrss-tests-db-network \
+			--env FRESHRSS_TEST_PGSQL_DSN='pgsql:host=freshrss-tests-db;dbname=postgres;user=postgres' \
 			--volume $(shell pwd):/var/www/FreshRSS:z \
 			--workdir /var/www/FreshRSS \
 			docker.io/freshrss/tests:php$$v \