mirror of
https://github.com/FalsePattern/fpgradle-workflows.git
synced 2025-04-20 06:22:28 +02:00
initial commit
This commit is contained in:
commit
e712d8f149
6 changed files with 371 additions and 0 deletions
51
.github/scripts/test_no_error_reports
vendored
Executable file
51
.github/scripts/test_no_error_reports
vendored
Executable file
|
@ -0,0 +1,51 @@
|
|||
#!/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
|
100
.github/workflows/build-and-test.yml
vendored
Normal file
100
.github/workflows/build-and-test.yml
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||
|
||||
name: Build and test
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
timeout:
|
||||
description: 'Timeout for runServer (seconds)'
|
||||
required: false
|
||||
default: 90
|
||||
type: number
|
||||
workspace:
|
||||
description: 'setupCIWorkspace/setupDecompWorkspace'
|
||||
required: false
|
||||
default: "setupCIWorkspace"
|
||||
type: string
|
||||
client-only:
|
||||
description: 'Do not execute runServer'
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Ubuntu dependencies
|
||||
run: |
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install -y mesa-utils xvfb x11-xserver-utils
|
||||
- name: Checkout mod repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Checkout workflows repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: FalsePattern/fpgradle-workflows
|
||||
path: .fpgradle-workflows
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Validate gradle wrapper checksum
|
||||
uses: gradle/wrapper-validation-action@v2
|
||||
|
||||
- name: Set up JDK versions
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: |
|
||||
8
|
||||
17
|
||||
21
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Setup the workspace
|
||||
run: ./gradlew --build-cache --info --stacktrace ${{ inputs.workspace }}
|
||||
|
||||
- name: Compile the mod
|
||||
run: ./gradlew --build-cache --info --stacktrace assemble
|
||||
|
||||
- name: Attach compilation artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.repository_id }}-build-libs
|
||||
path: build/libs/
|
||||
retention-days: 31
|
||||
|
||||
- name: Run post-build checks
|
||||
id: build_mod
|
||||
run: xvfb-run --server-args="-screen 0 1366x768x24" ./gradlew --build-cache --info --stacktrace build
|
||||
|
||||
- name: Attach gradle reports
|
||||
if: failure() && steps.build_mod.conclusion == 'failure'
|
||||
uses: actions/upload-artifact@v4
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: ${{ github.repository_id }}-reports
|
||||
path: build/reports/
|
||||
retention-days: 31
|
||||
|
||||
- name: Run server for ${{ inputs.timeout }} seconds
|
||||
if: ${{ !inputs.client-only }}
|
||||
run: |
|
||||
mkdir -p run
|
||||
echo "eula=true" > run/eula.txt
|
||||
# Set a constant seed with a village at spawn
|
||||
echo "level-seed=-6202107849386030209\nonline-mode=true\n" > run/server.properties
|
||||
echo "stop" > run/stop.txt
|
||||
timeout ${{ inputs.timeout }} ./gradlew --build-cache --info --stacktrace runServer 2>&1 < run/stop.txt | tee -a server.log || true
|
||||
|
||||
- name: Test no errors reported during server run
|
||||
if: ${{ !inputs.client-only }}
|
||||
run: |
|
||||
chmod +x .fpgradle-workflows/scripts/test_no_error_reports
|
||||
.fpgradle-workflows/scripts/test_no_error_reports
|
84
.github/workflows/release-tags.yml
vendored
Normal file
84
.github/workflows/release-tags.yml
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
|
||||
name: Release tagged build
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
MAVEN_USER:
|
||||
required: false
|
||||
MAVEN_PASSWORD:
|
||||
required: false
|
||||
CURSEFORGE_TOKEN:
|
||||
required: false
|
||||
MODRINTH_TOKEN:
|
||||
required: false
|
||||
inputs:
|
||||
workspace:
|
||||
description: 'setupCIWorkspace/setupDecompWorkspace'
|
||||
required: false
|
||||
default: "setupCIWorkspace"
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VERSION: ${{ github.ref_name }}
|
||||
RELEASE_VERSION: ${{ github.ref_name }}
|
||||
steps:
|
||||
- name: Checkout mod repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 32
|
||||
|
||||
- name: Validate gradle wrapper checksum
|
||||
uses: gradle/wrapper-validation-action@v2
|
||||
|
||||
- name: Set up JDK versions
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: |
|
||||
8
|
||||
17
|
||||
21
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Setup the workspace
|
||||
run: ./gradlew --build-cache --info --stacktrace ${{ inputs.workspace }}
|
||||
|
||||
- name: Build the mod
|
||||
run: ./gradlew --build-cache --info --stacktrace assemble
|
||||
|
||||
# Continue on error in the following steps to make sure releases still get made even if one of the methods fails
|
||||
|
||||
- name: Delete old release if it already exists
|
||||
run: gh release delete --yes "${RELEASE_VERSION}"
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Release under current tag
|
||||
run: gh release create "${RELEASE_VERSION}" ./build/libs/*.jar
|
||||
shell: bash
|
||||
continue-on-error: true
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Publish to Maven
|
||||
run: ./gradlew --build-cache --info --stacktrace assemble publish -x test
|
||||
continue-on-error: true
|
||||
env:
|
||||
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
|
||||
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
|
||||
if: ${{ env.MAVEN_DEPLOY_USER != '' }}
|
||||
|
||||
- name: Publish to Modrinth and CurseForge
|
||||
run: ./gradlew --build-cache --info --stacktrace assemble publish -x test
|
||||
continue-on-error: true
|
||||
env:
|
||||
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
|
||||
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
|
92
.gitignore
vendored
Normal file
92
.gitignore
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all
|
||||
|
||||
### Intellij+all ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
.idea/artifacts
|
||||
.idea/compiler.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/modules.xml
|
||||
.idea/*.iml
|
||||
.idea/modules
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### Intellij+all Patch ###
|
||||
# Ignore everything but code style settings and run configurations
|
||||
# that are supposed to be shared within teams.
|
||||
|
||||
.idea/*
|
||||
|
||||
!.idea/codeStyles
|
||||
!.idea/runConfigurations
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/intellij+all
|
23
CREDITS
Normal file
23
CREDITS
Normal file
|
@ -0,0 +1,23 @@
|
|||
Based on the GTNH-Actions-Workflows repository
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 GTNH Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 FalsePattern
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
Loading…
Add table
Reference in a new issue