Skip to content

Commit

Permalink
Merge pull request #1 from gwleuverink/mvp/working
Browse files Browse the repository at this point in the history
Mvp/working
  • Loading branch information
gwleuverink committed Apr 25, 2024
2 parents 181f537 + 40d99ff commit be98960
Show file tree
Hide file tree
Showing 79 changed files with 5,233 additions and 1,165 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
APP_NAME=Laravel
APP_NAME=Phost
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_URL=http://phost.test

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
Expand Down
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
022d92c18a4a5a38658ee14dc4af958b26e597cf
63f8c01938730a01258d0e6b8a1325b82d43ce09
d7e0b956a369047666dfe25eaf29c15f2a74fb92
119 changes: 119 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: codestyle

# Commits made in here will not trigger any workflows
# Checkout Duster's documentation for a workaround

on:
pull_request:
branches: [development, dev, acceptance, staging, main, master]

jobs:
skip-duplicates:
continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest

# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}

steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
cancel_others: "true"
concurrent_skipping: "same_content"
skip_after_successful_duplicate: "true"
paths_ignore: '["**/README.md", "**/docs/**"]'

duster-fix:
needs: skip-duplicates
if: needs.skip-duplicates.outputs.should_skip != 'true'

runs-on: ubuntu-latest

permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm ci

- uses: shivammathur/setup-php@v2
with:
php-version: "8.2"

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- uses: php-actions/composer@v6
with:
php_version: "8.2"
php_extensions: pcntl
version: 2.x

- name: Run fixers
run: composer fix

- uses: stefanzweifel/git-auto-commit-action@v4
id: auto_commit_action
with:
commit_message: Dusting
commit_user_name: GitHub Action
commit_user_email: actions@github.com

- name: Ignore Duster commit in git blame
if: steps.auto_commit_action.outputs.changes_detected == 'true'
run: echo ${{ steps.auto_commit_action.outputs.commit_hash }} >> .git-blame-ignore-revs

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Ignore Dusting commit in git blame
commit_user_name: GitHub Action
commit_user_email: actions@github.com

duster-lint:
needs: skip-duplicates
if: needs.skip-duplicates.outputs.should_skip != 'true'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm ci

- uses: shivammathur/setup-php@v2
with:
php-version: "8.2"

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- uses: php-actions/composer@v6
with:
php_version: "8.2"
php_extensions: pcntl
version: 2.x

- name: Run linters & static analysis
run: composer lint
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: tests

on:
pull_request:
branches: [development, dev, acceptance, staging, main, master]

jobs:
skip-duplicates:
continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest

# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}

steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
cancel_others: "true"
concurrent_skipping: "same_content"
skip_after_successful_duplicate: "true"
paths_ignore: '["**/README.md", "**/docs/**"]'

laravel-tests:
needs: skip-duplicates
if: needs.skip-duplicates.outputs.should_skip != 'true'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: shivammathur/setup-php@v2
with:
php-version: "8.2"

- name: Cache Composer dependencies
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}

- uses: php-actions/composer@v6
with:
php_version: "8.2"
php_extensions: pcntl
version: 2.x

- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Generate key
run: php artisan key:generate

# - name: Directory Permissions
# run: chmod -R 777 storage bootstrap/cache

- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
**/.DS_Store
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
Expand All @@ -17,3 +19,11 @@ yarn-error.log
/.fleet
/.idea
/.vscode

output.log
docker_tag
DOCKER_ENV
Dockerfile-php-build

_ide_helper.php
.phpstorm.meta.php
30 changes: 30 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

// @codeCoverageIgnoreStart

// Prefer adding customizations to pint.json unless adding custom fixers

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in([
__DIR__ . '/app',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/resources',
__DIR__ . '/routes',
__DIR__ . '/tests',
])
->name('*.php')
->notName('*.blade.php')
->ignoreDotFiles(true)
->ignoreVCS(true);

return (new Config)
->setFinder($finder)
->setRules([])
->setRiskyAllowed(true)
->setUsingCache(false);

// @codeCoverageIgnoreEnd
88 changes: 88 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0"?>
<ruleset name="Gedachtegoed">
<description>Gedachtegoed PHP CS rules for Laravel</description>

<file>app</file>
<file>config</file>
<file>database</file>
<file>public</file>
<file>resources</file>
<file>routes</file>
<file>tests</file>

<description>Gedachtegoed PHP CS rules for Laravel</description>

<!-- Ignore normal Laravel files and folders -->
<exclude-pattern>*/cache/*</exclude-pattern>
<exclude-pattern>*/*.js</exclude-pattern>
<exclude-pattern>*/*.css</exclude-pattern>
<exclude-pattern>*/*.xml</exclude-pattern>
<exclude-pattern>*/*.blade.php</exclude-pattern>
<exclude-pattern>*/autoload.php</exclude-pattern>
<exclude-pattern>*/storage/*</exclude-pattern>
<exclude-pattern>*/docs/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/migrations/*</exclude-pattern>

<!-- Hard-code command-line parameters -->
<arg name="colors"/>
<arg value="p"/>

<!-- PSR1 2.3 Side Effects -->
<rule ref="PSR1.Files.SideEffects">
<!-- Disable side effects for index file -->
<exclude-pattern>/public/index.php</exclude-pattern>
<!-- Disable side effects for tests (Pest) -->
<exclude-pattern>/tests</exclude-pattern>
</rule>

<!-- PSR1 3 Namespaces and classes MUST follow PSR-0. -->
<rule ref="PSR1.Classes.ClassDeclaration"/>

<!-- Disable missing namespace rule for tests and database files -->
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
<exclude-pattern>*/database/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>

<!-- PSR1 3 Class names MUST be declared in StudlyCaps. -->
<rule ref="Squiz.Classes.ValidClassName"/>

<!-- PSR1 4.1 Class constants MUST be declared in all upper case with underscore separators. -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>

<!-- PSR1 4.3 Method names MUST be declared in camelCase(). -->
<rule ref="PSR1.Methods.CamelCapsMethodName"/>

<!-- Disable camel caps rule for tests -->
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>

<!-- No compact() and no 'dumps' -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="compact" value="null"/>
<element key="dd" value="null"/>
<element key="dump" value="null"/>
<element key="var_dump" value="null"/>
<element key="ray" value="null"/>
<element key="env" value="null"/>
</property>
</properties>
</rule>

<rule ref="Generic.PHP.ForbiddenFunctions">
<exclude-pattern>/config/*</exclude-pattern>
<properties>
<property name="forbiddenFunctions" type="array">
<element key="env" value="null"/>
</property>
</properties>
</rule>

<!-- Class name should match the file name -->
<rule ref="Squiz.Classes.ClassFileName"/>

</ruleset>
23 changes: 23 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"plugins": [
"@shufo/prettier-plugin-blade"
],
"overrides": [
{
"files": [
"*.blade.php"
],
"options": {
"parser": "blade",
"tabWidth": 4
}
}
],

"htmlWhitespaceSensitivity": "css",
"sortTailwindcssClasses": true,
"singleAttributePerLine": true,
"bracketSameLine": false,
"printWidth": 600,
"tabWidth": 4
}
Loading

0 comments on commit be98960

Please sign in to comment.