Skip to content

Commit

Permalink
Added new workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Faboslav committed Jan 22, 2024
1 parent bf96f4a commit cfc2bbf
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 284 deletions.
27 changes: 0 additions & 27 deletions .github/actions/setup-environment/action.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/scripts/run-client.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

./gradlew $1:runClient > gradle_client_output.txt 2>&1 &
./gradlew $1:runClient --no-daemon 2>&1 | tee gradle_client_output.txt &

SUCCESS_PATTERN='minecraft:textures/atlas/mob_effects\.png-atlas'
ERROR_PATTERNS=(
Expand Down
4 changes: 3 additions & 1 deletion .github/scripts/run-server.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash

./gradlew $1:runServer --args="nogui" > gradle_server_output.txt 2>&1 &
mkdir -p $1/run && echo "eula=true" > $1/run/eula.txt

./gradlew $1:runServer --no-daemon --args="nogui" 2>&1 | tee gradle_server_output.txt &

SUCCESS_PATTERN='For help, type "help"'
ERROR_PATTERNS=(
Expand Down
80 changes: 33 additions & 47 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,69 +11,55 @@ on:

jobs:
build:
runs-on: ubuntu-latest
name: "Build"
timeout-minutes: 15

steps:
- name: "Checkout repository"
uses: actions/[email protected]
with:
fetch-depth: 0

- name: "Setup environment"
uses: ./.github/actions/setup-environment

- name: "Build with gradle"
run: ./gradlew build

run-client:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mod_loader: [ "fabric", "forge" ]
name: Run ${{ matrix.mod_loader }} client
mod_loader: [fabric, forge, neoforge]
script: [client, server]

name: Run ${{ matrix.mod_loader }} ${{ matrix.script }}
timeout-minutes: 15

steps:
- name: "Checkout repository"
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0

- name: "Setup environment"
uses: ./.github/actions/setup-environment
- name: "Check if the mod loader is supported"
id: check-mod-loader
run: |
if [ -d ${{ matrix.mod_loader }} ]; then
echo "Mod loader is supported"
echo "is_mod_loader_supported=true" >> $GITHUB_OUTPUT
else
echo "Mod loader is not supported"
echo "is_mod_loader_supported=false" >> $GITHUB_OUTPUT
fi
- name: Run ${{ matrix.mod_loader }} client
uses: modmuss50/xvfb-action@v1
- name: "Set up JDK"
if: steps.check-mod-loader.outputs.is_mod_loader_supported == 'true'
uses: actions/[email protected]
with:
run: ./.github/scripts/run-client.sh ${{ matrix.mod_loader }}
shell: bash
java-version: 17
distribution: temurin

run-server:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mod_loader: [ "fabric", "forge" ]
name: Run ${{ matrix.mod_loader }} server
timeout-minutes: 15

steps:
- name: "Checkout repository"
uses: actions/[email protected]
- name: "Setup Gradle and run build"
if: steps.check-mod-loader.outputs.is_mod_loader_supported == 'true'
uses: gradle/[email protected]
with:
fetch-depth: 0

- name: "Setup environment"
uses: ./.github/actions/setup-environment
cache-read-only: false
gradle-version: wrapper
arguments: ${{ matrix.mod_loader }}:build

- name: "Accept eula"
if: steps.check-mod-loader.outputs.is_mod_loader_supported == 'true'
run: mkdir -p ${{ matrix.mod_loader }}/run && echo "eula=true" > ${{ matrix.mod_loader }}/run/eula.txt

- name: Run ${{ matrix.mod_loader }} server
run: ./.github/scripts/run-server.sh ${{ matrix.mod_loader }}
shell: bash
- name: Run ${{ matrix.mod_loader }} ${{ matrix.script }}
if: steps.check-mod-loader.outputs.is_mod_loader_supported == 'true'
uses: modmuss50/xvfb-action@v1
with:
run: ./.github/scripts/run-${{ matrix.script }}.sh ${{ matrix.mod_loader }}
shell: bash
Loading

0 comments on commit cfc2bbf

Please sign in to comment.