mirror of
https://github.com/the-programmers-hangout/Hermes.git
synced 2026-09-04 01:06:00 +02:00
github actions
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["**"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
name: PHP ${{ matrix.php }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
php: ["8.4"]
|
||||
|
||||
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.4'
|
||||
env:
|
||||
APP_ENV: development
|
||||
run: php laracord app:build
|
||||
|
||||
- name: Upload build artifact
|
||||
if: matrix.php == '8.4'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: laracord-build-php84
|
||||
path: builds/laracord
|
||||
if-no-files-found: error
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FROM composer:2-php8.4 AS builder
|
||||
|
||||
WORKDIR /build
|
||||
ENV APP_ENV=development
|
||||
|
||||
COPY composer.json composer.lock* ./
|
||||
RUN composer install --no-dev --prefer-dist --no-interaction --optimize-autoloader
|
||||
|
||||
COPY . .
|
||||
RUN php laracord app:build \
|
||||
&& mkdir -p /out \
|
||||
&& cp builds/laracord /out/laracord
|
||||
|
||||
FROM php:8.4-cli-alpine AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /out/laracord /app/laracord
|
||||
RUN chmod +x /app/laracord
|
||||
|
||||
CMD ["php", "/app/laracord"]
|
||||
+19
-1
@@ -2,7 +2,11 @@
|
||||
"name": "laracord/laracord",
|
||||
"type": "project",
|
||||
"description": "Create Discord bots harnessing the full power of Laravel.",
|
||||
"keywords": ["framework", "laravel", "discord"],
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel",
|
||||
"discord"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
@@ -20,6 +24,20 @@
|
||||
}
|
||||
},
|
||||
"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"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
]
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
services:
|
||||
mimic:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: mimic
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./.env:/app/.env:ro
|
||||
@@ -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