From 3985f7b7442c73cb271782030b513479868f5e59 Mon Sep 17 00:00:00 2001 From: Jeremy Postlethwaite Date: Sat, 6 Jul 2024 09:53:10 -0700 Subject: [PATCH] v73.0.0 --- .github/workflows/ci.yml | 127 +++++++++++++++++------------ README.md | 32 ++++++++ composer.json | 3 +- phpstan.neon.dist | 4 +- phpunit-ci.xml | 76 +++++++++++++++++ phpunit.xml.dist | 6 +- src/View/Components/Table/Data.php | 5 ++ 7 files changed, 195 insertions(+), 58 deletions(-) create mode 100644 phpunit-ci.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9229d4..4f3db37 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: 'CI' +name: "CI" on: push: @@ -30,9 +30,9 @@ jobs: echo "TIMESTAMP_START=$(date +'%s')" >> $GITHUB_OUTPUT - name: "Slack notification: IN PROGRESS" id: slack - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 with: - channel-id: 'C068A06PV43' + channel-id: "C068A06PV43" payload: | { "text": "CI Build Status for playground-blade: IN PROGRESS\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", @@ -49,11 +49,11 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + "text": "*Start:* " }, { "type": "mrkdwn", - "text": "*End:*\n--" + "text": "*End:* --" } ] }, @@ -71,18 +71,25 @@ jobs: ] }, { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Merge/Pull Request" + }, + "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Build: ${{ github.run_id }}" + }, + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] } ] } @@ -102,6 +109,7 @@ jobs: version: "11.0" php_version: "8.2" php_extensions: intl xdebug + configuration: phpunit-ci.xml coverage_clover: clover.xml coverage_text: true - name: Make code coverage badge @@ -110,7 +118,7 @@ jobs: coverage_badge_path: output/coverage.svg push_badge: false - name: Git push to testing/develop branch - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: publish_dir: ./output publish_branch: testing/develop @@ -121,7 +129,7 @@ jobs: with: level: 9 php_version: "8.2" - path: config/ resources/views/ src/ tests/Unit/ tests/Feature/ + path: config/ src/ tests/Feature/ tests/Unit/ args: --verbose --debug - name: Stopping timer if: ${{ !cancelled() }} @@ -131,10 +139,11 @@ jobs: run: | echo "DATE_END=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT echo "DURATION_PHRASE=$(($(date +'%s')-$TIMESTAMP_START)) seconds" >> $GITHUB_OUTPUT + echo "TIMESTAMP_END=$(date +'%s')" >> $GITHUB_OUTPUT - name: "Slack notification: Done" - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 with: - channel-id: 'C068A06PV43' + channel-id: "C068A06PV43" update-ts: ${{ steps.slack.outputs.ts }} payload: | { @@ -152,11 +161,11 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + "text": "*Start:* " }, { "type": "mrkdwn", - "text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}" + "text": "*End:* " } ] }, @@ -174,18 +183,26 @@ jobs: ] }, { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Merge/Pull Request" + }, + "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Build: ${{ github.run_id }}" + }, + "style": "primary", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] } ] } @@ -193,9 +210,9 @@ jobs: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} - name: "Send a notification for failures" if: ${{ failure() }} - uses: slackapi/slack-github-action@v1.25.0 + uses: slackapi/slack-github-action@v1.26.0 with: - channel-id: 'C068A06PV43' + channel-id: "C068A06PV43" update-ts: ${{ steps.slack.outputs.ts }} payload: | { @@ -213,11 +230,11 @@ jobs: "fields": [ { "type": "mrkdwn", - "text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}" + "text": "*Start:* " }, { "type": "mrkdwn", - "text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}" + "text": "*End:* " } ] }, @@ -235,18 +252,26 @@ jobs: ] }, { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*PR:* ${{ github.event.pull_request.html_url || github.event.head_commit.url }}" - } - }, - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "*Build:* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - } + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Merge/Pull Request" + }, + "url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + }, + { + "type": "button", + "text": { + "type": "plain_text", + "text": "Build: ${{ github.run_id }}" + }, + "style": "danger", + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] } ] } diff --git a/README.md b/README.md index 37beff8..e498cdb 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,38 @@ php artisan vendor:publish --tag playground-blade-errors composer test ``` +## Cloc + +```sh +composer cloc +``` + +``` +➜ playground-blade git:(develop) ✗ composer cloc +> cloc --exclude-dir=output,vendor . + 154 text files. + 118 unique files. + 38 files ignored. + +github.com/AlDanial/cloc v 1.98 T=0.10 s (1143.8 files/s, 81948.0 lines/s) +------------------------------------------------------------------------------- +Language files blank comment code +------------------------------------------------------------------------------- +Blade 49 397 13 2700 +PHP 47 466 518 2524 +CSS 10 139 141 461 +SVG 2 2 2 301 +YAML 1 5 0 275 +XML 3 0 7 221 +Markdown 3 47 0 98 +JSON 1 0 0 65 +JavaScript 1 0 35 22 +INI 1 3 0 12 +------------------------------------------------------------------------------- +SUM: 118 1059 716 6679 +------------------------------------------------------------------------------- +``` + ## PHPStan Tests at level 9 on: diff --git a/composer.json b/composer.json index 2a46b28..b97e5e8 100644 --- a/composer.json +++ b/composer.json @@ -57,8 +57,9 @@ } }, "scripts": { - "test": "vendor/bin/phpunit", + "test": "vendor/bin/testbench package:test", "format": "vendor/bin/php-cs-fixer fix", + "cloc": "cloc --exclude-dir=output,vendor .", "analyse": "vendor/bin/phpstan analyse --verbose --debug --level max" } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index ef5f1da..d981cbc 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -22,7 +22,5 @@ parameters: treatPhpDocTypesAsCertain: false - checkGenericClassInNonGenericObjectType: false - - editorUrl: 'vscode://file/%%file%%:%%line%%' + # editorUrl: 'vscode://file/%%file%%:%%line%%' # editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' diff --git a/phpunit-ci.xml b/phpunit-ci.xml new file mode 100644 index 0000000..be75a3d --- /dev/null +++ b/phpunit-ci.xml @@ -0,0 +1,76 @@ + + + + + tests/Unit + + + tests/Feature + + + + + + + + + + + + + + + + + + + + + + src + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpunit.xml.dist b/phpunit.xml.dist index be75a3d..8d03435 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -27,9 +27,9 @@ tests/Unit - + - + diff --git a/src/View/Components/Table/Data.php b/src/View/Components/Table/Data.php index 1dfa737..c9a9647 100644 --- a/src/View/Components/Table/Data.php +++ b/src/View/Components/Table/Data.php @@ -8,6 +8,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; +use Illuminate\Database\Eloquent\Model; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\View\Component; @@ -83,6 +84,10 @@ public function __construct( */ public array $styling = [], public string $class = '', + + /** + * @var ?LengthAwarePaginator + */ public ?LengthAwarePaginator $paginator = null, ) { }