Improve mcp server
CRUD functionality
#82
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Testing | |
on: | |
pull_request: | |
branches: | |
- main | |
- master | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
behat: | |
name: Functional / PHP ${{ matrix.php }} | |
strategy: | |
matrix: | |
php: ['8.2'] | |
wp: ['latest'] | |
coverage: [true] | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:8 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
MYSQL_DATABASE: wp_cli_test | |
MYSQL_USER: wp_cli_test | |
MYSQL_PASSWORD: password1 | |
MYSQL_HOST: 127.0.0.1 | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
tools: composer | |
- name: Install composer packages | |
run: composer install | |
- name: Check Behat environment | |
env: | |
WP_VERSION: '${{ matrix.wp }}' | |
WP_CLI_TEST_DBUSER: wp_cli_test | |
WP_CLI_TEST_DBPASS: password1 | |
WP_CLI_TEST_DBNAME: wp_cli_test | |
WP_CLI_TEST_DBHOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }} | |
run: WP_CLI_TEST_DEBUG_BEHAT_ENV=1 composer behat | |
- name: Run Behat | |
env: | |
WP_VERSION: '${{ matrix.wp }}' | |
WP_CLI_TEST_DBUSER: wp_cli_test | |
WP_CLI_TEST_DBPASS: password1 | |
WP_CLI_TEST_DBNAME: wp_cli_test | |
WP_CLI_TEST_DBHOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }} | |
WP_CLI_TEST_COVERAGE: ${{ matrix.coverage }} | |
run: | | |
ARGS=() | |
if [[ $WP_CLI_TEST_COVERAGE == 'true' ]]; then | |
ARGS+=("--xdebug") | |
fi | |
if [[ $RUNNER_DEBUG == '1' ]]; then | |
ARGS+=("--format=pretty") | |
fi | |
composer behat -- "${ARGS[@]}" || composer behat-rerun -- "${ARGS[@]}" | |
- name: Retrieve list of coverage files | |
id: coverage_files | |
if: ${{ matrix.coverage }} | |
run: | | |
FILES=$(find "$GITHUB_WORKSPACE/build/logs" -path '*.*' | paste -s -d "," -) | |
echo "files=$FILES" >> $GITHUB_OUTPUT | |
- name: Upload code coverage report | |
if: ${{ matrix.coverage }} | |
uses: codecov/codecov-action@v5.4.0 | |
with: | |
# Because somehow providing `directory: build/logs` doesn't work for these files | |
files: ${{ steps.coverage_files.outputs.files }} | |
flags: feature | |
token: ${{ secrets.CODECOV_TOKEN }} | |
unit: #----------------------------------------------------------------------- | |
name: Unit test / PHP ${{ matrix.php }} | |
strategy: | |
matrix: | |
php: [ '8.2' ] | |
coverage: [ false ] | |
include: | |
- php: '8.3' | |
coverage: true | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Set up PHP environment | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '${{ matrix.php }}' | |
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | |
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }} | |
tools: composer,cs2pr | |
- name: Install Composer dependencies & cache dependencies | |
uses: ramsey/composer-install@v3 | |
env: | |
COMPOSER_ROOT_VERSION: dev-${{ github.event.repository.default_branch }} | |
with: | |
# Bust the cache at least once a month - output format: YYYY-MM. | |
custom-cache-suffix: $(date -u "+%Y-%m") | |
- name: Grab PHPUnit version | |
id: phpunit_version | |
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT | |
# PHPUnit 10 may fail a test run when the "old" configuration format is used. | |
# Luckily, there is a build-in migration tool since PHPUnit 9.3. | |
- name: Migrate PHPUnit configuration for PHPUnit 10+ | |
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }} | |
continue-on-error: true | |
run: composer phpunit -- --migrate-configuration | |
- name: Setup problem matcher to provide annotations for PHPUnit | |
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Run PHPUnit | |
run: | | |
if [[ ${{ matrix.coverage == true }} == true ]]; then | |
composer phpunit -- --coverage-clover build/logs/unit-coverage.xml | |
else | |
composer phpunit | |
fi | |
- name: Upload code coverage report | |
if: ${{ matrix.coverage }} | |
uses: codecov/codecov-action@v5.4.0 | |
with: | |
directory: build/logs | |
flags: unit | |
token: ${{ secrets.CODECOV_TOKEN }} |