diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f9f3940f..0ca80310 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,7 +1,12 @@ name: Tests -on: [push] -permissions: {} +on: + push: + branches: + - "main" + pull_request: + branches: + - "main" jobs: shellcheck: @@ -62,10 +67,7 @@ jobs: matrix: php: [8.2, 8.3] database: - - mariadb:10.5 - - mariadb:10.11 - mariadb:11.5 - - mysql:8 - mysql:9 services: database: @@ -80,7 +82,6 @@ jobs: uses: actions/checkout@v4 with: repository: pterodactyl/panel - ref: v1.11.11 path: panel - name: Install apt dependencies @@ -113,13 +114,6 @@ jobs: echo 'WEBUSER="runner"; OWNERSHIP="runner:runner"; USERSHELL="/bin/bash";' > .blueprintrc chmod +x blueprint.sh - - name: Setup Blueprint - working-directory: panel - run: bash blueprint.sh - env: - BLUEPRINT_ENVIRONMENT: ci - TERM: xterm-kitty #fixes tput errors - - name: Get cache directory id: composer-cache working-directory: panel @@ -150,6 +144,13 @@ jobs: working-directory: panel run: composer install --no-interaction --no-progress --no-suggest --prefer-dist + - name: Setup Blueprint + working-directory: panel + run: bash blueprint.sh + env: + BLUEPRINT_ENVIRONMENT: ci + TERM: xterm-kitty #fixes tput errors + - name: Unit tests working-directory: panel run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a626e616..e17f7fd7 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -8,11 +8,12 @@ use Illuminate\Database\Console\PruneCommand; use Pterodactyl\Repositories\Eloquent\SettingsRepository; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; -use Pterodactyl\BlueprintFramework\GetExtensionSchedules; use Pterodactyl\Services\Telemetry\TelemetryCollectionService; use Pterodactyl\Console\Commands\Schedule\ProcessRunnableCommand; use Pterodactyl\Console\Commands\Maintenance\PruneOrphanedBackupsCommand; use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand; + +use Pterodactyl\BlueprintFramework\GetExtensionSchedules; use Pterodactyl\Services\Telemetry\RegisterBlueprintTelemetry; use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary as BlueprintExtensionLibrary; diff --git a/app/Transformers/Api/Client/ServerTransformer.php b/app/Transformers/Api/Client/ServerTransformer.php index 8dc2f569..d0817a82 100644 --- a/app/Transformers/Api/Client/ServerTransformer.php +++ b/app/Transformers/Api/Client/ServerTransformer.php @@ -31,7 +31,7 @@ public function getResourceName(): string */ public function transform(Server $server): array { - /** @var \Pterodactyl\Services\Servers\StartupCommandService $service */ + /** @var StartupCommandService $service */ $service = Container::getInstance()->make(StartupCommandService::class); $user = $this->request->user(); diff --git a/blueprint.sh b/blueprint.sh index 0dbd79a6..e79e6c03 100644 --- a/blueprint.sh +++ b/blueprint.sh @@ -248,12 +248,14 @@ if [[ $1 != "-bash" ]]; then export PROGRESS_NOW=0 fi - PRINT INFO "Installing node modules.." - # Check for yarn before installing node modules.. - if ! [ -x "$(command -v yarn)" ]; then - PRINT FATAL "Missing dependency \"yarn\"." + if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then + PRINT INFO "Installing node modules.." + # Check for yarn before installing node modules.. + if ! [ -x "$(command -v yarn)" ]; then + PRINT FATAL "Missing dependency \"yarn\"." + fi + hide_progress fi - hide_progress if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then set -eo pipefail @@ -330,7 +332,7 @@ if [[ $1 != "-bash" ]]; then ((PROGRESS_NOW++)) # Run migrations if Blueprint is not running through Docker. - if [[ $DOCKER != "y" ]]; then + if [[ ( $DOCKER != "y" ) && ( $BLUEPRINT_ENVIRONMENT != "ci" ) ]]; then PRINT INFO "Running database migrations.." hide_progress php artisan migrate --force @@ -339,21 +341,25 @@ if [[ $1 != "-bash" ]]; then ((PROGRESS_NOW++)) # Seed Blueprint database records - PRINT INFO "Seeding Blueprint database records.." - php artisan db:seed --class=BlueprintSeeder --force &>> "$BLUEPRINT__DEBUG" + if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then + PRINT INFO "Seeding Blueprint database records.." + php artisan db:seed --class=BlueprintSeeder --force &>> "$BLUEPRINT__DEBUG" + fi ((PROGRESS_NOW++)) # Flush cache. - PRINT INFO "Flushing cache.." - { - php artisan view:cache - php artisan config:cache - php artisan route:clear - php artisan cache:clear - php artisan bp:cache - php artisan bp:version:cache - } &>> "$BLUEPRINT__DEBUG" + if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then + PRINT INFO "Flushing cache.." + { + php artisan view:cache + php artisan config:cache + php artisan route:clear + php artisan cache:clear + php artisan bp:cache + php artisan bp:version:cache + } &>> "$BLUEPRINT__DEBUG" + fi ((PROGRESS_NOW++))