diff --git a/.drone.jsonnet b/.drone.jsonnet index 1f673b5f..53c7d85b 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -18,21 +18,13 @@ local Pipeline(php_version, wp_version) = tags: true } }, - { - name: "install deps", - image: "quay.io/presslabs/build:latest", - environment: { - WP_CORE_DIR: "/workspace/presslabs/toplytics/wordpress", - WP_TEST_DIR: "/workspace/presslabs/toplytics/wordpress-test-lib", - }, - commands: [ - // install build deps - "make build.tools", - ], - }, { name: "test", image: "docker.io/presslabs/php-runtime:%s" % php_version, + user: "root", + environment: { + WORDPRESS_TEST_DB_HOST: "database" + }, commands: [ "make test WP_VERSION=%s" % wp_version, ], diff --git a/.drone.yml b/.drone.yml index ad9ee2ad..2f969897 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,17 +19,13 @@ steps: settings: depth: 0 tags: true -- commands: - - make build.tools - environment: - WP_CORE_DIR: /workspace/presslabs/toplytics/wordpress - WP_TEST_DIR: /workspace/presslabs/toplytics/wordpress-test-lib - image: quay.io/presslabs/build:latest - name: install deps - commands: - make test WP_VERSION=6.0.1 + environment: + WORDPRESS_TEST_DB_HOST: database image: docker.io/presslabs/php-runtime:8.0 name: test + user: root - commands: - /usr/local/bin/setup-credentials-helper.sh group: publish diff --git a/Makefile b/Makefile index fa707458..44365abc 100644 --- a/Makefile +++ b/Makefile @@ -7,4 +7,7 @@ include build/makelib/common.mk include build/makelib/wordpress.mk include build/makelib/php.mk -.php.test.init: $(WP_TESTS_DIR)/src/wp-includes/version.php $(WP_TESTS_DIR)/includes $(WP_TESTS_DIR)/data +.php.test.init: $(WP_TESTS_DIR)/wp-tests-config.php $(WP_TESTS_DIR)/includes $(WP_TESTS_DIR)/data + @composer install --no-dev --no-interaction || $(FAIL) + @mv vendor src/ + @composer install --no-interaction || $(FAIL) diff --git a/composer.json b/composer.json index 6e154651..3543038f 100755 --- a/composer.json +++ b/composer.json @@ -15,8 +15,8 @@ } ], "require": { - "php": "~7.0", - "google/apiclient": "^2.10" + "php": ">=7.4 <=8.1", + "google/apiclient": "^2.12" }, "require-dev": { "phpunit/phpunit": "<8", diff --git a/composer.lock b/composer.lock index 1f7d523f..68884345 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a7c435b9fe9d0f451365118047f818bb", + "content-hash": "93e261bd896a0a6f14fc3bafb5fd6df6", "packages": [ { "name": "firebase/php-jwt", @@ -2948,7 +2948,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "~7.0" + "php": ">=7.4 <=8.1" }, "platform-dev": [], "plugin-api-version": "2.3.0" diff --git a/tests/bootstrap.php b/tests/bootstrap.php index f6e0e1dc..8cce7254 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -29,7 +29,7 @@ * Manually load the plugin being tested. */ function _manually_load_plugin() { - require dirname( dirname( __FILE__ ) ) . '/testtest.php'; + require dirname( dirname( __FILE__ ) ) . '/src/toplytics.php'; } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); diff --git a/tests/wp-tests-config.php b/tests/wp-tests-config.php index 4efbc00f..a7c0404e 100644 --- a/tests/wp-tests-config.php +++ b/tests/wp-tests-config.php @@ -37,13 +37,12 @@ * DO NOT use a production database or one that is shared with something else. */ -define( 'DB_NAME', 'wordpress_test' ); -define( 'DB_USER', 'wordpress' ); -define( 'DB_PASSWORD', 'wordpress' ); -define( 'DB_HOST', 'localhost' ); +define( 'DB_HOST', getenv('WORDPRESS_TEST_DB_HOST', true) ?: '127.0.0.1' ); +define( 'DB_NAME', getenv('WORDPRESS_TEST_DB_NAME', true) ?: 'wordpress_test' ); +define( 'DB_USER', getenv('WORDPRESS_TEST_DB_USER', true) ?: 'wordpress' ); +define( 'DB_PASSWORD', getenv('WORDPRESS_TEST_DB_PASSWORD') ?: 'wordpress' ); define( 'DB_CHARSET', 'utf8' ); define( 'DB_COLLATE', '' ); - /**#@+ * Authentication Unique Keys and Salts. *