Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Aug 14, 2023
1 parent 656b41f commit 06995a3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 49 deletions.
14 changes: 10 additions & 4 deletions .github/scripts/run-client.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/bin/bash

./gradlew $1:runClient > gradle_output.txt 2>&1 &
./gradlew $1:runClient > gradle_client_output.txt 2>&1 &

TARGET_PATTERN='minecraft:textures/atlas/mob_effects\.png-atlas'
TIMEOUT=600
SUCCESS_PATTERN='minecraft:textures/atlas/mob_effects\.png-atlas'
ERROR_PATTERN='Execution failed for task'
TIMEOUT=1800
ELAPSED=0

while [ $ELAPSED -lt $TIMEOUT ]; do
if grep -Eq "$TARGET_PATTERN" gradle_output.txt; then
if grep -Eq "$SUCCESS_PATTERN" gradle_client_output.txt; then
pkill -P $$
exit 0
fi

if grep -Eq "$ERROR_PATTERN" gradle_client_output.txt; then
pkill -P $$
exit 1
fi

sleep 1
ELAPSED=$((ELAPSED + 1))
done
Expand Down
14 changes: 10 additions & 4 deletions .github/scripts/run-server.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/bin/bash

./gradlew $1:runServer --args="nogui" > gradle_output.txt 2>&1 &
./gradlew $1:runServer --args="nogui" > gradle_server_output.txt 2>&1 &

TARGET_PATTERN='For help, type "help"'
TIMEOUT=600
SUCCESS_PATTERN='For help, type "help"'
ERROR_PATTERN='Execution failed for task'
TIMEOUT=1800
ELAPSED=0

while [ $ELAPSED -lt $TIMEOUT ]; do
if grep -Eq "$TARGET_PATTERN" gradle_output.txt; then
if grep -Eq "$SUCCESS_PATTERN" gradle_server_output.txt; then
pkill -P $$
exit 0
fi

if grep -Eq "$ERROR_PATTERN" gradle_server_output.txt; then
pkill -P $$
exit 1
fi

sleep 1
ELAPSED=$((ELAPSED + 1))
done
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: "Build with gradle"
run: ./gradlew build

run-clients:
run-client:
needs: build
runs-on: ubuntu-latest
strategy:
Expand All @@ -44,7 +44,7 @@ jobs:
run: ./.github/scripts/run-client.sh ${{ matrix.mod_loader }}
shell: bash

run-servers:
run-server:
needs: build
runs-on: ubuntu-latest
strategy:
Expand All @@ -63,7 +63,5 @@ jobs:
uses: ./.github/actions/setup-environment

- name: "Run server"
uses: modmuss50/xvfb-action@v1
with:
run: ./.github/scripts/run-server.sh ${{ matrix.mod_loader }}
shell: bash
run: ./.github/scripts/run-server.sh ${{ matrix.mod_loader }}
shell: bash
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ classes/
.settings
*.launch
.architectury-transformer
.gradle_output.txt
gradle_client_output.txt
gradle_server_output.txt
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ fabric_api_version=0.76.0+1.19.2
forge_version=1.19.2-43.2.11

# Quilt https://lambdaurora.dev/tools/import_quilt.html
quilt_loader_version=0.19.0-beta.13
quilt_loader_version=0.19.3
quilt_fabric_api_version=4.0.0-beta.30+0.76.0-1.19.2
33 changes: 0 additions & 33 deletions gradle_output.txt

This file was deleted.

0 comments on commit 06995a3

Please sign in to comment.