mirror of
https://github.com/the-programmers-hangout/Mimic.git
synced 2026-09-04 01:06:00 +02:00
github actions take 1
This commit is contained in:
@@ -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
|
||||||
@@ -3,3 +3,4 @@
|
|||||||
/.laracord
|
/.laracord
|
||||||
*.sqlite
|
*.sqlite
|
||||||
.env
|
.env
|
||||||
|
.box_dump
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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');\""
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user