ci: skip phpcs/phpunit when only workflow files change #21
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: CI | |
| on: | |
| push: | |
| branches: [trunk] | |
| paths: | |
| - '**' | |
| - '!.github/workflows/**' | |
| - '.github/workflows/ci.yml' | |
| pull_request: | |
| paths: | |
| - '**' | |
| - '!.github/workflows/**' | |
| - '.github/workflows/ci.yml' | |
| jobs: | |
| phpcs: | |
| name: PHPCS (WordPress + Docs) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '7.4' | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Cache Composer | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/composer | |
| key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Composer install | |
| run: composer install --no-progress --prefer-dist --no-interaction | |
| - name: Run PHPCS | |
| run: composer run phpcs | |
| phpunit: | |
| name: PHPUnit (integration) | |
| runs-on: ubuntu-latest | |
| env: | |
| WP_CORE_DIR: /tmp/wordpress/src | |
| WP_TESTS_DIR: /tmp/wordpress/tests/phpunit | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=3 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '7.4' | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Install SVN | |
| run: sudo apt-get install -y subversion | |
| - name: Cache Composer | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/composer | |
| key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Composer install | |
| run: composer install --no-progress --prefer-dist --no-interaction | |
| - name: Install WP test environment | |
| run: ./bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 latest | |
| - name: Run PHPUnit | |
| run: composer run test-unit |