Skip to content

Commit ad3765e

Browse files
committed
ci: do some more work on the test workflow
1 parent 8c9727b commit ad3765e

2 files changed

Lines changed: 65 additions & 40 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ jobs:
3535
cache: 'yarn'
3636
cache-dependency-path: panel/yarn.lock
3737

38-
- name: Install Pterodactyl dependencies
38+
- name: Install Pterodactyl node dependencies
3939
working-directory: panel
4040
run: yarn install
4141

42-
- name: Overlay Blueprint files
42+
- name: Checkout latest commit
4343
uses: actions/checkout@v4
4444
with:
4545
path: blueprint
4646

47-
- name: Copy Blueprint overlay files
47+
- name: Overwrite Pterodactyl files with latest commit
4848
run: cp -r blueprint/* panel/
4949

5050
- name: Reinstall dependencies
@@ -88,14 +88,26 @@ jobs:
8888
ref: v1.11.11
8989
path: panel
9090

91-
- name: Overlay Blueprint files
91+
- name: Checkout latest commit
9292
uses: actions/checkout@v4
9393
with:
9494
path: blueprint
9595

96-
- name: Copy Blueprint overlay files
96+
- name: Overwrite Pterodactyl files with latest commit
9797
run: cp -r blueprint/* panel/
9898

99+
- name: Prepare Blueprint
100+
working-directory: panel
101+
run: |
102+
echo 'WEBUSER="runner"; OWNERSHIP="runner:runner"; USERSHELL="/bin/bash";' > .blueprintrc
103+
chmod +x blueprint.sh
104+
105+
- name: Install Blueprint
106+
working-directory: panel
107+
run: bash blueprint.sh
108+
env:
109+
BLUEPRINT_ENVIRONMENT: ci
110+
99111
- name: Get cache directory
100112
id: composer-cache
101113
working-directory: panel

blueprint.sh

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -255,9 +255,11 @@ if [[ $1 != "-bash" ]]; then
255255
fi
256256
hide_progress
257257

258-
set -eo pipefail
259-
yarn install
260-
set +eo pipefail
258+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
259+
set -eo pipefail
260+
yarn install
261+
set +eo pipefail
262+
fi
261263

262264
((PROGRESS_NOW++))
263265

@@ -266,20 +268,22 @@ if [[ $1 != "-bash" ]]; then
266268

267269
((PROGRESS_NOW++))
268270

269-
if \
270-
! [ "$OWNERSHIP" = "$D_OWNERSHIP" ] ||
271-
! [ "$WEBUSER" = "$D_WEBUSER" ] ||
272-
! [ "$USERSHELL" = "$D_USERSHELL" ]; then
273-
PRINT WARNING "Blueprint variable customization is deprecated, autogenerating .blueprintrc file.."
274-
if [ -f "$FOLDER/.blueprintrc" ]; then
275-
PRINT WARNING "Could not autogenerate .blueprintrc file, already exists."
276-
else
277-
echo -e \
278-
"OWNERSHIP=\"$OWNERSHIP\"\n" \
279-
"WEBUSER=\"$WEBUSER\"\n" \
280-
"USERSHELL=\"$USERSHELL\"" \
281-
> "$FOLDER/.blueprintrc"
282-
PRINT INFO "Autogenerated .blueprintrc file."
271+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
272+
if \
273+
! [ "$OWNERSHIP" = "$D_OWNERSHIP" ] ||
274+
! [ "$WEBUSER" = "$D_WEBUSER" ] ||
275+
! [ "$USERSHELL" = "$D_USERSHELL" ]; then
276+
PRINT WARNING "Blueprint variable customization is deprecated, autogenerating .blueprintrc file.."
277+
if [ -f "$FOLDER/.blueprintrc" ]; then
278+
PRINT WARNING "Could not autogenerate .blueprintrc file, already exists."
279+
else
280+
echo -e \
281+
"OWNERSHIP=\"$OWNERSHIP\"\n" \
282+
"WEBUSER=\"$WEBUSER\"\n" \
283+
"USERSHELL=\"$USERSHELL\"" \
284+
> "$FOLDER/.blueprintrc"
285+
PRINT INFO "Autogenerated .blueprintrc file."
286+
fi
283287
fi
284288
fi
285289

@@ -306,13 +310,18 @@ if [[ $1 != "-bash" ]]; then
306310
((PROGRESS_NOW++))
307311

308312
# Put application into maintenance.
309-
PRINT INPUT "Would you like to put your application into maintenance while Blueprint is installing? (Y/n)"
310-
hide_progress
311-
read -r YN
312-
if [[ ( $YN == "y"* ) || ( $YN == "Y"* ) || ( $YN == "" ) ]]; then
313-
MAINTENANCE="true"
314-
PRINT INFO "Put application into maintenance mode."
315-
php artisan down &>> "$BLUEPRINT__DEBUG"
313+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
314+
PRINT INPUT "Would you like to put your application into maintenance while Blueprint is installing? (Y/n)"
315+
hide_progress
316+
read -r YN
317+
if [[ ( $YN == "y"* ) || ( $YN == "Y"* ) || ( $YN == "" ) ]]; then
318+
MAINTENANCE="true"
319+
PRINT INFO "Put application into maintenance mode."
320+
php artisan down &>> "$BLUEPRINT__DEBUG"
321+
else
322+
MAINTENANCE="false"
323+
PRINT INFO "Putting application into maintenance has been skipped."
324+
fi
316325
else
317326
MAINTENANCE="false"
318327
PRINT INFO "Putting application into maintenance has been skipped."
@@ -355,10 +364,12 @@ if [[ $1 != "-bash" ]]; then
355364
((PROGRESS_NOW++))
356365

357366
# Make sure all files have correct permissions.
358-
PRINT INFO "Changing Pterodactyl file ownership to '$OWNERSHIP'.."
359-
find "$FOLDER/" \
360-
-path "$FOLDER/node_modules" -prune \
361-
-o -exec chown "$OWNERSHIP" {} + &>> "$BLUEPRINT__DEBUG"
367+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
368+
PRINT INFO "Changing Pterodactyl file ownership to '$OWNERSHIP'.."
369+
find "$FOLDER/" \
370+
-path "$FOLDER/node_modules" -prune \
371+
-o -exec chown "$OWNERSHIP" {} + &>> "$BLUEPRINT__DEBUG"
372+
fi
362373

363374
((PROGRESS_NOW++))
364375

@@ -370,13 +381,15 @@ if [[ $1 != "-bash" ]]; then
370381
((PROGRESS_NOW++))
371382

372383
# Rebuild panel assets.
373-
PRINT INFO "Rebuilding panel assets.."
374-
hide_progress
375-
cd "$FOLDER" || cdhalt
376-
set -eo pipefail
377-
rm -rf "$FOLDER/node_modules/.cache"
378-
yarn run build:production --progress
379-
set +eo pipefail
384+
if [[ $BLUEPRINT_ENVIRONMENT != "ci" ]]; then
385+
PRINT INFO "Rebuilding panel assets.."
386+
hide_progress
387+
cd "$FOLDER" || cdhalt
388+
set -eo pipefail
389+
rm -rf "$FOLDER/node_modules/.cache"
390+
yarn run build:production --progress
391+
set +eo pipefail
392+
fi
380393

381394
((PROGRESS_NOW++))
382395

0 commit comments

Comments
 (0)