Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Feb 9, 2024
1 parent 099a850 commit 27abacc
Show file tree
Hide file tree
Showing 66 changed files with 2,451 additions and 2,385 deletions.
218 changes: 213 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
types:
- opened
- reopened
- synchronize
- ready_for_review
- review_requested

permissions:
contents: write
Expand All @@ -16,10 +21,74 @@ jobs:
build:

runs-on: ubuntu-latest

if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }}
steps:
- uses: actions/checkout@v3
# - uses: php-actions/composer@v6
- name: Preparing timer
id: timer_start
run: |
echo "DATE_START=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "TIMESTAMP_START=$(date +'%s')" >> $GITHUB_OUTPUT
- name: "Slack notification: IN PROGRESS"
id: slack
uses: slackapi/[email protected]
with:
channel-id: 'C068A06PV43'
payload: |
{
"text": "CI Build Status for playground-auth: IN PROGRESS\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":runner: CI Build Status for playground-auth"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}"
},
{
"type": "mrkdwn",
"text": "*End:*\n--"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:* IN PROGRESS"
},
{
"type": "mrkdwn",
"text": ":timer_clock: --"
}
]
},
{
"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 }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- uses: actions/checkout@v4
- name: Run php-actions/composer@v6
uses: php-actions/composer@v6
with:
Expand All @@ -30,7 +99,9 @@ jobs:
env:
XDEBUG_MODE: coverage
with:
php_extensions: xdebug
version: "10.1"
php_version: "8.2"
php_extensions: intl xdebug
coverage_clover: clover.xml
coverage_text: true
- name: Make code coverage badge
Expand All @@ -46,3 +117,140 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
- uses: php-actions/phpstan@v3
with:
level: 9
php_version: "8.2"
error_format: auth
path: config/ database/ lang/ src/ tests/Unit/ tests/Feature/
args: --verbose --debug
- name: Stopping timer
if: ${{ !cancelled() }}
id: timer_end
env:
TIMESTAMP_START: ${{ steps.timer_start.outputs.TIMESTAMP_START }}
run: |
echo "DATE_END=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT
echo "DURATION_PHRASE=$(($(date +'%s')-$TIMESTAMP_START)) seconds" >> $GITHUB_OUTPUT
- name: "Slack notification: Done"
uses: slackapi/[email protected]
with:
channel-id: 'C068A06PV43'
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"text": "CI Build Status for playground-auth: DONE\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":white_check_mark: CI Build Status for playground-auth"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}"
},
{
"type": "mrkdwn",
"text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:* Success"
},
{
"type": "mrkdwn",
"text": ":timer_clock: ${{ steps.timer_end.outputs.DURATION_PHRASE }}"
}
]
},
{
"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 }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: "Send a notification for failures"
if: ${{ failure() }}
uses: slackapi/[email protected]
with:
channel-id: 'C068A06PV43'
update-ts: ${{ steps.slack.outputs.ts }}
payload: |
{
"text": "CI Build Status for playground-auth: FAILED\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":warning: CI Build Status for playground-auth"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Start:*\n${{ steps.timer_start.outputs.DATE_START }}"
},
{
"type": "mrkdwn",
"text": "*End:*\n${{ steps.timer_end.outputs.DATE_END }}"
}
]
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Status:* FAILED"
},
{
"type": "mrkdwn",
"text": ":timer_clock: ${{ steps.timer_end.outputs.DURATION_PHRASE }}"
}
]
},
{
"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 }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ vendor
# Test and Docs ignores
################################################################################
coverage
output
phpunit.xml
phpstan.neon
testbench.yaml
Expand Down
9 changes: 4 additions & 5 deletions .php-cs-fixer.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,11 @@

$finder = PhpCsFixer\Finder::create()
->in([
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__.'/config',
__DIR__.'/database',
__DIR__ . '/lang',
__DIR__ . '/routes',
__DIR__ . '/src',
__DIR__ . '/tests/Feature',
__DIR__.'/src',
__DIR__.'/tests/Feature',
__DIR__ . '/tests/Unit',
])
->name('*.php')
Expand Down
52 changes: 7 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
[![Playground CI Workflow](https://github.com/gammamatrix/playground-auth/actions/workflows/ci.yml/badge.svg?branch=develop)](https://raw.githubusercontent.com/gammamatrix/playground-auth/testing/develop/testdox.txt)
[![Test Coverage](https://raw.githubusercontent.com/gammamatrix/playground-auth/testing/develop/coverage.svg)](tests)

The Playground authentication package for [Laravel](https://laravel.com/docs/10.x) applications.

This package provides endpoints and a Blade UI for handling authentication and authorization.
The Playground authentication and authorization package for [Laravel](https://laravel.com/docs/10.x) applications.

More information is available [on the Playground Auth wiki.](https://github.com/gammamatrix/playground-auth/wiki)

Expand All @@ -21,56 +19,20 @@ composer require gammamatrix/playground-auth

You can publish the config file with:
```bash
php artisan vendor:publish --provider="GammaMatrix\Playground\Auth\ServiceProvider" --tag="playground-config"
php artisan vendor:publish --provider="Playground\Auth\ServiceProvider" --tag="playground-config"
```

See the contents of the published config file: [config/playground-auth.php](config/playground-auth.php)

You can publish the routes file with:
```bash
php artisan vendor:publish --provider="GammaMatrix\Playground\Auth\ServiceProvider" --tag="playground-routes"
```

### Environment Variables

#### Loading

| env() | config() |
|---------------------------------|---------------------------------|
| `PLAYGROUND_AUTH_LOAD_COMMANDS` | `playground-auth.load.commands` |
| `PLAYGROUND_LOAD_ROUTES` | `playground-auth.load.routes` |
| `PLAYGROUND_LOAD_VIEWS` | `playground-auth.load.views` |

`PLAYGROUND_LOAD_ROUTES` must be enabled to load the routes in the application (unless published to your app - the control for this is in the [ServiceProvider.php](src/ServiceProvider.php))

#### Routes

All routes are enabled by default in the base Playground Auth package.
- They may be disabled in the configuration.

See the authentication routes: [routes/auth.php](routes/auth.php)

| env() | config() |
|-----------------------------------|-----------------------------------|
| `PLAYGROUND_AUTH_ROUTES_RESET` | `playground-auth.routes.confirm` |
| `PLAYGROUND_AUTH_ROUTES_FORGOT` | `playground-auth.routes.forgot` |
| `PLAYGROUND_AUTH_ROUTES_LOGOUT` | `playground-auth.routes.logout` |
| `PLAYGROUND_AUTH_ROUTES_LOGIN` | `playground-auth.routes.login` |
| `PLAYGROUND_AUTH_ROUTES_REGISTER` | `playground-auth.routes.register` |
| `PLAYGROUND_AUTH_ROUTES_RESET` | `playground-auth.routes.reset` |
| `PLAYGROUND_AUTH_ROUTES_TOKEN` | `playground-auth.routes.token` |
| `PLAYGROUND_AUTH_ROUTES_RESET` | `playground-auth.routes.verify` |

### UI
| env() | config() |
|-------------------------------------|-------------------------------------|
| `PLAYGROUND_AUTH_LOAD_COMMANDS` | `playground-auth.load.commands` |
| `PLAYGROUND_AUTH_LOAD_TRANSLATIONS` | `playground-auth.load.translations` |

| env() | config() |
|----------------------------------|----------------------------------|
| `PLAYGROUND_AUTH_LAYOUT` | `playground-auth.layout` |
| `PLAYGROUND_AUTH_VIEW` | `playground-auth.view` |
| `PLAYGROUND_AUTH_SITEMAP_ENABLE` | `playground-auth.sitemap.enable` |
| `PLAYGROUND_AUTH_SITEMAP_GUEST` | `playground-auth.sitemap.guest` |
| `PLAYGROUND_AUTH_SITEMAP_USER` | `playground-auth.sitemap.user` |
| `PLAYGROUND_AUTH_SITEMAP_VIEW` | `playground-auth.sitemap.view` |

## Commands

Expand All @@ -85,7 +47,7 @@ artisan auth:hash-password 'some password' --json --pretty
```
```json
{
"password": "$2y$10$langzXKRw1GgO6VgF0IrSecqxi3gAsU5NgmmERT\/2pQXg06mSbEjS"
"hashed": "$2y$10$langzXKRw1GgO6VgF0IrSecqxi3gAsU5NgmmERT\/2pQXg06mSbEjS"
}
```

Expand Down
Loading

0 comments on commit 27abacc

Please sign in to comment.