Bump staabm/annotate-pull-request-from-checkstyle from 1.8.6 to 1.8.7 #248
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, main] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| static-analysis: | |
| name: Static Analysis (PHPStan + PHPCS) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| tools: composer, cs2pr | |
| coverage: none | |
| - uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: composer-v2-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }} | |
| restore-keys: | | |
| composer-v2-${{ runner.os }}- | |
| - run: composer install --no-interaction --prefer-dist --no-progress | |
| - run: composer audit | |
| - run: vendor/bin/phpstan analyse --no-progress --error-format=checkstyle | cs2pr | |
| - run: vendor/bin/phpcs --report=checkstyle | cs2pr | |
| js-build: | |
| name: JS Build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - run: npm ci | |
| - run: node bin/validate-blueprint.js | |
| - run: npm run build | |
| - run: npm run test:unit | |
| - run: npm audit --audit-level=high --omit=dev | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: build-assets | |
| path: build/ | |
| retention-days: 1 | |
| phpunit: | |
| name: PHPUnit Snapshot Tests (WP ${{ matrix.wp-version }}, PHP ${{ matrix.php-version }}) | |
| runs-on: ubuntu-latest | |
| needs: js-build | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| wp-version: ['6.6', 'latest'] | |
| php-version: ['8.1'] | |
| services: | |
| db: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: wordpress_test | |
| MYSQL_USER: wordpress | |
| MYSQL_PASSWORD: wordpress | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h localhost -u root -proot" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: build-assets | |
| path: build/ | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: mysqli | |
| coverage: xdebug | |
| - uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: composer-v2-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }} | |
| restore-keys: | | |
| composer-v2-${{ runner.os }}- | |
| - run: composer install --no-interaction --prefer-dist --no-progress | |
| - run: bash bin/install-wp-tests.sh wordpress_test wordpress wordpress 127.0.0.1 ${{ matrix.wp-version }} | |
| env: | |
| WP_TESTS_DIR: /tmp/wordpress-tests-lib | |
| - run: vendor/bin/phpunit --coverage-clover=tests/phpunit/coverage/clover.xml | |
| env: | |
| WP_TESTS_DIR: /tmp/wordpress-tests-lib | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: phpunit-coverage-wp-${{ matrix.wp-version }}-php-${{ matrix.php-version }} | |
| path: tests/phpunit/coverage/ | |
| retention-days: 7 | |
| playwright: | |
| name: Playwright Smoke Test (WP ${{ matrix.wp-label }}) | |
| runs-on: ubuntu-latest | |
| needs: js-build | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| include: | |
| - wp-image: wordpress:php8.1-apache | |
| wp-label: latest | |
| - wp-image: wordpress:6.6-php8.1-apache | |
| wp-label: '6.6' | |
| env: | |
| WP_IMAGE: ${{ matrix.wp-image }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: build-assets | |
| path: build/ | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| tools: composer | |
| coverage: none | |
| - name: Install Composer dependencies for container | |
| run: composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist --no-progress | |
| - run: npm ci | |
| - run: npx playwright install chromium --with-deps | |
| - run: docker compose up -d | |
| - name: Wait for WordPress | |
| run: | | |
| until curl -sf http://localhost:8080/wp-login.php > /dev/null; do sleep 3; done | |
| - name: Debug container state | |
| run: | | |
| docker compose ps | |
| docker compose logs wordpress | |
| docker compose logs cli | |
| - run: bash scripts/wp-test-setup.sh | |
| env: | |
| MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }} | |
| MAPBOX_STYLE_URL: ${{ secrets.MAPBOX_STYLE_URL }} | |
| - run: npx playwright test --trace off | |
| env: | |
| WP_BASE_URL: http://localhost:8080 | |
| MAPBOX_ACCESS_TOKEN: ${{ secrets.MAPBOX_ACCESS_TOKEN }} | |
| - uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: playwright-report-wp-${{ matrix.wp-label }} | |
| path: | | |
| playwright-report/ | |
| tests/playwright/screenshots/ | |
| test-results/ | |
| retention-days: 7 | |
| - if: always() | |
| run: docker compose down | |
| artifact-playwright: | |
| name: Artifact Playwright Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| WP_IMAGE: wordpress:php8.1-apache | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.1' | |
| tools: composer | |
| coverage: none | |
| - name: Verify version consistency | |
| run: | | |
| PHP_VER=$(grep -m1 "Version:" ootb-openstreetmap.php | awk '{print $NF}' | tr -d '\r') | |
| PKG_VER=$(node -p "require('./package.json').version") | |
| README_VER=$(grep "Stable tag:" readme.txt | awk '{print $NF}' | tr -d '\r') | |
| BLOCK_VER=$(node -p "require('./src/block/block.json').version") | |
| echo "PHP header: $PHP_VER" | |
| echo "package.json: $PKG_VER" | |
| echo "readme.txt: $README_VER" | |
| echo "block.json: $BLOCK_VER" | |
| if [ "$PHP_VER" != "$PKG_VER" ] || [ "$PHP_VER" != "$README_VER" ] || [ "$PHP_VER" != "$BLOCK_VER" ]; then | |
| echo "ERROR: Version mismatch — all four must match before releasing." | |
| exit 1 | |
| fi | |
| echo "All versions consistent: $PHP_VER" | |
| - name: Build artifact zip | |
| run: bash bin/build-zip.sh | |
| - name: Stage artifact for Docker | |
| run: | | |
| mkdir -p /tmp/ootb-artifact | |
| cp ootb-openstreetmap-*.zip /tmp/ootb-artifact/plugin.zip | |
| - name: Install Playwright browser | |
| run: npx playwright install chromium --with-deps | |
| - name: Start WordPress (no source volume mount) | |
| run: docker compose -f docker-compose.artifact.yml up -d | |
| - name: Wait for WordPress | |
| run: | | |
| until curl -sf http://localhost:8080/wp-login.php > /dev/null; do sleep 3; done | |
| - name: Debug container state | |
| run: | | |
| docker compose -f docker-compose.artifact.yml ps | |
| docker compose -f docker-compose.artifact.yml logs wordpress | |
| docker compose -f docker-compose.artifact.yml logs cli | |
| - name: Setup WordPress and install plugin from zip | |
| run: bash scripts/wp-artifact-setup.sh | |
| - name: Run Playwright tests | |
| run: npx playwright test | |
| env: | |
| WP_BASE_URL: http://localhost:8080 | |
| - uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: artifact-playwright-report | |
| path: | | |
| playwright-report/ | |
| tests/playwright/screenshots/ | |
| test-results/ | |
| retention-days: 7 | |
| - if: always() | |
| run: docker compose -f docker-compose.artifact.yml down | |
| security: | |
| name: CodeQL Security Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: github/codeql-action/init@v4 | |
| with: | |
| languages: javascript | |
| - uses: github/codeql-action/analyze@v4 |