-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* usage with laravel app * add middleware and make base url dynamic for laravel * update middleware tag * rename services and components * Update UserInfoMiddleware.php * rename middleware and service provider and user registred class * WIP Signed-off-by: Salah Alkhwlani <[email protected]> * Create unit-test.yaml * Update unit-test.yaml * Update unit-test.yaml * Create lint-pr.yaml * Create lint-branch.yaml * Update unit-test.yaml * wip Signed-off-by: Salah Alkhwlani <[email protected]> * WIP Signed-off-by: Salah Alkhwlani <[email protected]> * WIP Signed-off-by: Salah Alkhwlani <[email protected]> * wip Signed-off-by: Salah Alkhwlani <[email protected]> * WIP Signed-off-by: Salah Alkhwlani <[email protected]> * wip Signed-off-by: Salah Alkhwlani <[email protected]> * wip Signed-off-by: Salah Alkhwlani <[email protected]> * wip Signed-off-by: Salah Alkhwlani <[email protected]> * wip Signed-off-by: Salah Alkhwlani <[email protected]> --------- Signed-off-by: Salah Alkhwlani <[email protected]> Co-authored-by: Salah Alkhwlani <[email protected]> Co-authored-by: Salah Alkhwlani <[email protected]>
- Loading branch information
1 parent
f7c6ee4
commit 7c22716
Showing
24 changed files
with
899 additions
and
215 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Lint Branch | ||
on: pull_request | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
name: Validate branch name | ||
steps: | ||
- name: Lint branch name | ||
uses: lekterable/[email protected] | ||
with: | ||
allowed: | | ||
/(bugfix|hotfix|feature)\/[a-zA-Z]+-\d{1,10}(?:-[^\/]+)?$/i | ||
errorMessage: 'The allowed prefixs for branch name are (bugfix|hotfix|feature)' | ||
startAfter: '2023-12-03 00:00:00' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: "Lint PR" | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
- labeled | ||
- unlabeled | ||
jobs: | ||
main: | ||
name: Validate PR title | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/action-semantic-pull-request@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
# Configure which types are allowed (newline-delimited). | ||
# Default: https://github.com/commitizen/conventional-commit-types | ||
types: | | ||
fix | ||
feat | ||
BREAKING CHANGE | ||
refactor | ||
test | ||
perf | ||
build | ||
ci | ||
revert | ||
# Configure which scopes are allowed (newline-delimited). | ||
# These are regex patterns auto-wrapped in `^ $`. | ||
scopes: | | ||
JIRA-\d+ | ||
[A-Z]+-\d+ | ||
catalog | ||
orders | ||
payments | ||
checkout | ||
journey | ||
partners | ||
platform | ||
themes | ||
auth | ||
marketing | ||
devops | ||
# Configure that a scope must always be provided. | ||
requireScope: true | ||
# If the PR contains one of these newline-delimited labels, the | ||
# validation is skipped. If you want to rerun the validation when | ||
# labels change, you might want to use the `labeled` and `unlabeled` | ||
# event triggers in your workflow. | ||
ignoreLabels: | | ||
bot | ||
ignore-semantic-pull-request | ||
# If you're using a format for the PR title that differs from the traditional Conventional | ||
# Commits spec, you can use these options to customize the parsing of the type, scope and | ||
# subject. The `headerPattern` should contain a regex where the capturing groups in parentheses | ||
# correspond to the parts listed in `headerPatternCorrespondence`. | ||
# See: https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#headerpattern | ||
headerPattern: '^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$' | ||
headerPatternCorrespondence: type, scope, subject | ||
wip: true | ||
# upperCase: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test: | ||
name: Test PHP ${{ matrix.php-version }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-version: ['8.1', '8.2'] | ||
|
||
services: | ||
redis: | ||
image: bitnami/redis:6.2.4-debian-10-r35 | ||
ports: | ||
- 6379:6379 | ||
env: | ||
ALLOW_EMPTY_PASSWORD: 'yes' | ||
options: >- | ||
--health-cmd "redis-cli -p 6379 ping" | ||
--health-start-period 5s | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install dependencies | ||
uses: php-actions/composer@v6 | ||
with: | ||
php_version: ${{ matrix.php-version }} | ||
php_extensions: "redis-5.3.7" | ||
|
||
- name: PHPUnit Tests | ||
uses: php-actions/phpunit@v3 | ||
with: | ||
version: 9.5.26 | ||
php_version: ${{ matrix.php-version }} | ||
php_extensions: "xdebug redis-5.3.7" | ||
bootstrap: vendor/autoload.php | ||
configuration: phpunit.xml | ||
coverage_clover: "coverage/clover.xml" | ||
args: --coverage-text | ||
env: | ||
XDEBUG_MODE: coverage | ||
REDIS_HOST: 127.0.0.1 | ||
REDIS_PORT: 6379 | ||
|
||
- name: Run codacy-coverage-reporter | ||
uses: codacy/codacy-coverage-reporter-action@v1 | ||
with: | ||
project-token: ${{ secrets.CODACY_API_TOKEN }} | ||
coverage-reports: "coverage/clover.xml" | ||
|
||
- name: Dump docker logs on failure | ||
if: failure() | ||
uses: jwalton/gh-docker-logs@v2 | ||
|
||
|
||
unit-test-ready: | ||
needs: [ test ] | ||
runs-on: ubuntu-latest | ||
name: "Testing Ready" | ||
steps: | ||
- name: All tests passed | ||
run: echo "All matrix jobs succeeded" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
return [ | ||
'client_id' => env('SALLA_OAUTH_CLIENT_ID'), | ||
'client_secret' => env('SALLA_OAUTH_CLIENT_SECRET'), | ||
'redirect_url' => env('SALLA_OAUTH_CLIENT_REDIRECT_URI'), | ||
'base_url' => env('SALLA_OAUTH_BASE_URL', 'https://accounts.salla.sa'), | ||
'cache-prefix' => env('SALLA_OAUTH_PREFIX_CACHE', 'oauth'), | ||
]; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Salla\OAuth2\Client\Auth; | ||
|
||
use Illuminate\Http\Request; | ||
use Salla\OAuth2\Client\Models\OAuthUser; | ||
|
||
class AuthRequest | ||
{ | ||
public function __invoke(Request $request) | ||
{ | ||
$user = $request->attributes->get('salla.oauth.user'); | ||
|
||
if (!$user) { | ||
return null; | ||
} | ||
|
||
return new OAuthUser($user); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Salla\OAuth2\Client\Auth; | ||
|
||
class Guard extends \Illuminate\Auth\RequestGuard | ||
{ | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Salla\OAuth2\Client\Contracts; | ||
|
||
interface SallaOauth | ||
{ | ||
public function getCurrentUser(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Salla\OAuth2\Client\Facade; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class SallaOauth extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return \Salla\OAuth2\Client\Contracts\SallaOauth::class; | ||
} | ||
} |
Oops, something went wrong.