Merge pull request #1856 from benitoalba/fix/1797-flesch-kincaid-grad… #6523
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: Test | |
| on: | |
| # Run on direct pushes to integration branches and on all pull requests. | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| - master | |
| - trunk | |
| pull_request: | |
| # Allow manually triggering the workflow. | |
| workflow_dispatch: | |
| # Cancels all previous workflow runs for the same branch that have not yet completed. | |
| concurrency: | |
| # The concurrency group contains the workflow name and the branch name. | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| integration: | |
| runs-on: ubuntu-latest | |
| env: | |
| COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - php_version: '8.1' | |
| wp_version: '6.2' | |
| multisite: false | |
| - php_version: '8.1' | |
| wp_version: 'latest' | |
| multisite: false | |
| - php_version: '8.1' | |
| wp_version: 'latest' | |
| multisite: true | |
| - php_version: '8.2' | |
| wp_version: 'latest' | |
| multisite: true | |
| name: "Integration Test: PHP ${{ matrix.php_version }} | WP ${{ matrix.wp_version }}${{ matrix.multisite == true && ' (+ ms)' || '' }}" | |
| # Allow builds to fail on as-of-yet unreleased WordPress versions. | |
| continue-on-error: ${{ matrix.wp_version == 'trunk' }} | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ALLOW_EMPTY_PASSWORD: false | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php_version }} | |
| ini-values: zend.assertions=1, error_reporting=-1, display_errors=On | |
| coverage: none | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Composer to use PAT | |
| run: composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} | |
| # Install dependencies and handle caching in one go. | |
| # @link https://github.com/marketplace/actions/install-composer-dependencies | |
| - name: "Composer: remove the PHP platform requirement" | |
| run: composer config --unset platform.php | |
| - name: "Install Composer dependencies" | |
| uses: ramsey/composer-install@v2 | |
| with: | |
| # Force a `composer update` run. | |
| dependency-versions: "highest" | |
| # But make it selective. | |
| composer-options: "yoast/wp-test-utils --with-dependencies" | |
| # Bust the cache at least once a month - output format: YYYY-MM-DD. | |
| custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-3)) days" "+%F") | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Cache WordPress test library | |
| if: matrix.wp_version != 'latest' | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| /tmp/wordpress-tests-lib | |
| /tmp/wordpress | |
| key: ${{ runner.os }}-wordpress-${{ matrix.wp_version }}-${{ github.run_id }} | |
| restore-keys: | | |
| ${{ runner.os }}-wordpress-${{ matrix.wp_version }}- | |
| # Some images won't have svn available. Install it if that's the case. | |
| - name: Install SVN | |
| run: | | |
| if ! command -v svn &> /dev/null; then | |
| echo "Installing SVN..." | |
| sudo apt-get update --allow-releaseinfo-change || { echo "Failed to update package lists"; exit 1; } | |
| sudo apt-get install -y subversion || { echo "Failed to install SVN"; exit 1; } | |
| else | |
| echo "SVN is already installed" | |
| fi | |
| - name: Install WP | |
| shell: bash | |
| run: tests/bin/install-wp-tests.sh wordpress_tests root '' 127.0.0.1:3306 ${{ matrix.wp_version }} | |
| - name: Run unit tests - single site | |
| run: composer test | |
| - name: Run unit tests - multisite | |
| if: ${{ matrix.multisite == true }} | |
| run: composer test | |
| env: | |
| WP_MULTISITE: 1 |