Add WireableData trait: Livewire integration decoupled from livewire/… #33
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: | |
| test: | |
| name: PHP ${{ matrix.php }} / Laravel ${{ matrix.laravel }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ["8.4"] | |
| laravel: ["10.*", "11.*", "12.*", "13.*"] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up PHP ${{ matrix.php }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: none | |
| - name: Require Laravel version | |
| run: | | |
| composer require \ | |
| "illuminate/contracts:${{ matrix.laravel }}" \ | |
| "illuminate/support:${{ matrix.laravel }}" \ | |
| --no-update | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Run tests | |
| run: vendor/bin/phpunit --no-coverage | |
| coverage: | |
| name: Coverage | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up PHP 8.4 with pcov | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: "8.4" | |
| coverage: pcov | |
| - name: Install dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Run tests with coverage | |
| run: | | |
| mkdir -p build | |
| vendor/bin/phpunit --coverage-clover=build/coverage.xml --coverage-text | |
| - name: Enforce 100% coverage | |
| run: composer coverage:check | |
| - name: Extract coverage percentage | |
| run: | | |
| PCT=$(php -r " | |
| \$xml = simplexml_load_file('build/coverage.xml'); | |
| \$m = \$xml->project->metrics; | |
| \$t = (int)\$m['statements']; | |
| \$c = (int)\$m['coveredstatements']; | |
| echo \$t > 0 ? round(\$c / \$t * 100) : 0; | |
| ") | |
| echo "COVERAGE_PCT=$PCT" >> $GITHUB_ENV | |
| - name: Update coverage badge | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| GIST_SECRET: ${{ secrets.GIST_SECRET }} | |
| run: | | |
| CONTENT=$(printf '{"schemaVersion":1,"label":"coverage","message":"%s%%","color":"brightgreen"}' "$COVERAGE_PCT") | |
| curl -sf -X PATCH \ | |
| -H "Authorization: token $GIST_SECRET" \ | |
| -H "Content-Type: application/json" \ | |
| -H "User-Agent: GitHub-Actions" \ | |
| -d "{\"files\":{\"coverage.json\":{\"content\":$(echo "$CONTENT" | jq -Rs .)}}}" \ | |
| "https://api.github.com/gists/1a6bdbea77d160eeaf4524b8e165d3ac" |