diff options
| author | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-17 18:11:17 +0100 |
|---|---|---|
| committer | Johann Bernhardt <johann.bernhardt@tum.de> | 2021-12-17 18:11:17 +0100 |
| commit | 8d5b072e989cda9b38d6f56b843f76ac7a37b986 (patch) | |
| tree | ec91a83d5a690f3cd0bef6344497299eb5efe261 | |
| parent | edec7d539ffe2431917b3469f5dee8d03f90c6f2 (diff) | |
| download | GT5-Unofficial-8d5b072e989cda9b38d6f56b843f76ac7a37b986.tar.gz GT5-Unofficial-8d5b072e989cda9b38d6f56b843f76ac7a37b986.tar.bz2 GT5-Unofficial-8d5b072e989cda9b38d6f56b843f76ac7a37b986.zip | |
Update build script and CI
| -rw-r--r-- | .github/scripts/test-no-crash-reports.sh | 9 | ||||
| -rw-r--r-- | .github/scripts/test-no-error-reports.sh | 27 | ||||
| -rw-r--r-- | .github/workflows/build-and-test.yml | 12 | ||||
| -rw-r--r-- | .github/workflows/release-tags.yml | 16 | ||||
| -rw-r--r-- | build.gradle | 35 |
5 files changed, 83 insertions, 16 deletions
diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh deleted file mode 100644 index c67e342c06..0000000000 --- a/.github/scripts/test-no-crash-reports.sh +++ /dev/null @@ -1,9 +0,0 @@ -directory="run/crash-reports" -if [ -d $directory ]; then - echo "Crash reports detected:" - cat $directory/* - exit 1 -else - echo "No crash reports detected" - exit 0 -fi diff --git a/.github/scripts/test-no-error-reports.sh b/.github/scripts/test-no-error-reports.sh new file mode 100644 index 0000000000..e3876606d5 --- /dev/null +++ b/.github/scripts/test-no-error-reports.sh @@ -0,0 +1,27 @@ +if [[ -d "run/crash-reports" ]]; then + echo "Crash reports detected:" + cat $directory/* + exit 1 +fi + +if grep --quiet "Fatal errors were detected" server.log; then + echo "Fatal errors detected:" + cat server.log + exit 1 +fi + +if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" server.log; then + echo "Server force stopped:" + cat server.log + exit 1 +fi + +if grep --quiet 'Done .+ For help, type "help" or "?"' server.log; then + echo "Server didn't finish startup:" + cat server.log + exit 1 +fi + +echo "No crash reports detected" +exit 0 + diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a60a2b6468..08df9fe89f 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -29,17 +29,17 @@ jobs: - name: Setup the workspace run: ./gradlew setupCIWorkspace - + - name: Build the mod run: ./gradlew build - - name: Run server for 1 minute + - name: Run server for 1.5 minutes run: | mkdir run echo "eula=true" > run/eula.txt - timeout 60 ./gradlew runServer || true + timeout 90 ./gradlew runServer | tee --append server.log || true - - name: Test no crashes happend + - name: Test no errors reported during server run run: | - chmod +x .github/scripts/test-no-crash-reports.sh - .github/scripts/test-no-crash-reports.sh + chmod +x .github/scripts/test-no-error-reports.sh + .github/scripts/test-no-error-reports.sh diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index 25c354b227..96d37f7d9a 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -43,3 +43,19 @@ jobs: prerelease: false title: "${{ env.RELEASE_VERSION }}" files: build/libs/*.jar + + - name: Set repository owner and name + run: | + echo "REPOSITORY_OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV + echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV + + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ARTIFACT_GROUP_ID: com.github.${{ env.REPOSITORY_OWNER }} + ARTIFACT_ID: "${{ env.REPOSITORY_NAME }}" + ARTIFACT_VERSION: "${{ env.RELEASE_VERSION }}" + REPOSITORY_NAME: "${{ env.REPOSITORY_NAME }}" + REPOSITORY_OWNER: "${{ env.REPOSITORY_OWNER }}" + diff --git a/build.gradle b/build.gradle index cc7c49c4d7..2ec9a2ebac 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: aa8aff90655e0509464d4a8dc42c38d3614c1260 +//version: be36e1399d5622c152db7c530c48e17cde0ce1bb /* DO NOT CHANGE THIS FILE! @@ -42,6 +42,7 @@ plugins { id("org.ajoberstar.grgit") version("3.1.1") id("com.github.johnrengelman.shadow") version("4.0.4") id("com.palantir.git-version") version("0.12.3") + id("maven-publish") } apply plugin: 'forge' @@ -460,6 +461,38 @@ artifacts { } } +// publishing +publishing { + publications { + maven(MavenPublication) { + artifact source: jar + artifact source: sourcesJar, classifier: "src" + artifact source: devJar, classifier: "dev" + if (apiPackage) { + archives source: apiJar, classifier: "api" + } + + groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group + artifactId = System.getenv("ARTIFACT_ID") ?: project.name + version = System.getenv("ARTIFACT_VERSION") ?: project.version + } + } + + repositories { + maven { + String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown" + String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown" + String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName" + name = "GitHubPackages" + url = githubRepositoryUrl + credentials { + username = System.getenv("GITHUB_ACTOR") ?: "NONE" + password = System.getenv("GITHUB_TOKEN") ?: "NONE" + } + } + } +} + // Updating task updateBuildScript { doLast { |
