Skip to content

Commit 72d979d

Browse files
Project setup improvements
1 parent 366ea2f commit 72d979d

26 files changed

+872
-148
lines changed

.dockerignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
vendor/
2+
composer.lock
3+
node_modules/
4+
.git/
5+
.mise/
6+
.phpunit.result.cache
7+
.php-cs-fixer.cache

.editorconfig

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true
9+
charset = utf-8
10+
11+
# PHP files
12+
[*.php]
13+
indent_style = space
14+
indent_size = 4
15+
max_line_length = 120
16+
17+
# TypeScript/JavaScript files
18+
[*.{ts,js,mjs}]
19+
indent_style = space
20+
indent_size = 4
21+
max_line_length = 120
22+
23+
# JSON files
24+
[*.json]
25+
indent_style = space
26+
indent_size = 4
27+
28+
# YAML files
29+
[*.{yml,yaml}]
30+
indent_style = space
31+
indent_size = 4
32+
33+
# Configuration files
34+
[*.{neon,neon.dist,dist.php}]
35+
indent_style = space
36+
indent_size = 4
37+
38+
# CSS files
39+
[*.css]
40+
indent_style = space
41+
indent_size = 4
42+
max_line_length = 120
43+
44+
# Markdown files
45+
[*.md]
46+
trim_trailing_whitespace = false
47+
48+
# Shell scripts
49+
[*.sh]
50+
indent_style = space
51+
indent_size = 4
52+
max_line_length = 120

.github/workflows/quality.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Quality
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
13+
jobs:
14+
quality:
15+
name: Code Quality
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.4'
25+
extensions: mbstring, pcntl, bcmath, intl, zip
26+
coverage: none
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '24'
32+
cache: 'npm'
33+
34+
- name: Get Composer cache directory
35+
id: composer-cache
36+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
37+
38+
- name: Cache Composer dependencies
39+
uses: actions/cache@v4
40+
with:
41+
path: ${{ steps.composer-cache.outputs.dir }}
42+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
43+
restore-keys: |
44+
${{ runner.os }}-composer-
45+
46+
- name: Install Composer dependencies
47+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
48+
49+
- name: Install NPM dependencies
50+
run: npm ci
51+
52+
- name: Run PHP CS Fixer (check mode)
53+
run: php bin/php-cs-fixer.php check
54+
55+
- name: Run Prettier (check mode)
56+
run: npm run prettier
57+
58+
- name: Run PHPStan
59+
run: php vendor/bin/phpstan --memory-limit=1024M

.github/workflows/tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
pull_request:
9+
branches:
10+
- main
11+
- develop
12+
13+
jobs:
14+
tests:
15+
name: Tests
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: '8.4'
25+
extensions: mbstring, pcntl, bcmath, intl, zip
26+
coverage: none
27+
28+
- name: Get Composer cache directory
29+
id: composer-cache
30+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
31+
32+
- name: Cache Composer dependencies
33+
uses: actions/cache@v4
34+
with:
35+
path: ${{ steps.composer-cache.outputs.dir }}
36+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-composer-
39+
40+
- name: Install Composer dependencies
41+
run: composer install --no-interaction --prefer-dist --optimize-autoloader
42+
43+
- name: Run tests
44+
run: php vendor/bin/pest

.gitignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
/vendor/
2-
/node_modules/
2+
/composer.lock
33
/.phpunit.cache/
4+
/.phpunit.result.cache
45
/.php-cs-fixer.cache
5-
/composer.lock
6-
/.idea/
7-
/.vscode/
8-
*.swp
9-
*.swo
10-
.DS_Store
6+
/node_modules/

.mise/tasks/composer.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run composer commands in the app container"
3+
4+
/usr/bin/env docker compose run --rm app composer "$@"

.mise/tasks/in-app-container.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run a command in an ephemeral app container"
3+
4+
/usr/bin/env docker compose run --rm app "$@"

.mise/tasks/npm.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run npm commands in the app container"
3+
4+
/usr/bin/env docker compose run --rm app bash -c "mise trust && eval \"\$(mise activate bash)\" && npm $*"

.mise/tasks/quality.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run all quality tools"
3+
#USAGE flag "--check-violations" help="Only check for violations, do not fix them"
4+
5+
set -e
6+
7+
CHECK_VIOLATIONS="${usage_check_violations:-false}"
8+
9+
echo
10+
echo "Running PHP CS Fixer..."
11+
if [ "${CHECK_VIOLATIONS}" == "true" ]
12+
then
13+
mise run in-app-container php bin/php-cs-fixer.php check
14+
else
15+
mise run in-app-container php bin/php-cs-fixer.php fix
16+
fi
17+
18+
echo
19+
echo "Running Prettier..."
20+
21+
if [ "${CHECK_VIOLATIONS}" == "true" ]
22+
then
23+
mise run npm run prettier
24+
else
25+
mise run npm run prettier:fix
26+
fi
27+
28+
echo
29+
echo "Running PHPStan..."
30+
mise run in-app-container php vendor/bin/phpstan --memory-limit=1024M
31+
32+
echo
33+
echo "All checks and cleanups completed successfully! ✨"

.mise/tasks/tests.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Run software tests"
3+
4+
set -e
5+
6+
echo
7+
echo "Running unit tests..."
8+
mise run in-app-container php vendor/bin/pest
9+
10+
echo "All tests completed successfully! ✨"

0 commit comments

Comments
 (0)