Skip to content

Commit

Permalink
Add explicit support for PHP 8.3 in test pipeline (Codeception#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
szhajdu authored May 19, 2024
1 parent 06be16d commit 69a88c5
Show file tree
Hide file tree
Showing 10 changed files with 125 additions and 9 deletions.
5 changes: 3 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Exclude files that don't need to be present in packages (so they're not downloaded by Composer)
/docker export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/Robofile.php export-ignore
/Makefile export-ignore
/*.md export-ignore
/*.xml export-ignore
/*.yml export-ignore
/*.Dockerfile export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
strategy:
matrix:
php: [8.0, 8.1, 8.2]
php: [8.0, 8.1, 8.2, 8.3]

steps:
- name: Create default database for sqlsrv as image does not support it
Expand Down
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ start: ## Start the containers for testing
$(MAKE) -i stop
CURRENT_USER=$(CURRENT_USER) $(DOCKER_COMPOSE) up -d --build --force-recreate --remove-orphans
$(DOCKER_COMPOSE) run --rm wait -c mysql:3306,postgres:5432,mssql:1433 -t 60
$(MAKE) vendor

stop: ## Stop and remove containers
$(DOCKER_COMPOSE) down --remove-orphans --volumes
Expand All @@ -34,7 +33,19 @@ php-cli: ## Open bash in PHP container
$(DOCKER_COMPOSE) exec -u $(CURRENT_USER) php bash

vendor: ## Install dependencies
$(DOCKER_EXEC_PHP_WITH_USER) "composer install --no-interaction --prefer-dist"
$(DOCKER_EXEC_PHP_WITH_USER) "composer update --no-interaction --prefer-dist"

test: ## Run the tests
$(DOCKER_EXEC_PHP_WITH_USER) "php vendor/bin/codecept run"

pipeline: ## Run the tests pipeline
$(MAKE) start
$(MAKE) vendor
$(MAKE) test
$(MAKE) stop

ci: ## Run the tests
$(MAKE) pipeline php=8.0
$(MAKE) pipeline php=8.1
$(MAKE) pipeline php=8.2
$(MAKE) pipeline php=8.3
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ services:
php:
container_name: codeception-module-db
build:
context: .
dockerfile: ./php81.Dockerfile
context: ./docker/php${php:-8.3}
environment:
COMPOSER_HOME: /tmp/.composer
MYSQL_HOST: host.docker.internal
Expand Down
4 changes: 2 additions & 2 deletions php81.Dockerfile → docker/php8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.0-fpm

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/

Expand All @@ -21,7 +21,7 @@ RUN install-php-extensions \
zip-stable \
xdebug-3.1.5

COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

Expand Down
29 changes: 29 additions & 0 deletions docker/php8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:8.1-fpm

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/

RUN apt-get update && \
apt-get install -y \
unzip \
wget \
git \
zlib1g-dev \
libzip-dev \
libpq-dev \
default-mysql-client

RUN install-php-extensions \
pdo_mysql-stable \
pdo_pgsql-stable \
pdo_dblib-stable \
pdo_sqlsrv-5.11.0 \
pgsql-stable \
zip-stable \
xdebug-3.3.2

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

ENTRYPOINT ["tail"]
CMD ["-f", "/dev/null"]
29 changes: 29 additions & 0 deletions docker/php8.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:8.2-fpm

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/

RUN apt-get update && \
apt-get install -y \
unzip \
wget \
git \
zlib1g-dev \
libzip-dev \
libpq-dev \
default-mysql-client

RUN install-php-extensions \
pdo_mysql-stable \
pdo_pgsql-stable \
pdo_dblib-stable \
pdo_sqlsrv-5.11.0 \
pgsql-stable \
zip-stable \
xdebug-3.3.2

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

ENTRYPOINT ["tail"]
CMD ["-f", "/dev/null"]
29 changes: 29 additions & 0 deletions docker/php8.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM php:8.3-fpm

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/

RUN apt-get update && \
apt-get install -y \
unzip \
wget \
git \
zlib1g-dev \
libzip-dev \
libpq-dev \
default-mysql-client

RUN install-php-extensions \
pdo_mysql-stable \
pdo_pgsql-stable \
pdo_dblib-stable \
pdo_sqlsrv-5.12.0 \
pgsql-stable \
zip-stable \
xdebug-3.3.2

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

ENTRYPOINT ["tail"]
CMD ["-f", "/dev/null"]
18 changes: 18 additions & 0 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,24 @@ make test

This command will execute the tests inside the PHP container.

## Running the Tests Pipeline

To run the tests pipeline, use the following command:

```bash
make pipeline
```

This command will start the containers, install dependencies, run the tests, and then stop the containers.

## Running the Tests for Continuous Integration

```bash
make ci
```

This command will run the tests pipeline for all supported PHP versions.

## Other Commands

- To stop and remove the Docker containers, use the following command:
Expand Down
Empty file modified tests/data/sqlite.db
100644 → 100755
Empty file.

0 comments on commit 69a88c5

Please sign in to comment.