Skip to content

Commit

Permalink
Added roles and permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
troccoli committed Oct 11, 2024
1 parent 128f3f3 commit 54c40ff
Show file tree
Hide file tree
Showing 52 changed files with 3,201 additions and 549 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Matrix

on:
push

jobs:
master-matrix:
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
php: ['8.3']
uses: ./.github/workflows/test.yml
with:
os: ${{ matrix.os }}
php: ${{ matrix.php }}
secrets: inherit
266 changes: 266 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
name: Testing

on:
workflow_call:
inputs:
os:
required: true
type: string
php:
required: true
type: string

env:
node-modules-cache-name: cache-node-modules
composer-packages-cache-name: cache-composer-packages
build-artifacts: build-artifacts

jobs:
debug:
runs-on: ${{ inputs.os }}
steps:
- name: Setup PHP ${{ inputs.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php }}
- run: php --version
- run: node --version
- run: npm --version
build:
runs-on: ${{ inputs.os }}
steps:
- uses: actions/checkout@v4
- name: Setup PHP ${{ inputs.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php }}
- name: Setup Environment
run: cp .env.ci .env
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.node-modules-cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Install node dependencise
run: npm install
- name: Cache composer packages
id: cache-composer-packages
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-build-${{ env.composer-packages-cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Install composer dependencies
run: composer install -n --ignore-platform-reqs --no-progress --no-suggest
- name: Build artifacts
run: npm run build
- name: Tar artifacts
run: /bin/tar -cz -f ~/${{ env.build-artifacts }}.tgz -C ./public build
- name: Store build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.build-artifacts }}
path: ~/${{ env.build-artifacts }}.tgz
unit-tests:
env:
job-name: unit-tests
runs-on: ${{ inputs.os }}
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Setup PHP ${{ inputs.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php }}
- name: Setup Environment
run: |
cp .env.ci .env
touch ./storage/logs/laravel.log
touch ./database/database.sqlite
- name: Restore node modules cache
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.node-modules-cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Restore composer packages cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-build-${{ env.composer-packages-cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Migrate Database
run: php artisan migrate --force
- name: Setup Laravel Passport
run: php artisan passport:install
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Dump Autoloader
run: composer dump-autoload
- name: Execute Unit tests via PHPUnit
run: vendor/bin/phpunit tests/Unit
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ env.job-name }}-log
path: ./storage/logs/*.log
integration-tests:
env:
job-name: integration-tests
runs-on: ${{ inputs.os }}
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Setup PHP ${{ inputs.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php }}
- name: Setup Environment
run: |
cp .env.ci .env
touch ./storage/logs/laravel.log
touch ./database/database.sqlite
- name: Restore node modules cache
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.node-modules-cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Restore composer packages cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-build-${{ env.composer-packages-cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Migrate Database
run: php artisan migrate --force
- name: Setup Laravel Passport
run: php artisan passport:install
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Dump Autoloader
run: composer dump-autoload
- name: Run Laravel Server
run: php artisan serve &
- name: Execute Integration tests via PHPUnit
run: vendor/bin/phpunit tests/Integration
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ env.job-name }}-log
path: ./storage/logs/*.log
feature-tests:
env:
job-name: feature-tests
runs-on: ${{ inputs.os }}
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Setup PHP ${{ inputs.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php }}
- name: Setup Environment
run: |
cp .env.ci .env
touch ./storage/logs/laravel.log
touch ./database/database.sqlite
- name: Restore node modules cache
uses: actions/cache@v4
with:
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.node-modules-cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Restore composer packages cache
uses: actions/cache@v4
with:
path: ./vendor
key: ${{ runner.os }}-build-${{ env.composer-packages-cache-name }}-${{ hashFiles('**/composer.lock') }}
- name: Restore building artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.build-artifacts }}
- run: tar -xz -f ./${{ env.build-artifacts }}.tgz -C ./public
- name: Migrate Database
run: php artisan migrate --force
- name: Setup Laravel Passport
run: php artisan passport:install
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Dump Autoloader
run: composer dump-autoload
- name: Run Laravel Server
run: php artisan serve &
- name: Execute Feature tests via PHPUnit
run: vendor/bin/phpunit tests/Feature
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: ${{ env.job-name }}-log
path: ./storage/logs/*.log
# dusk-tests:
# env:
# job-name: dusk-tests
# runs-on: ${{ inputs.os }}
# needs: [build]
# steps:
# - uses: actions/checkout@v4
# - name: Setup PHP ${{ inputs.php }}
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ inputs.php }}
# - name: Setup Environment
# run: |
# cp .env.ci .env
# touch ./storage/logs/laravel.log
# touch ./database/database.sqlite
# - name: Restore node modules cache
# uses: actions/cache@v4
# with:
# path: ./node_modules
# key: ${{ runner.os }}-build-${{ env.node-modules-cache-name }}-${{ hashFiles('**/package-lock.json') }}
# - name: Restore composer packages cache
# uses: actions/cache@v4
# with:
# path: ./vendor
# key: ${{ runner.os }}-build-${{ env.composer-packages-cache-name }}-${{ hashFiles('**/composer.lock') }}
# - name: Restore building artifacts
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.build-artifacts }}
# - run: tar -xz -f ./${{ env.build-artifacts }}.tgz -C ./public
# - name: Migrate Database
# run: php artisan migrate --force
# - name: Setup Laravel Passport
# run: php artisan passport:install
# - name: Directory Permissions
# run: chmod -R 777 storage bootstrap/cache
# - name: Dump Autoloader
# run: composer dump-autoload
# - name: Update Chrome Driver
# run: |
# CHROME_VERSION="$(google-chrome --version)"
# CHROMEDRIVER_RELEASE="$(echo $CHROME_VERSION | sed 's/^Google Chrome //')"
# CHROMEDRIVER_RELEASE=${CHROMEDRIVER_RELEASE%%.*}
# php artisan dusk:chrome-driver $CHROMEDRIVER_RELEASE
# - name: Start Chrome Driver
# run: ./vendor/laravel/dusk/bin/chromedriver-linux &
# - name: Run Laravel Server
# run: php artisan serve &
# - name: Run Laravel Dusk Tests
# id: laravel-dusk
# continue-on-error: true
# run: php artisan dusk
# - name: Upload logs
# uses: actions/upload-artifact@v4
# if: ${{ steps.laravel-dusk.outcome == 'failure'}}
# with:
# name: ${{ env.job-name }}-log
# path: ./storage/logs/*.log
# - name: Upload screenshots
# uses: actions/upload-artifact@v4
# if: ${{ steps.laravel-dusk.outcome == 'failure' }}
# with:
# name: ${{ env.job-name }}-screenshots
# path: ./tests/Browser/screenshots
# - name: Sanity check
# if: ${{ steps.laravel-dusk.outcome == 'failure'}}
# run: exit 2
15 changes: 15 additions & 0 deletions app/Events/ClubCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Events;

use App\Models\Club;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ClubCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public Club $club) {}
}
15 changes: 15 additions & 0 deletions app/Events/CompetitionCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Events;

use App\Models\Competition;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class CompetitionCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public Competition $competition) {}
}
15 changes: 15 additions & 0 deletions app/Events/DivisionCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Events;

use App\Models\Division;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class DivisionCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public Division $division) {}
}
15 changes: 15 additions & 0 deletions app/Events/SeasonCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Events;

use App\Models\Season;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class SeasonCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public Season $season) {}
}
15 changes: 15 additions & 0 deletions app/Events/TeamCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Events;

use App\Models\Team;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class TeamCreated
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public function __construct(public Team $team) {}
}
Loading

0 comments on commit 54c40ff

Please sign in to comment.