diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 695f59ddb..f41a7cafd 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,9 +19,10 @@ jobs: context: containers/php file: containers/php/Dockerfile-PHP-5.6 push: false - tags: lucatume/wp-browser-v3-build:php5.6-apache + tags: lucatume/wp-browser-v3-wordpress:php5.6-apache cache-from: type=gha,scope=5.6 cache-to: type=gha,mode=max,scope=5.6 + load: true build-args: | PHP_VERSION=5.6 WP_IMAGE_VERSION=5 @@ -35,9 +36,10 @@ jobs: context: containers/php file: containers/php/Dockerfile-PHP-5.6 push: false - tags: lucatume/wp-browser-v3-build:php5.6-codeception + tags: lucatume/wp-browser-v3-codecept:php5.6 cache-from: type=gha,scope=5.6 cache-to: type=gha,mode=max,scope=5.6 + load: true build-args: | PHP_VERSION=5.6 WP_IMAGE_VERSION=5 @@ -70,14 +72,15 @@ jobs: uses: docker/build-push-action@v4 with: context: containers/php - file: containers/php/Dockerfile + file: containers/php/Dockerfile-PHP-5.6 push: false - tags: lucatume/wp-browser-v3-build:php${{ matrix.php_version }}-apache - cache-from: type=gha,scope=${{ matrix.php_version }} - cache-to: type=gha,mode=max,scope=${{ matrix.php_version }} + tags: lucatume/wp-browser-v3-wordpress:php5.6-apache + cache-from: type=gha,scope=5.6 + cache-to: type=gha,mode=max,scope=5.6 + load: true build-args: | - PHP_VERSION=${{ matrix.php_version }} - WP_IMAGE_VERSION=6 + PHP_VERSION=5.6 + WP_IMAGE_VERSION=5 TARGET=wordpress USER_UID=33 USER_GID=33 @@ -88,9 +91,10 @@ jobs: context: containers/php file: containers/php/Dockerfile push: false - tags: lucatume/wp-browser-v3-build:php${{ matrix.php_version }}-codeception + tags: lucatume/wp-browser-v3-codecept:php${{ matrix.php_version }} cache-from: type=gha,scope=${{ matrix.php_version }} cache-to: type=gha,mode=max,scope=${{ matrix.php_version }} + load: true build-args: | PHP_VERSION=${{ matrix.php_version }} WP_IMAGE_VERSION=6 @@ -99,7 +103,7 @@ jobs: USER_GID=33 USER_NAME=www-data - name: Build - run: bin/stack -p${{ matrix.php_version }} build + run: bin/stack -p5.6 build - name: Cache Composer dependencies uses: actions/cache@v3 with: diff --git a/Makefile b/Makefile index 4b8994106..d6191f9bd 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,8 @@ build: + bin/stack build_images bin/stack -p5.6 build - bin/stack -p7.0 build - bin/stack -p7.1 build - bin/stack -p7.2 build - bin/stack -p7.3 build - bin/stack -p7.4 build - bin/stack -p8.0 build - bin/stack -p8.1 build .PHONY: build -build_images: - bin/stack -p5.6 build_images - bin/stack -p7.0 build_images - bin/stack -p7.1 build_images - bin/stack -p7.2 build_images - bin/stack -p7.3 build_images - bin/stack -p7.4 build_images - bin/stack -p8.0 build_images - bin/stack -p8.1 build_images - build_56_lock_files: [ -d config/composer ] || mkdir config/composer rm -f config/composer/*5.6* @@ -40,46 +24,6 @@ build_56_lock_files: mv config/composer/composer.json.bak composer.json -build_74_lock_files: - [ -d config/composer ] || mkdir config/composer - cp composer.json config/composer/composer.json.bak - - bin/stack -p7.4 -d -c2 composer_update - mv composer.json config/composer/composer-7.4-codeception-2.json - mv composer.lock config/composer/composer-7.4-codeception-2.lock - cp config/composer/composer.json.bak composer.json - - bin/stack -p7.4 -d -c3 composer_update - mv composer.json config/composer/composer-7.4-codeception-3.json - mv composer.lock config/composer/composer-7.4-codeception-3.lock - cp config/composer/composer.json.bak composer.json - - bin/stack -p7.4 -d -c4 composer_update - mv composer.json config/composer/composer-7.4-codeception-4.json - mv composer.lock config/composer/composer-7.4-codeception-4.lock - - mv config/composer/composer.json.bak composer.json - -build_80_lock_files: - [ -d config/composer ] || mkdir config/composer - cp composer.json config/composer/composer.json.bak - - bin/stack -p8.0 -d -c4 composer_update - mv composer.json config/composer/composer-8.0-codeception-4.json - mv composer.lock config/composer/composer-8.0-codeception-4.lock - - mv config/composer/composer.json.bak composer.json - -build_81_lock_files: - [ -d config/composer ] || mkdir config/composer - cp composer.json config/composer/composer.json.bak - - bin/stack -p8.1 -d -c4 composer_update - mv composer.json config/composer/composer-8.1-codeception-4.json - mv composer.lock config/composer/composer-8.1-codeception-4.lock - - mv config/composer/composer.json.bak composer.json - lint: docker run --rm \ --volume "$(PWD):$(PWD):ro" \ @@ -140,14 +84,11 @@ static_analysis: lint phpcs phpstan .PHONE: static_analysis test: static_analysis - bin/stack -p5.6 xdebug-off && bin/stack -c2 composer_update && bin/stack -p5.6 test - bin/stack -p5.6 xdebug-off && bin/stack -c3 composer_update && bin/stack -p5.6 test - bin/stack -p5.6 xdebug-off && bin/stack -c4 composer_update && bin/stack -p5.6 test - bin/stack -p7.4 xdebug-off && bin/stack -c2 composer_update && bin/stack -p7.4 test - bin/stack -p7.4 xdebug-off && bin/stack -c3 composer_update && bin/stack -p7.4 test - bin/stack -p7.4 xdebug-off && bin/stack -c4 composer_update && bin/stack -p7.4 test - bin/stack -p8.0 xdebug-off && bin/stack -c4 composer_update && bin/stack -p8.0 test - bin/stack -p8.1 xdebug-off && bin/stack -c4 composer_update && bin/stack -p8.1 test + bin/stack -p5.6 xdebug-off && bin/stack composer_update && bin/stack -p5.6 test + bin/stack -p7.4 xdebug-off && bin/stack composer_update && bin/stack -p7.4 test + bin/stack -p8.0 xdebug-off && bin/stack composer_update && bin/stack -p8.0 test + bin/stack -p8.1 xdebug-off && bin/stack composer_update && bin/stack -p8.1 test + bin/stack -p8.2 xdebug-off && bin/stack composer_update && bin/stack -p8.2 test .PHONY: test clean: diff --git a/bin/stack b/bin/stack index 0cf2d0c09..a8d4d4f76 100755 --- a/bin/stack +++ b/bin/stack @@ -87,6 +87,12 @@ export USER_GID=$(id -g) export USER_NAME=$(id -un) export PWD="$(pwd)" +if [[ "${PHP_VERSION}" =~ ^(5.6|7.0|7.1|7.2|7.3)$ ]]; then + export WORDPRESS_VERSION=5 +else + export WORDPRESS_VERSION=6 +fi + # If the current architecture is arm64, use the arm64v8 images. if [ "$(arch)" = "arm64" ]; then export DOCKER_CHROME_IMAGE="seleniarm/standalone-chromium:116.0-20230828" @@ -154,10 +160,10 @@ function ensure_wordpress_scaffolded() { function run_wp_cli_command() { docker run --rm -v "${PWD}/var/wordpress:/var/www/html" \ - --network "wpbrowser_php_${PHP_VERSION}" \ + --network "wpbrowser_v3" \ -w /var/www/html \ -u "${USER_UID}:${USER_GID}" \ - "lucatume/wp-browser-v3-build:php${PHP_VERSION}-apache" \ + "lucatume/wp-browser-v3-wordpress:php5.6-apache" \ wp --allow-root --url=http://wordpress.test --path=/var/www/html "$@" } @@ -175,10 +181,10 @@ function ensure_wordpress_configured() { # If the var/wordpress/wp-config.php file is not found, configure WordPress using wp-cli. # Configure WordPress using wp-cli. if ! docker run --rm -v "${PWD}/var/wordpress:/var/www/html" \ - --network "wpbrowser_php_${PHP_VERSION}" \ + --network "wpbrowser_v3" \ -w /var/www/html \ -u "${USER_UID}:${USER_GID}" \ - "lucatume/wp-browser-v3-build:php${PHP_VERSION}-apache" \ + "lucatume/wp-browser-v3-wordpress:php5.6-apache" \ bash -c "wp --allow-root core config --dbname=wordpress --dbuser=root --dbpass=password --dbhost=database --dbprefix=wp_ --extra-php <canary = true; - } + public function _before() { + $this->canary = true; + } - public function _after() - { - self::$staticCanary = false; - } + public function _after() { + self::$staticCanary = false; + } - public static function tearDownAfterClass() - { - parent::tearDownAfterClass(); - Assert::assertFalse(self::$staticCanary); - } + public static function wpTearDownAfterClass() { + Assert::assertFalse( self::$staticCanary ); + } - public function test_before_method_is_loaded() - { - $this->assertTrue($this->canary); - } + public function test_before_method_is_loaded() { + $this->assertTrue( $this->canary ); + } }