Release 2.0.0-beta3 [skip changelog] #131
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: [ master, 1.x ] | |
| pull_request: | |
| branches: [ master, 1.x ] | |
| # Least privilege by default rather than whatever the repository setting happens to | |
| # be. Nothing here writes to the repo or calls the API; both jobs only need the | |
| # checkout. Fork pull requests already get a read-only token, so this closes the | |
| # same-repo branch-push case. | |
| permissions: | |
| contents: read | |
| jobs: | |
| php: | |
| name: PHP ${{ matrix.php }} — phpcs + phpunit | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: [ '8.2', '8.4' ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| # install, not update: composer.lock is committed, so this resolves the | |
| # pinned set rather than a fresh one. Without the lockfile `composer | |
| # install` behaves like `composer update` - any newly published version of | |
| # a dev dependency (or of a transitive Composer plugin, which executes code | |
| # at install time) would run in CI on first publish, unreviewed. The JS job | |
| # has always used `npm ci` for exactly this reason. | |
| - name: Install Composer dependencies | |
| run: composer install --no-interaction --no-progress | |
| # Pinning without auditing just freezes known vulnerabilities in place. | |
| - name: Composer security audit | |
| run: composer audit --no-interaction | |
| - name: PHP_CodeSniffer (includes PHP 8.0 compatibility sniffs) | |
| run: vendor/bin/phpcs | |
| - name: PHPUnit | |
| run: vendor/bin/phpunit | |
| # The declared floor is PHP 8.0, but PHPUnit 11 requires >= 8.2, so the suite | |
| # cannot run there - `composer install` fails to resolve before a single test | |
| # executes. What this job can do is parse every file with the real 8.0 parser, | |
| # which catches 8.1+ syntax (enums, readonly, never, first-class callables) | |
| # that would otherwise only be caught by PHPCompatibility's static model of | |
| # 8.0. The model is good; the actual parser is ground truth. No dependencies | |
| # are installed, so phpunit's platform requirement is irrelevant here. | |
| php-floor: | |
| name: PHP 8.0 — syntax check (declared floor) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.0' | |
| coverage: none | |
| # tools/ is not shipped, but it is linted here for a specific reason: the | |
| # upstream-drift job runs tools/generate-phone-table.php on this same 8.0, | |
| # so 8.1+ syntax there would surface as a monthly red build rather than at | |
| # the commit that introduced it. Nothing else in tools/ is PHP today. | |
| - name: Lint every shipped PHP file against the declared floor | |
| run: find duracelltomi-google-tag-manager-for-wordpress.php uninstall.php compat src tools -name '*.php' -print0 | xargs -0 -n1 -P4 php -l | |
| js: | |
| name: JS — build + lint + unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Install npm dependencies | |
| run: npm ci | |
| # The postbuild npm hook runs lint:js automatically after every build. | |
| - name: Build + lint JS | |
| run: npm run build | |
| - name: JS unit tests | |
| run: npm run test:unit |