Skip to content

Commit 9857c23

Browse files
jainejaine
authored andcommitted
chore: initial import
0 parents  commit 9857c23

129 files changed

Lines changed: 13667 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
db: [mysql, postgres]
14+
15+
services:
16+
mysql:
17+
image: mysql:8.0
18+
env:
19+
MYSQL_ROOT_PASSWORD: root
20+
MYSQL_DATABASE: blackcat_test
21+
ports:
22+
- 3306:3306
23+
options: >-
24+
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot"
25+
--health-interval=10s
26+
--health-timeout=5s
27+
--health-retries=10
28+
postgres:
29+
image: postgres:15
30+
env:
31+
POSTGRES_USER: postgres
32+
POSTGRES_PASSWORD: postgres
33+
POSTGRES_DB: blackcat_test
34+
ports:
35+
- 5432:5432
36+
options: >-
37+
--health-cmd="pg_isready -U postgres -d blackcat_test -h 127.0.0.1"
38+
--health-interval=10s
39+
--health-timeout=5s
40+
--health-retries=10
41+
42+
steps:
43+
- uses: actions/checkout@v6
44+
45+
- name: Set up PHP
46+
uses: shivammathur/setup-php@v2
47+
with:
48+
php-version: '8.3'
49+
extensions: mbstring, json, dom, pdo, pdo_mysql, pdo_pgsql, sodium
50+
coverage: none
51+
52+
- name: Install dependencies
53+
run: composer install --no-interaction --no-progress --prefer-dist
54+
55+
- name: Init blackcat-database packages
56+
run: |
57+
git -C vendor/blackcatacademy/blackcat-database submodule update --init packages/auth-events packages/device-codes packages/email-verifications packages/login-attempts packages/magic-links packages/notifications packages/password-resets packages/rate-limit-counters packages/register-events packages/sessions packages/tenants packages/users packages/verify-events packages/webauthn-challenges packages/webauthn-credentials
58+
composer dump-autoload -o
59+
60+
- name: Static analysis
61+
run: vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=1G
62+
63+
- name: Tests (unit + integration)
64+
env:
65+
DB_DSN: ${{ matrix.db == 'mysql' && 'mysql:host=127.0.0.1;port=3306;dbname=blackcat_test;charset=utf8mb4' || 'pgsql:host=127.0.0.1;port=5432;dbname=blackcat_test' }}
66+
DB_USER: ${{ matrix.db == 'mysql' && 'root' || 'postgres' }}
67+
DB_PASSWORD: ${{ matrix.db == 'mysql' && 'root' || 'postgres' }}
68+
run: vendor/bin/phpunit

.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/.idea/
2+
/.vscode/
3+
/.DS_Store
4+
5+
# Dependencies
6+
/vendor/
7+
8+
# Caches / tooling
9+
/.phpunit.cache/
10+
/.phpunit.result.cache
11+
/var/
12+
13+
# Reports / builds
14+
/coverage/
15+
/build/

README.md

Lines changed: 326 additions & 0 deletions
Large diffs are not rendered by default.

bin/auth

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env php
2+
<?php
3+
declare(strict_types=1);
4+
5+
require __DIR__ . '/../vendor/autoload.php';
6+
7+
use BlackCat\Auth\CLI\Application;
8+
use BlackCat\Auth\Foundation\AuthRuntime;
9+
use Psr\Log\NullLogger;
10+
11+
$configPath = $argv[1] ?? getenv('BLACKCAT_AUTH_CONFIG') ?? __DIR__ . '/../config/example.auth.php';
12+
$command = $argv[2] ?? 'help';
13+
$args = array_slice($argv, 3);
14+
15+
$runtime = AuthRuntime::fromFile($configPath, new NullLogger());
16+
$app = new Application($runtime);
17+
exit($app->run($command, $args));

0 commit comments

Comments
 (0)