Adapt workflows for running from this repo

This commit is contained in:
Raven Szewczyk
2022-07-07 17:28:34 +01:00
parent 95fb3b5e5c
commit 416d9dd1d5
4 changed files with 19 additions and 5 deletions

View File

@@ -1,51 +0,0 @@
#!/usr/bin/env bash
# bashsupport disable=BP5006 # Global environment variables
RUNDIR="run" \
CRASH="crash-reports" \
SERVERLOG="server.log"
# enable nullglob to get 0 results when no match rather than the pattern
shopt -s nullglob
# store matches in array
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
# if array not empty there are crash_reports
if [ "${#crash_reports[@]}" -gt 0 ]; then
# get the latest crash_report from array
latest_crash_report="${crash_reports[-1]}"
{
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
cat "$latest_crash_report"
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
{
printf 'Fatal errors detected:\n'
cat server.log
} >&2
exit 1
fi
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
"$SERVERLOG"; then
{
printf 'Server force stopped:'
cat server.log
} >&2
exit 1
fi
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
{
printf 'Server did not finish startup:'
cat server.log
} >&2
exit 1
fi
printf 'No crash reports detected'
exit 0

View File

@@ -1,12 +0,0 @@
#!/usr/bin/env bash
if ! git diff --name-only HEAD HEAD~1 | grep -qF 'build.gradle'; then
new_version="$(date +%s)"
sed --in-place "s!^//version:.*!//version: $new_version!g" build.gradle
git add build.gradle
git commit -m "[ci skip] update build script version to $new_version"
git push
printf 'Updated buildscript version to %s\n' "$new_version"
else
printf 'Ignored buildscript version update: no changes detected\n'
fi

View File

@@ -10,9 +10,16 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout mod repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout workflows repo
uses: actions/checkout@v3
with:
repository: GTNewHorizons/GTNH-Actions-Workflows
path: .gtnh-workflows
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
@@ -38,5 +45,5 @@ jobs:
- name: Test no errors reported during server run
run: |
chmod +x .github/scripts/test_no_error_reports
.github/scripts/test_no_error_reports
chmod +x .gtnh-workflows/scripts/test_no_error_reports
.gtnh-workflows/scripts/test_no_error_reports

View File

@@ -5,14 +5,20 @@ name: Release tagged build
on:
workflow_call:
secrets:
MAVEN_USER:
required: false
MAVEN_PASSWORD:
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout mod repo
uses: actions/checkout@v2
with:
fetch-depth: 0
fetch-depth: 32
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
@@ -47,3 +53,4 @@ jobs:
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
if: ${{ env.MAVEN_USER != '' }}