Fixed #138 Added PHP-Scoper to build to prevent dependency conflicts. #75
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: Unit Tests | |
| # Since Unit Tests are required to pass for each PR, | |
| # we cannot disable them for documentation-only changes. | |
| on: | |
| pull_request: | |
| push: | |
| # Allow manually triggering the workflow. | |
| workflow_dispatch: | |
| # Cancels all previous workflow runs for pull requests that have not completed. | |
| concurrency: | |
| # The concurrency group contains the workflow name and the branch name for pull requests | |
| # or the commit hash for any other events. | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-php: | |
| name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: | |
| - '8.1' | |
| - '8.2' | |
| - '8.3' | |
| - '8.4' | |
| - '8.5' | |
| wordpress: | |
| - '6.5' | |
| - '6.7' | |
| - '6.8' | |
| env: | |
| WP_ENV_PHP_VERSION: ${{ matrix.php }} | |
| WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }} | |
| steps: | |
| - uses: actions/checkout@v5.0.0 | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Install PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: curl | |
| - name: Install PHP Dependencies | |
| run: composer install --no-interaction --no-progress --no-suggest --optimize-autoloader | |
| - name: Docker debug information | |
| run: | | |
| docker -v | |
| - name: General debug information | |
| run: | | |
| npm --version | |
| node --version | |
| php --version | |
| curl --version | |
| git --version | |
| locale -a | |
| echo "PHP version: ${WP_ENV_PHP_VERSION}" | |
| echo "WordPress version: ${WP_ENV_CORE}" | |
| - name: Start Docker environment | |
| run: npm run wp-env start | |
| - name: Log running Docker containers | |
| run: docker ps -a | |
| - name: Running unit tests | |
| run: | | |
| set -o pipefail | |
| npm run test | |
| # ------------------------------------------------ # | |
| # Build Plugin and Run Tests on Built Distribution # | |
| # ------------------------------------------------ # | |
| - name: Stop Docker environment | |
| # Remove this check when https://github.com/humbug/php-scoper/issues/1139 is resolved. | |
| if: matrix.php != '8.5' | |
| run: npm run wp-env stop | |
| - name: Build Plugin | |
| if: matrix.php != '8.5' | |
| run: bin/build.sh | |
| - name: Copy Test Files | |
| if: matrix.php != '8.5' | |
| run: | | |
| cp .wp-env.json dist/.wp-env.json | |
| cp package.json dist/package.json | |
| cp package-lock.json dist/package-lock.json | |
| cp phpcs.xml dist/phpcs.xml | |
| cp phpunit.xml dist/phpunit.xml | |
| cp -r tests dist/tests | |
| - name: Install Dist Composer Dependencies | |
| if: matrix.php != '8.5' | |
| working-directory: dist | |
| run: composer install --no-interaction --no-progress --no-suggest --optimize-autoloader | |
| - name: Start Dist Docker environment | |
| if: matrix.php != '8.5' | |
| working-directory: dist | |
| run: npm run wp-env start | |
| - name: Log running Dist Docker containers | |
| if: matrix.php != '8.5' | |
| working-directory: dist | |
| run: docker ps -a | |
| - name: Running Dist unit tests | |
| if: matrix.php != '8.5' | |
| working-directory: dist | |
| # We don't run phpcs here because the dist files are modified by the build script. | |
| run: | | |
| set -o pipefail | |
| npm run test:php |