Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/composer-unused.php export-ignore
/deptrac.yml export-ignore
/structarmed.php export-ignore
/infection.json.dist export-ignore
/mkdocs.yml export-ignore
/phpstan-baseline.php export-ignore
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/deptrac.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/structarmed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: StructArmed

on:
pull_request:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'structarmed.php'
- '.github/workflows/structarmed.yml'
push:
branches:
- develop
paths:
- '**.php'
- 'composer.*'
- 'structarmed.php'
- '.github/workflows/structarmed.yml'
workflow_call:
inputs:
php-version:
required: false
type: string
default: '8.2'

permissions:
contents: read

jobs:
build:
name: Dependency Tracing
runs-on: ubuntu-latest
if: (! contains(github.event.head_commit.message, '[ci skip]'))

steps:
- name: Checkout
uses: actions/checkout@v5
Comment thread
samsonasik marked this conversation as resolved.
Outdated

- name: Set up PHP
uses: shivammathur/setup-php@v2
Comment thread
samsonasik marked this conversation as resolved.
Outdated
with:
php-version: ${{ inputs['php-version'] }}
tools: composer
extensions: intl, json, mbstring, xml
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> $GITHUB_ENV

- name: Cache composer dependencies
uses: actions/cache@v4
Comment thread
samsonasik marked this conversation as resolved.
Outdated
with:
path: ${{ env.COMPOSER_CACHE_FILES_DIR }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
if [ -f composer.lock ]; then
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
else
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
fi

- name: Structarmed Cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: /tmp/structarmed
key: ${{ runner.os }}-structarmed-${{ github.run_id }}
restore-keys: ${{ runner.os }}-structarmed-

- run: mkdir -p /tmp/structarmed

- name: Run static analysis
run: vendor/bin/structarmed analyze
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![PHP-CS-Fixer](https://github.com/codeigniter4/shield/actions/workflows/phpcsfixer.yml/badge.svg)](https://github.com/codeigniter4/shield/actions/workflows/phpcsfixer.yml)
[![Rector](https://github.com/codeigniter4/shield/actions/workflows/rector.yml/badge.svg)](https://github.com/codeigniter4/shield/actions/workflows/rector.yml)
[![Psalm](https://github.com/codeigniter4/shield/actions/workflows/psalm.yml/badge.svg)](https://github.com/codeigniter4/shield/actions/workflows/psalm.yml)
[![Architecture](https://github.com/codeigniter4/shield/workflows/Deptrac/badge.svg)](https://github.com/codeigniter4/shield/actions/workflows/deptrac.yml)
[![Architecture](https://github.com/codeigniter4/shield/workflows/StructArmed/badge.svg)](https://github.com/codeigniter4/shield/actions/workflows/structarmed.yml)
[![Coverage Status](https://coveralls.io/repos/github/codeigniter4/shield/badge.svg?branch=develop)](https://coveralls.io/github/codeigniter4/shield?branch=develop)

Shield is the official authentication and authorization framework for CodeIgniter 4.
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"codeigniter4/settings": "^2.1"
},
"require-dev": {
"boundwize/structarmed": "^0.11.0",
"codeigniter/phpstan-codeigniter": "^1.3",
"codeigniter4/devkit": "^1.3",
"codeigniter4/framework": ">=4.3.5 <4.5.0 || ^4.5.1",
Expand Down Expand Up @@ -86,7 +87,7 @@
"cs": "php-cs-fixer fix --ansi --verbose --dry-run --diff",
"cs-fix": "php-cs-fixer fix --ansi --verbose --diff",
"deduplicate": "phpcpd app/ src/ --exclude src/Database/Migrations/2020-12-28-223112_create_auth_tables.php --exclude src/Authentication/Authenticators/HmacSha256.php",
"inspect": "deptrac analyze --cache-file=build/deptrac.cache",
"inspect": "vendor/bin/structarmed analyze",
"mutate": "infection --threads=2 --skip-initial-tests --coverage=build/phpunit",
"sa": "@analyze",
"style": "@cs-fix",
Expand Down
158 changes: 0 additions & 158 deletions deptrac.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions structarmed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

use Boundwize\StructArmed\Architecture;
use Boundwize\StructArmed\Preset\Preset;
use Boundwize\StructArmed\Preset\Presets\Psr4Preset;

return Architecture::define()
->skip([
Psr4Preset::CLASSES_MUST_MATCH_COMPOSER => [
__DIR__ . '/src/Database/Migrations',
],
])
->cacheDirectory(is_dir('/tmp') ? '/tmp/structarmed' : null)
->withPreset(Preset::PSR4())
->layerPattern('Model', '/^CodeIgniter\\\\Shield\\\\.*Model$/')
->layerPattern('Controller', '/^CodeIgniter\\\\Shield\\\\Controllers\\\\.*$/')
->layerPattern('Config', '/^CodeIgniter\\\\Shield\\\\Config\\\\.*$/', '/^.*Services$/')
->layerPattern('Entity', '/^CodeIgniter\\\\Shield\\\\Entities\\\\.*$/')
->layerPattern('Service', '/^.*Services$/')
->ruleset([
'Entity' => ['Config', 'Model', 'Service'],
'Config' => ['Model', 'Service'],
'Model' => ['Config', 'Entity', 'Service'],
'Service' => ['Config'],
]);
Loading