diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cc751d..f135efe 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-matrix: 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/ database/ src/ tests/Unit/ tests/Feature/ + path: config/ database/ 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 8040753..6f3ca65 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,34 @@ You can publish the migrations file with: php artisan vendor:publish --provider="Playground\Matrix\ServiceProvider" --tag="playground-migrations" ``` +## Cloc + +```sh +composer cloc +``` + +``` +➜ playground-matrix git:(develop) ✗ composer cloc +> cloc --exclude-dir=output,vendor . + 160 text files. + 100 unique files. + 62 files ignored. + +github.com/AlDanial/cloc v 1.98 T=0.17 s (574.5 files/s, 89466.2 lines/s) +------------------------------------------------------------------------------- +Language files blank comment code +------------------------------------------------------------------------------- +PHP 92 1065 3751 10043 +YAML 1 5 0 275 +XML 3 0 2 223 +Markdown 2 39 0 85 +JSON 1 0 0 70 +INI 1 3 0 12 +------------------------------------------------------------------------------- +SUM: 100 1112 3753 10708 +------------------------------------------------------------------------------- +``` + ## PHPStan Tests at level 9 on: diff --git a/tests/Feature/Console/Commands/About/CommandTest.php b/tests/Feature/Console/Commands/About/CommandTest.php index 8543a02..21ddbca 100644 --- a/tests/Feature/Console/Commands/About/CommandTest.php +++ b/tests/Feature/Console/Commands/About/CommandTest.php @@ -16,12 +16,21 @@ #[CoversClass(ServiceProvider::class)] class CommandTest extends TestCase { - public function test_command_about_displays_package_information_and_succeed_with_code_0(): void + /** + * Define environment setup. + * + * @param \Illuminate\Foundation\Application $app + * @return void + */ + protected function defineEnvironment($app) { - config([ - 'playground-matrix.load.migrations' => true, - ]); + parent::defineEnvironment($app); + + $app['config']->set('playground-matrix.load.migrations', true); + } + public function test_command_about_displays_package_information_and_succeed_with_code_0(): void + { /** * @var \Illuminate\Testing\PendingCommand $result */