From e7a9f205e216b6fb44482c0640a2842e26d16a89 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 13:10:30 -0800 Subject: [PATCH 01/25] update: require-dev dependencies --- composer.json | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2e8f07a..023f649 100644 --- a/composer.json +++ b/composer.json @@ -22,11 +22,18 @@ }, "require-dev": { "composer/installers": "^1.9", - "johnpbloch/wordpress": "^5.4", + "johnpbloch/wordpress": "^6.1", "wp-graphql/wp-graphql": "^1.1.8", "squizlabs/php_codesniffer": "^3.5", "automattic/vipwpcs": "^2.3", - "wp-coding-standards/wpcs": "^2.3" + "wp-coding-standards/wpcs": "^2.3", + "wp-phpunit/wp-phpunit": "^6.3", + "yoast/phpunit-polyfills": "^2.0", + "phpunit/phpunit": "^9.6", + "codeception/module-asserts": "*", + "codeception/util-universalframework": "*", + "codeception/module-rest": "*", + "lucatume/wp-browser": "^3.1" }, "scripts": { "cli": "docker-compose run --rm --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase --user $(id -u) wordpress wait_for_it $TEST_DB -s -t 300 --", From 38cd7806c67a7431890ae0b44fca06ae7d7b5ecb Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 13:10:58 -0800 Subject: [PATCH 02/25] update: README and .md formatting via .prettierrc --- .prettierrc | 4 ++++ README.md | 57 ++++++++++++++++++++++++++++++++++++++++------- docker/Dockerfile | 2 +- 3 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a68a6f4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "printWidth": 80, + "proseWrap": "always" +} diff --git a/README.md b/README.md index 52dcc27..c6119cc 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,56 @@ # WPGraphQL TestCase -![continuous_integration](https://github.com/wp-graphql/wp-graphql-testcase/workflows/continuous_integration/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/wp-graphql/wp-graphql-testcase/badge.svg)](https://coveralls.io/github/wp-graphql/wp-graphql-testcase) -Is a library of tools for testing WPGraphQL APIs, designed for both WPGraphQL and WPGraphQL extension development. Currently the library only consisted of a Codeception Testcase built on top wp-browser's WPTestCase class. +![continuous_integration](https://github.com/wp-graphql/wp-graphql-testcase/workflows/continuous_integration/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/wp-graphql/wp-graphql-testcase/badge.svg)](https://coveralls.io/github/wp-graphql/wp-graphql-testcase) + +Is a library of tools for testing WPGraphQL APIs, designed for both WPGraphQL +and WPGraphQL extension development. Currently the library only consisted of a +Codeception Testcase built on top wp-browser's WPTestCase class. ## Installing -1. Run `composer require wp-graphql/wp-graphql-testcase` from your project directory in the terminal. -2. _(Optionally: Codeception only)_ If your didn't already have codeception installed in the project, run `vendor/bin/codecept init wpbrowser`. -3. To make a test case generate a with `vendor/bin/codecept generate:wpunit wpunit TestName`. Then just change the extending class to `\Tests\WPGraphQL\TestCase\WPGraphQLTestCase` :man_shrugging: -## Going forward -There are plans to add more to this library, and contribution are greatly appreciated :pray:. +1. Run `composer require wp-graphql/wp-graphql-testcase` from your project + directory in the terminal. + +## Codeception Only + +1. If your didn't already have codeception installed in the project, run + `vendor/bin/codecept init wpbrowser`. +2. To make a test case generate a with + `vendor/bin/codecept generate:wpunit wpunit TestName`. Then just change the + extending class to `\Tests\WPGraphQL\TestCase\WPGraphQLTestCase` + :man_shrugging: + +## Going Forward + +There are plans to add more to this library, and contribution are greatly +appreciated :pray:. + +## Contributing + +To contribute, fork this repository and open a PR with your requested changes +back into the main repository. + +### Local Development + +To develop locally, you need to have Docker and Composer installed. + +#### Composer Setup + +To ensure you have the necessary local dependencies, first run +`composer install`. + +#### Docker Setup + +This project currently uses a `docker-compose.yml` v2 file. To spin this up, run +`docker-compose up -d`. + +#### Local Tests + +To run the local tests, use `composer run-phpunit` or +`composer run-codeception`. You should see the tests pass with output generated +in the terminal. ## Contributors - \ No newline at end of file + + diff --git a/docker/Dockerfile b/docker/Dockerfile index 763d1f5..286de44 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -19,7 +19,7 @@ RUN pecl install "xdebug-${XDEBUG_VERSION}"; \ # Install PDO MySQL driver. RUN docker-php-ext-install \ - pdo_mysql + pdo_mysql ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /usr/local/bin/wait_for_it RUN chmod 755 /usr/local/bin/wait_for_it \ No newline at end of file From a45a12ec2851ada4cd3c2a4d99d7e18e420bdf17 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 13:23:23 -0800 Subject: [PATCH 03/25] update: add workflow_dispatch to test --- .github/workflows/continous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 8fe41b9..e86f722 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -1,6 +1,7 @@ name: continuous_integration on: + workflow_dispatch: schedule: - cron: '0 4 * * 5' push: From 437ec5d13c4026a5eabcf26696302da35cc73751 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:07:20 -0800 Subject: [PATCH 04/25] update: test different composer install --- .github/workflows/continous-integration.yml | 22 ++++----------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index e86f722..0cb4c5b 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -3,7 +3,7 @@ name: continuous_integration on: workflow_dispatch: schedule: - - cron: '0 4 * * 5' + - cron: "0 4 * * 5" push: branches: - master @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '7.3', '7.4', '8.0' ] + php: ["7.3", "7.4", "8.0"] fail-fast: false name: Make sure that the WPGraphQLTestCase works!!! steps: @@ -30,27 +30,13 @@ jobs: php-version: ${{ matrix.php }} extensions: json, mbstring - - name: Install Codeception dependencies - run: | - composer install --ignore-platform-reqs - composer require codeception/module-asserts:* \ - codeception/util-universalframework:* \ - codeception/module-rest:* \ - lucatume/wp-browser:^3.1 --ignore-platform-reqs + - name: Install Dependencies + run: composer install - name: Run Codeception Tests w/ Docker. run: composer run-codeception -- -- --coverage --coverage-xml - - name: Install PHPUnit dependencies - if: ${{ matrix.php != '8.0' }} - run: | - composer require wp-phpunit/wp-phpunit \ - yoast/phpunit-polyfills \ - phpunit/phpunit - composer install - - name: Run PHPUnit Tests w/ Docker. - if: ${{ matrix.php != '8.0' }} run: composer run-phpunit -- -- --coverage-text - name: Push Codecoverage to Coveralls.io From 568494f295e295353ab6e2d9b18f108acb5fcb4a Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:13:21 -0800 Subject: [PATCH 05/25] update: load .env.testing file --- .github/workflows/continous-integration.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 0cb4c5b..a1619ac 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -20,10 +20,16 @@ jobs: php: ["7.3", "7.4", "8.0"] fail-fast: false name: Make sure that the WPGraphQLTestCase works!!! + steps: - name: Checkout uses: actions/checkout@v2 + - name: Load .env.testing file + uses: falti/dotenv-action@v2 + with: + path: .env.testing + - name: Install PHP uses: shivammathur/setup-php@v2 with: From 887144574028218a72498559d3b11b87da55a251 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:14:35 -0800 Subject: [PATCH 06/25] fix: remove version number --- .github/workflows/continous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index a1619ac..560a7a0 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -31,7 +31,7 @@ jobs: path: .env.testing - name: Install PHP - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php with: php-version: ${{ matrix.php }} extensions: json, mbstring From cae4813149037c83b0d0c304fde2576b36220c18 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:21:53 -0800 Subject: [PATCH 07/25] update: import .env.testing values --- .github/workflows/continous-integration.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 560a7a0..c25b694 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -25,13 +25,12 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Load .env.testing file - uses: falti/dotenv-action@v2 - with: - path: .env.testing + - name: Import environment variables from .env.testing + shell: bash + run: cat .env.testing >> $GITHUB_ENV - name: Install PHP - uses: shivammathur/setup-php + uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} extensions: json, mbstring From 4ab13547f45f9d010ee0c4113fc2731d00dd8181 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:33:13 -0800 Subject: [PATCH 08/25] fix: use global --- local/config/wp-tests-config.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/local/config/wp-tests-config.php b/local/config/wp-tests-config.php index 4c21a3e..cfdaf57 100644 --- a/local/config/wp-tests-config.php +++ b/local/config/wp-tests-config.php @@ -15,6 +15,8 @@ define( 'DB_CHARSET', 'utf8' ); define( 'DB_COLLATE', '' ); +global $table_prefix; + $table_prefix = 'wptests_'; define( 'WP_TESTS_DOMAIN', 'example.org' ); From ed6dc11e7f291a9f6a48ee926ed6a2baa0f41198 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:44:21 -0800 Subject: [PATCH 09/25] fix: spin up/down docker-compose before tests --- .github/workflows/continous-integration.yml | 11 +++++++---- local/config/wp-tests-config.php | 2 -- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index c25b694..beda571 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -25,16 +25,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Import environment variables from .env.testing - shell: bash - run: cat .env.testing >> $GITHUB_ENV - - name: Install PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} extensions: json, mbstring + - name: Spin up Docker + run: docker-compose up -d + - name: Install Dependencies run: composer install @@ -55,3 +54,7 @@ jobs: -e COVERALLS_RUN_LOCALLY=1 -e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \ wordpress \ vendor/bin/php-coveralls -v + + - name: Spin down Docker + if: always() + run: docker-compose down diff --git a/local/config/wp-tests-config.php b/local/config/wp-tests-config.php index cfdaf57..4c21a3e 100644 --- a/local/config/wp-tests-config.php +++ b/local/config/wp-tests-config.php @@ -15,8 +15,6 @@ define( 'DB_CHARSET', 'utf8' ); define( 'DB_COLLATE', '' ); -global $table_prefix; - $table_prefix = 'wptests_'; define( 'WP_TESTS_DOMAIN', 'example.org' ); From e8014dbbae56415a80fbf2faefb7c7b49e5cb7ea Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:46:29 -0800 Subject: [PATCH 10/25] fix: move docker step to fix permission issue --- .github/workflows/continous-integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index beda571..1ad0691 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -31,12 +31,12 @@ jobs: php-version: ${{ matrix.php }} extensions: json, mbstring - - name: Spin up Docker - run: docker-compose up -d - - name: Install Dependencies run: composer install + - name: Spin up Docker + run: docker-compose up -d + - name: Run Codeception Tests w/ Docker. run: composer run-codeception -- -- --coverage --coverage-xml From 8cb0591390aea3e701a3a280e483e9f09e2781e2 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:48:44 -0800 Subject: [PATCH 11/25] test: run phpunit only --- .github/workflows/continous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 1ad0691..bca7f4a 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -37,8 +37,8 @@ jobs: - name: Spin up Docker run: docker-compose up -d - - name: Run Codeception Tests w/ Docker. - run: composer run-codeception -- -- --coverage --coverage-xml + # - name: Run Codeception Tests w/ Docker. + # run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. run: composer run-phpunit -- -- --coverage-text From 4d153f7b1ed63d2ab74b07f08b14cca2c2c2b25a Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 14:53:46 -0800 Subject: [PATCH 12/25] test: remove docker steps --- .github/workflows/continous-integration.yml | 29 ++++++++------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index bca7f4a..fa17fd0 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -34,27 +34,20 @@ jobs: - name: Install Dependencies run: composer install - - name: Spin up Docker - run: docker-compose up -d - # - name: Run Codeception Tests w/ Docker. # run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. run: composer run-phpunit -- -- --coverage-text - - name: Push Codecoverage to Coveralls.io - env: - COVERALLS_RUN_LOCALLY: 1 - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - run: | - docker-compose run --rm \ - --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase \ - --user $(id -u) \ - -e COVERALLS_RUN_LOCALLY=1 -e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \ - wordpress \ - vendor/bin/php-coveralls -v - - - name: Spin down Docker - if: always() - run: docker-compose down + # - name: Push Codecoverage to Coveralls.io + # env: + # COVERALLS_RUN_LOCALLY: 1 + # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + # run: | + # docker-compose run --rm \ + # --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase \ + # --user $(id -u) \ + # -e COVERALLS_RUN_LOCALLY=1 -e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \ + # wordpress \ + # vendor/bin/php-coveralls -v From 42cb4f6c93b53a6cbbca64e28a279c1da178f33a Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 15:20:30 -0800 Subject: [PATCH 13/25] test: use mysql_phpunit for codeception --- .github/workflows/continous-integration.yml | 4 ++-- composer.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index fa17fd0..56922a9 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -34,8 +34,8 @@ jobs: - name: Install Dependencies run: composer install - # - name: Run Codeception Tests w/ Docker. - # run: composer run-codeception -- -- --coverage --coverage-xml + - name: Run Codeception Tests w/ Docker. + run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. run: composer run-phpunit -- -- --coverage-text diff --git a/composer.json b/composer.json index 023f649..7e437e7 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "cli": "docker-compose run --rm --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase --user $(id -u) wordpress wait_for_it $TEST_DB -s -t 300 --", "codeception": "codecept run wpunit --", "phpunit": "phpunit --", - "run-codeception": "env TEST_DB=mysql:3306 composer cli vendor/bin/codecept run wpunit", + "run-codeception": "env TEST_DB=mysql_phpunit:3306 composer cli vendor/bin/codecept run wpunit", "run-phpunit": "env TEST_DB=mysql_phpunit:3306 composer cli vendor/bin/phpunit" }, "extra": { From ba5a52ee46f8b96bbf9ab839ee350b54fffdf361 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 15:44:21 -0800 Subject: [PATCH 14/25] test: limit codeception test to php 8 --- .github/workflows/continous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 56922a9..927ede8 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -35,6 +35,7 @@ jobs: run: composer install - name: Run Codeception Tests w/ Docker. + if: ${{ matrix.php == '8.0' }} run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. From be288d30142afab123ad444dd7768bf48b10ee7c Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 15:56:32 -0800 Subject: [PATCH 15/25] test: more PHP versions --- .github/workflows/continous-integration.yml | 35 ++++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 927ede8..6dafc7d 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -2,6 +2,11 @@ name: continuous_integration on: workflow_dispatch: + inputs: + push-coverage: + description: "Boolean flag to turn on/off the coveralls.io step" + required: false + default: "false" schedule: - cron: "0 4 * * 5" push: @@ -17,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ["7.3", "7.4", "8.0"] + php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] fail-fast: false name: Make sure that the WPGraphQLTestCase works!!! @@ -35,20 +40,26 @@ jobs: run: composer install - name: Run Codeception Tests w/ Docker. + # Codeception requires PHP version >= 8.0 + # See: + # https://github.com/Codeception/module-asserts + # https://packagist.org/packages/codeception/util-universalframework + # https://github.com/Codeception/module-rest if: ${{ matrix.php == '8.0' }} run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. run: composer run-phpunit -- -- --coverage-text - # - name: Push Codecoverage to Coveralls.io - # env: - # COVERALLS_RUN_LOCALLY: 1 - # COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} - # run: | - # docker-compose run --rm \ - # --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase \ - # --user $(id -u) \ - # -e COVERALLS_RUN_LOCALLY=1 -e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \ - # wordpress \ - # vendor/bin/php-coveralls -v + - name: Push Codecoverage to Coveralls.io + if: ${{ github.event.inputs.push-coverage == 'true' }} + env: + COVERALLS_RUN_LOCALLY: 1 + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + docker-compose run --rm \ + --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase \ + --user $(id -u) \ + -e COVERALLS_RUN_LOCALLY=1 -e COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN \ + wordpress \ + vendor/bin/php-coveralls -v From f1dc6315b61ea1a625b0afe91f49ae2689ed5e68 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 28 Feb 2024 16:02:14 -0800 Subject: [PATCH 16/25] update: use >=8.0 for codeception --- .github/workflows/continous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 6dafc7d..e3efb7c 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -45,7 +45,7 @@ jobs: # https://github.com/Codeception/module-asserts # https://packagist.org/packages/codeception/util-universalframework # https://github.com/Codeception/module-rest - if: ${{ matrix.php == '8.0' }} + if: ${{ matrix.php >= '8.0' }} run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. From 59ff12fa2c0229cafb7efafe8b9527945c1f6285 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 29 Feb 2024 06:43:38 -0800 Subject: [PATCH 17/25] update: remove EOL PHP versions --- .github/workflows/continous-integration.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index e3efb7c..94eb1e5 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3"] + php: ["8.1", "8.2", "8.3"] fail-fast: false name: Make sure that the WPGraphQLTestCase works!!! @@ -40,12 +40,6 @@ jobs: run: composer install - name: Run Codeception Tests w/ Docker. - # Codeception requires PHP version >= 8.0 - # See: - # https://github.com/Codeception/module-asserts - # https://packagist.org/packages/codeception/util-universalframework - # https://github.com/Codeception/module-rest - if: ${{ matrix.php >= '8.0' }} run: composer run-codeception -- -- --coverage --coverage-xml - name: Run PHPUnit Tests w/ Docker. From ade41c8b0c7a20cbd6cbb74e05f5c8264d59324f Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 29 Feb 2024 06:44:16 -0800 Subject: [PATCH 18/25] update: revert same DB change for test DB --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7e437e7..023f649 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "cli": "docker-compose run --rm --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase --user $(id -u) wordpress wait_for_it $TEST_DB -s -t 300 --", "codeception": "codecept run wpunit --", "phpunit": "phpunit --", - "run-codeception": "env TEST_DB=mysql_phpunit:3306 composer cli vendor/bin/codecept run wpunit", + "run-codeception": "env TEST_DB=mysql:3306 composer cli vendor/bin/codecept run wpunit", "run-phpunit": "env TEST_DB=mysql_phpunit:3306 composer cli vendor/bin/phpunit" }, "extra": { From 6e5be63db288ee81ede36d8d9c7d2472c3fed302 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 29 Feb 2024 06:48:21 -0800 Subject: [PATCH 19/25] update: default coveralls to true --- .github/workflows/continous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 94eb1e5..7238c12 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -6,7 +6,7 @@ on: push-coverage: description: "Boolean flag to turn on/off the coveralls.io step" required: false - default: "false" + default: "true" schedule: - cron: "0 4 * * 5" push: From 078e27596fdbb9fbdd51f2c7e431ccdfb3f50cf8 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 29 Feb 2024 06:51:20 -0800 Subject: [PATCH 20/25] update: remove boolean flag for coverage --- .github/workflows/continous-integration.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 7238c12..e7e9dac 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -2,11 +2,6 @@ name: continuous_integration on: workflow_dispatch: - inputs: - push-coverage: - description: "Boolean flag to turn on/off the coveralls.io step" - required: false - default: "true" schedule: - cron: "0 4 * * 5" push: @@ -46,7 +41,6 @@ jobs: run: composer run-phpunit -- -- --coverage-text - name: Push Codecoverage to Coveralls.io - if: ${{ github.event.inputs.push-coverage == 'true' }} env: COVERALLS_RUN_LOCALLY: 1 COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} From cf7568f6edae72cdea8bfdd9fa79a4347dc68c7e Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 29 Feb 2024 07:41:04 -0800 Subject: [PATCH 21/25] update: coveralls dependency version --- README.md | 7 +++++++ composer.json | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c6119cc..95cdbe3 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,13 @@ To run the local tests, use `composer run-phpunit` or `composer run-codeception`. You should see the tests pass with output generated in the terminal. +#### Test Coverage + +The CI process uses [coveralls.io](https://coveralls.io/) to store coverage +reports. This is available for free for open-source projects, and is required to +run the CI process. Sign up for free and add your `COVERALLS_REPO_TOKEN` value +to GitHub Actions secrets. + ## Contributors diff --git a/composer.json b/composer.json index 023f649..0370c6a 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "codeception/module-asserts": "*", "codeception/util-universalframework": "*", "codeception/module-rest": "*", - "lucatume/wp-browser": "^3.1" + "lucatume/wp-browser": "^3.1", + "php-coveralls/php-coveralls": "2.4.3" }, "scripts": { "cli": "docker-compose run --rm --workdir=/var/www/html/wp-content/plugins/wp-graphql-testcase --user $(id -u) wordpress wait_for_it $TEST_DB -s -t 300 --", From 3bd1ebf8c7a23cf1dd246da1c3552805d2ce7802 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 7 Mar 2024 12:50:51 -0800 Subject: [PATCH 22/25] Update .github/workflows/continous-integration.yml Co-authored-by: Geoff Taylor --- .github/workflows/continous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index e7e9dac..fc4a98b 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: schedule: - cron: "0 4 * * 5" - push: + [push, pull_request]: branches: - master - develop From cc1877eccf21fa1779940d540f0a6f635f36f505 Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 7 Mar 2024 12:51:26 -0800 Subject: [PATCH 23/25] Update .github/workflows/continous-integration.yml Co-authored-by: Geoff Taylor --- .github/workflows/continous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index fc4a98b..8b4acab 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -8,6 +8,7 @@ on: branches: - master - develop + - develop pull_request: branches: - develop From d799f0768eb954207311e28420d3a7d97da96a1b Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Thu, 7 Mar 2024 12:54:58 -0800 Subject: [PATCH 24/25] update: remove duplicate develop entry --- .github/workflows/continous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 8b4acab..00b7ba8 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -4,13 +4,13 @@ on: workflow_dispatch: schedule: - cron: "0 4 * * 5" - [push, pull_request]: + push: branches: - master - develop - - develop pull_request: branches: + - master - develop jobs: From df329e8dbe77bebfa77c221bafc11208195a198d Mon Sep 17 00:00:00 2001 From: Michael Dinerstein Date: Wed, 10 Apr 2024 17:19:02 -0700 Subject: [PATCH 25/25] update: README contributors --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 95cdbe3..63a7bbd 100644 --- a/README.md +++ b/README.md @@ -60,4 +60,7 @@ to GitHub Actions secrets. ## Contributors - +

+ + +