github actions take 1

This commit is contained in:
itsAzaria
2026-02-19 00:48:12 +00:00
parent e2fbce88c4
commit 946ed945cc
5 changed files with 95 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
name: CI
on:
push:
branches: ["**"]
pull_request:
jobs:
quality:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ["8.2", "8.3"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- name: Validate composer.json
run: composer validate --strict
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Run CI checks
run: composer ci
- name: Build app
if: matrix.php == '8.2'
run: composer ci:build
- name: Upload build artifact
if: matrix.php == '8.2'
uses: actions/upload-artifact@v4
with:
name: laracord-build-php82
path: builds/laracord
if-no-files-found: error
+1
View File
@@ -3,3 +3,4 @@
/.laracord /.laracord
*.sqlite *.sqlite
.env .env
.box_dump
+6
View File
@@ -56,6 +56,12 @@ Use `--no-migrate` if you want to skip migrations on boot.
## Dev ## Dev
Run CI checks locally:
```bash
composer ci
```
Format with Pint: Format with Pint:
```bash ```bash
+14
View File
@@ -20,6 +20,20 @@
} }
}, },
"scripts": { "scripts": {
"lint": [
"@php scripts/php-lint.php"
],
"format:check": [
"vendor/bin/pint --test"
],
"ci": [
"@composer validate --strict",
"@composer lint",
"@composer format:check"
],
"ci:build": [
"@php laracord app:build --build-version=ci"
],
"post-root-package-install": [ "post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
] ]
+28
View File
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
$directories = ['app', 'bootstrap', 'config', 'database'];
foreach ($directories as $directory) {
if (! is_dir($directory)) {
continue;
}
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($directory, FilesystemIterator::SKIP_DOTS)
);
foreach ($iterator as $file) {
if (! $file->isFile() || $file->getExtension() !== 'php') {
continue;
}
$command = sprintf('php -l %s', escapeshellarg($file->getPathname()));
passthru($command, $exitCode);
if ($exitCode !== 0) {
exit($exitCode);
}
}
}