Skip to content

Commit f3e28c3

Browse files
authored
Merge pull request #182 from BlueprintFramework/add-ci-tests
Add/update ci tests
2 parents bcb2768 + f579e94 commit f3e28c3

File tree

4 files changed

+40
-32
lines changed

4 files changed

+40
-32
lines changed

.github/workflows/ci.yaml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
name: Tests
22

3-
on: [push]
4-
permissions: {}
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
branches:
9+
- "main"
510

611
jobs:
712
shellcheck:
@@ -62,10 +67,7 @@ jobs:
6267
matrix:
6368
php: [8.2, 8.3]
6469
database:
65-
- mariadb:10.5
66-
- mariadb:10.11
6770
- mariadb:11.5
68-
- mysql:8
6971
- mysql:9
7072
services:
7173
database:
@@ -80,7 +82,6 @@ jobs:
8082
uses: actions/checkout@v4
8183
with:
8284
repository: pterodactyl/panel
83-
ref: v1.11.11
8485
path: panel
8586

8687
- name: Install apt dependencies
@@ -113,13 +114,6 @@ jobs:
113114
echo 'WEBUSER="runner"; OWNERSHIP="runner:runner"; USERSHELL="/bin/bash";' > .blueprintrc
114115
chmod +x blueprint.sh
115116
116-
- name: Setup Blueprint
117-
working-directory: panel
118-
run: bash blueprint.sh
119-
env:
120-
BLUEPRINT_ENVIRONMENT: ci
121-
TERM: xterm-kitty #fixes tput errors
122-
123117
- name: Get cache directory
124118
id: composer-cache
125119
working-directory: panel
@@ -150,6 +144,13 @@ jobs:
150144
working-directory: panel
151145
run: composer install --no-interaction --no-progress --no-suggest --prefer-dist
152146

147+
- name: Setup Blueprint
148+
working-directory: panel
149+
run: bash blueprint.sh
150+
env:
151+
BLUEPRINT_ENVIRONMENT: ci
152+
TERM: xterm-kitty #fixes tput errors
153+
153154
- name: Unit tests
154155
working-directory: panel
155156
run: vendor/bin/phpunit --bootstrap vendor/autoload.php tests/Unit

app/Console/Kernel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
use Illuminate\Database\Console\PruneCommand;
99
use Pterodactyl\Repositories\Eloquent\SettingsRepository;
1010
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
11-
use Pterodactyl\BlueprintFramework\GetExtensionSchedules;
1211
use Pterodactyl\Services\Telemetry\TelemetryCollectionService;
1312
use Pterodactyl\Console\Commands\Schedule\ProcessRunnableCommand;
1413
use Pterodactyl\Console\Commands\Maintenance\PruneOrphanedBackupsCommand;
1514
use Pterodactyl\Console\Commands\Maintenance\CleanServiceBackupFilesCommand;
15+
16+
use Pterodactyl\BlueprintFramework\GetExtensionSchedules;
1617
use Pterodactyl\Services\Telemetry\RegisterBlueprintTelemetry;
1718
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Console\BlueprintConsoleLibrary as BlueprintExtensionLibrary;
1819

app/Transformers/Api/Client/ServerTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getResourceName(): string
3131
*/
3232
public function transform(Server $server): array
3333
{
34-
/** @var \Pterodactyl\Services\Servers\StartupCommandService $service */
34+
/** @var StartupCommandService $service */
3535
$service = Container::getInstance()->make(StartupCommandService::class);
3636

3737
$user = $this->request->user();

blueprint.sh

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,14 @@ if [[ $1 != "-bash" ]]; then
248248
export PROGRESS_NOW=0
249249
fi
250250

251-
PRINT INFO "Installing node modules.."
252-
# Check for yarn before installing node modules..
253-
if ! [ -x "$(command -v yarn)" ]; then
254-
PRINT FATAL "Missing dependency \"yarn\"."
251+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
252+
PRINT INFO "Installing node modules.."
253+
# Check for yarn before installing node modules..
254+
if ! [ -x "$(command -v yarn)" ]; then
255+
PRINT FATAL "Missing dependency \"yarn\"."
256+
fi
257+
hide_progress
255258
fi
256-
hide_progress
257259

258260
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
259261
set -eo pipefail
@@ -330,7 +332,7 @@ if [[ $1 != "-bash" ]]; then
330332
((PROGRESS_NOW++))
331333

332334
# Run migrations if Blueprint is not running through Docker.
333-
if [[ $DOCKER != "y" ]]; then
335+
if [[ ( $DOCKER != "y" ) && ( $BLUEPRINT_ENVIRONMENT != "ci" ) ]]; then
334336
PRINT INFO "Running database migrations.."
335337
hide_progress
336338
php artisan migrate --force
@@ -339,21 +341,25 @@ if [[ $1 != "-bash" ]]; then
339341
((PROGRESS_NOW++))
340342

341343
# Seed Blueprint database records
342-
PRINT INFO "Seeding Blueprint database records.."
343-
php artisan db:seed --class=BlueprintSeeder --force &>> "$BLUEPRINT__DEBUG"
344+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
345+
PRINT INFO "Seeding Blueprint database records.."
346+
php artisan db:seed --class=BlueprintSeeder --force &>> "$BLUEPRINT__DEBUG"
347+
fi
344348

345349
((PROGRESS_NOW++))
346350

347351
# Flush cache.
348-
PRINT INFO "Flushing cache.."
349-
{
350-
php artisan view:cache
351-
php artisan config:cache
352-
php artisan route:clear
353-
php artisan cache:clear
354-
php artisan bp:cache
355-
php artisan bp:version:cache
356-
} &>> "$BLUEPRINT__DEBUG"
352+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
353+
PRINT INFO "Flushing cache.."
354+
{
355+
php artisan view:cache
356+
php artisan config:cache
357+
php artisan route:clear
358+
php artisan cache:clear
359+
php artisan bp:cache
360+
php artisan bp:version:cache
361+
} &>> "$BLUEPRINT__DEBUG"
362+
fi
357363

358364
((PROGRESS_NOW++))
359365

0 commit comments

Comments
 (0)