Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 116 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: CI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

permissions:
contents: read

jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
php: ${{ steps.filter.outputs.php }}
js: ${{ steps.filter.outputs.js }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
php:
- 'php/**'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- '.github/workflows/**'
js:
- 'ui/**'
- 'pnpm-lock.yaml'
- 'pnpm-workspace.yaml'
- '.github/workflows/**'

php:
name: PHP package (bherila/auth-laravel)
needs: changes
if: needs.changes.outputs.php == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: mbstring, xml, ctype, iconv, sqlite3, bcmath, intl
coverage: none

- name: Cache Composer dependencies
uses: actions/cache@v5
with:
path: vendor
key: composer-${{ hashFiles('composer.json') }}
restore-keys: composer-

- name: Install Composer dependencies
run: composer install --no-interaction --prefer-dist

- name: Run PHPUnit
run: composer test

js:
name: JS package (bwh-auth)
needs: changes
if: needs.changes.outputs.js == 'true'
runs-on: ubuntu-latest
timeout-minutes: 8
steps:
- uses: actions/checkout@v6

- name: Set up pnpm
uses: pnpm/action-setup@v6
with:
version: 11

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Type-check
run: pnpm --filter bwh-auth run typecheck

- name: Build
run: pnpm --filter bwh-auth run build

result:
name: CI result
needs: [changes, php, js]
if: always()
runs-on: ubuntu-latest
steps:
- name: Check result
run: |
for r in "${{ needs.changes.result }}" "${{ needs.php.result }}" "${{ needs.js.result }}"; do
if [[ "$r" == "failure" || "$r" == "cancelled" ]]; then
echo "A required job failed: $r"
exit 1
fi
done
echo "Required checks passed or no matching paths changed."
29 changes: 0 additions & 29 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules/
ui/node_modules/
laravel/vendor/
php/vendor/
/vendor/
/composer.lock
.phpunit.result.cache
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Shared authentication packages for BWH Laravel/Vite applications.

This repository contains:

- `ui`: npm package `bwh-auth` for React auth UI and browser WebAuthn helpers.
- `laravel`: Composer package `bherila/auth-laravel` for Laravel auth services, passkeys, migrations, routes, and extension contracts.
- `ui`: pnpm package `bwh-auth` for React auth UI and browser WebAuthn helpers.
- `php`: Composer package `bherila/auth-laravel` for Laravel auth services, passkeys, migrations, routes, and extension contracts. Its manifest is the repository-root `composer.json` (required for Composer VCS resolution); the source lives under `php/`.

The packages intentionally keep app-specific policy outside the shared core. Apps decide whether a user can log in, where they go after login, and how audit events are recorded.

Laravel apps that own their primary `/login` route must wire package opt-in features into that controller. For example, enabling the audit-log-backed throttle config does not by itself enforce lockout on a custom login controller; the app must call the Laravel package's throttle trait or contract before attempting credentials. See `laravel/README.md`.
Laravel apps that own their primary `/login` route must wire package opt-in features into that controller. For example, enabling the audit-log-backed throttle config does not by itself enforce lockout on a custom login controller; the app must call the Laravel package's throttle trait or contract before attempting credentials. See `php/README.md`.

## UI Installation

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
},
"autoload": {
"psr-4": {
"BWH\\Auth\\": "laravel/src/"
"BWH\\Auth\\": "php/src/"
}
},
"autoload-dev": {
"psr-4": {
"BWH\\Auth\\Tests\\": "laravel/tests/"
"BWH\\Auth\\Tests\\": "php/tests/"
}
},
"scripts": {
Expand Down
39 changes: 0 additions & 39 deletions laravel/composer.json

This file was deleted.

Loading