🎉 Howdy #22
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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.2 | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/composer-cache | |
| key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Run linting | |
| run: composer lint-check | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| php-version: [8.2, 8.3] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| coverage: none | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/composer-cache | |
| key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Run PHPUnit tests | |
| run: composer test | |
| integration-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.2 | |
| coverage: none | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Install wp-env | |
| run: npm install -g @wordpress/env | |
| - name: Start WordPress environment | |
| run: npx wp-env start | |
| - name: Wait for WordPress | |
| run: | | |
| timeout 60 bash -c 'until curl -f http://localhost:8889 > /dev/null 2>&1; do sleep 2; done' | |
| - name: Run WP-CLI integration tests | |
| run: composer test-wp-cli | |
| e2e-tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.2 | |
| coverage: none | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Install wp-env and Playwright | |
| run: | | |
| npm install -g @wordpress/env | |
| npm install @playwright/test | |
| - name: Install Playwright browsers | |
| run: npx playwright install chromium | |
| - name: Start WordPress environment | |
| run: npx wp-env start | |
| - name: Wait for WordPress | |
| run: | | |
| timeout 60 bash -c 'until curl -f http://localhost:8889 > /dev/null 2>&1; do sleep 2; done' | |
| - name: Run E2E tests | |
| run: composer test-e2e | |
| - name: Upload E2E test results | |
| uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: playwright-report | |
| path: test-results/ | |
| retention-days: 7 |