Skip to content

Commit d229c0c

Browse files
committed
build: Bump gradle/plugins, use shared workflows
1 parent 013d922 commit d229c0c

File tree

11 files changed

+55
-156
lines changed

11 files changed

+55
-156
lines changed
Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,12 @@
1-
# This workflow will build a Java project with Gradle
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3-
41
name: License Check
52

63
on:
74
push:
8-
branches: [ stable-7, 'api-*' ]
5+
branches: "**"
6+
tags-ignore: ["**"]
97
pull_request:
10-
branches: [ stable-7, 'api-*' ]
118

129
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/cache@v2
18-
with:
19-
path: ~/.gradle/caches
20-
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}"
21-
restore-keys: |
22-
${{ runner.os }}-gradle-
23-
- name: Set up JDK 11
24-
uses: actions/setup-java@v2
25-
with:
26-
distribution: adopt
27-
java-version: 11
28-
- name: Build with Gradle
29-
run: ./gradlew checkLicenses
10+
call-check:
11+
uses: SpongePowered/.github/.github/workflows/shared-check-license.yaml@master
12+
secrets: inherit

.github/workflows/check-style.yaml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,12 @@
1-
# This workflow will build a Java project with Gradle
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3-
4-
name: Checkstyle Run
1+
name: Checkstyle
52

63
on:
74
push:
8-
branches: [ stable-7, 'api-*' ]
5+
branches: "**"
6+
tags-ignore: ["**"]
97
pull_request:
10-
branches: [ stable-7, 'api-*' ]
118

129
jobs:
13-
build:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/cache@v2
18-
with:
19-
path: ~/.gradle/caches
20-
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}"
21-
restore-keys: |
22-
${{ runner.os }}-gradle-
23-
- name: Set up JDK 11
24-
uses: actions/setup-java@v2
25-
with:
26-
distribution: adopt
27-
java-version: 11
28-
- name: Build with Gradle
29-
run: ./gradlew checkstyleAll
10+
call-check:
11+
uses: SpongePowered/.github/.github/workflows/shared-check-style.yaml@master
12+
secrets: inherit

.github/workflows/ci.yaml

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -10,93 +10,9 @@ on:
1010
release:
1111
types: [released]
1212

13-
env:
14-
PROJECT_NAME: spongeapi
15-
1613
jobs:
17-
build:
18-
# Only run on PRs if the source branch is on someone else's repo
19-
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}"
20-
21-
runs-on: "${{ matrix.os }}"
22-
strategy:
23-
matrix:
24-
os: [ubuntu-20.04, windows-latest]
25-
steps:
26-
# Setup
27-
- name: Check out
28-
uses: actions/checkout@v2
29-
with:
30-
ssh-key: ${{ secrets.SPONGE_JD_DEPLOY_KEY }}
31-
- name: Setup JDK 11
32-
uses: actions/setup-java@v2
33-
with:
34-
distribution: adopt
35-
java-version: 11
36-
- name: Validate Gradle wrapper
37-
uses: gradle/wrapper-validation-action@v1
38-
39-
# Actually build
40-
- uses: actions/cache@v2
41-
with:
42-
path: |
43-
~/.gradle/caches
44-
~/.gradle/wrapper
45-
key: "${{ runner.os }}-spongeapi-${{ hashFiles('**/*.gradle*') }}"
46-
restore-keys: |
47-
${{ runner.os }}-spongeapi-
48-
- name: Setup env variables
49-
run: |
50-
echo "GIT_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
51-
echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
52-
echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
53-
- name: Build with Gradle
54-
run: ./gradlew build
55-
- name: Archive test results
56-
if: "${{ always() }}"
57-
uses: actions/upload-artifact@v2
58-
with:
59-
name: "test-results-${{ matrix.os }}"
60-
path: |
61-
build/reports/
62-
*/build/reports/
63-
64-
# Then publish if we are all set up to do so
65-
- name: Determine status
66-
if: "${{ runner.os == 'Linux' }}"
67-
run: |
68-
VERSION=$(./gradlew :properties | awk '/^version:/ { print $2; }')
69-
if [ "$(echo $VERSION | grep '\-SNAPSHOT')" ]; then
70-
echo "STATUS=snapshot" >> $GITHUB_ENV
71-
else
72-
echo "STATUS=release" >> $GITHUB_ENV
73-
fi
74-
echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV
75-
- name: Publish with Gradle
76-
if: "${{ runner.os == 'Linux' && ((env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/api-')) || (env.STATUS == 'release' && github.event_name == 'release')) }}"
77-
run: ./gradlew -PforceSign=true publish closeAndReleaseStagingRepository
78-
env:
79-
ORG_GRADLE_PROJECT_githubPackagesUsername: "${{ github.actor }}"
80-
ORG_GRADLE_PROJECT_githubPackagesPassword: "${{ secrets.GITHUB_TOKEN }}"
81-
ORG_GRADLE_PROJECT_spongeSnapshotRepo: "${{ secrets.SPONGE_MAVEN_SNAPSHOT_REPO_URL }}"
82-
ORG_GRADLE_PROJECT_spongeReleaseRepo: "${{ secrets.SPONGE_MAVEN_RELEASE_REPO_URL }}"
83-
ORG_GRADLE_PROJECT_spongeUsername: "${{ secrets.SPONGE_MAVEN_REPO_USER }}"
84-
ORG_GRADLE_PROJECT_spongePassword: "${{ secrets.SPONGE_MAVEN_REPO_PASSWORD }}"
85-
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SPONGE_MAVEN_OSSRH_USER }}"
86-
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SPONGE_MAVEN_OSSRH_PASSWORD }}"
87-
ORG_GRADLE_PROJECT_spongeSigningKey: "${{ secrets.SPONGE_SIGNING_KEY }}"
88-
ORG_GRADLE_PROJECT_spongeSigningPassword: "${{ secrets.SPONGE_SIGNING_PASSWORD }}"
89-
- name: Publish Javadoc
90-
if: "${{ runner.os == 'Linux' && ((env.STATUS != 'release' && github.event_name == 'push' && startsWith(github.ref, 'refs/heads/api-')) || (env.STATUS == 'release' && github.event_name == 'release')) }}"
91-
run: |
92-
git clone [email protected]:SpongePowered/APIJavadocs.git publish-jd -b data -c core.sshCommand="$(git config --local --get core.sshCommand)" -c user.name=Spongie -c user.email="[email protected]"
93-
cd publish-jd
94-
DESTDIR="$PROJECT_NAME/$PROJECT_VERSION"
95-
rm -rf $DESTDIR
96-
mkdir -p $DESTDIR
97-
cp -R ../build/docs/javadoc/* $DESTDIR
98-
git add .
99-
git commit -m "Publishing javadoc for $PROJECT_NAME $PROJECT_VERSION"
100-
git push origin
101-
cd ..
102-
rm -rf publish-jd
14+
call-build:
15+
uses: SpongePowered/.github/.github/workflows/shared-ci.yaml@master
16+
with:
17+
publish_snapshot_javadoc: true
18+
secrets: inherit

build.gradle.kts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import net.ltgt.gradle.errorprone.errorprone
33
plugins {
44
eclipse
55
id("org.spongepowered.gradle.sponge.dev")
6-
id("net.kyori.indra.publishing")
76
id("net.kyori.indra.checkstyle")
7+
id("net.kyori.indra.crossdoc")
8+
id("net.kyori.indra.publishing")
89
id("net.kyori.indra.publishing.sonatype")
910
id("org.spongepowered.gradle.event-impl-gen")
1011
id("org.jetbrains.gradle.plugin.idea-ext")
@@ -148,8 +149,10 @@ tasks {
148149
attributes("Specification-Vendor" to "SpongePowered")
149150
attributes("Specification-Title" to "SpongeAPI")
150151
attributes("Specification-Version" to project.version)
151-
System.getenv()["GIT_COMMIT"]?.apply { attributes("Git-Commit" to this) }
152-
System.getenv()["GIT_BRANCH"]?.apply { attributes("Git-Branch" to this) }
152+
if (!indraGit.isPresent) {
153+
throw InvalidUserDataException("SpongeAPI must be built as a Git checkout, rather than through a zip/tar export")
154+
}
155+
indraGit.applyVcsInformationToManifest(this)
153156
}
154157
}
155158

@@ -241,7 +244,7 @@ spongeConvention {
241244

242245
indra {
243246
javaVersions {
244-
testWith(8, 11, 16)
247+
testWith(8, 11, 17)
245248
}
246249

247250
configurePublications {
@@ -253,6 +256,10 @@ indra {
253256
}
254257
}
255258

259+
indraCrossdoc {
260+
baseUrl(providers.gradleProperty("javadocPublishRoot"))
261+
}
262+
256263
val sortClasses = listOf(
257264
"org.spongepowered.api.advancement.AdvancementTypes",
258265
"org.spongepowered.api.advancement.criteria.trigger.Triggers",

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ organization=SpongePowered
44
projectUrl=https://www.spongepowered.org
55
projectDescription=A plugin API for Minecraft: Java Edition
66

7+
javadocPublishRoot=https://jd.spongepowered.org/
8+
79
org.gradle.parallel=true
810

911
adventureVersion=4.10.0

gradle/wrapper/gradle-wrapper.jar

1.19 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015-2021 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -32,10 +32,10 @@
3232
# Busybox and similar reduced shells will NOT work, because this script
3333
# requires all of these POSIX shell features:
3434
# * functions;
35-
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36-
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37-
# * compound commands having a testable exit status, especially «case»;
38-
# * various built-in commands including «command», «set», and «ulimit».
35+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37+
# * compound commands having a testable exit status, especially «case»;
38+
# * various built-in commands including «command», «set», and «ulimit».
3939
#
4040
# Important for patching:
4141
#
@@ -205,6 +205,12 @@ set -- \
205205
org.gradle.wrapper.GradleWrapperMain \
206206
"$@"
207207

208+
# Stop when "xargs" is not available.
209+
if ! command -v xargs >/dev/null 2>&1
210+
then
211+
die "xargs is not available"
212+
fi
213+
208214
# Use "xargs" to parse quoted args.
209215
#
210216
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

gradlew.bat

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,7 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
2929
set APP_BASE_NAME=%~n0
3030
set APP_HOME=%DIRNAME%
3131

@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
43+
if %ERRORLEVEL% equ 0 goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7575

7676
:end
7777
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
78+
if %ERRORLEVEL% equ 0 goto mainEnd
7979

8080
:fail
8181
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8282
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
83+
set EXIT_CODE=%ERRORLEVEL%
84+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
85+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
86+
exit /b %EXIT_CODE%
8587

8688
:mainEnd
8789
if "%OS%"=="Windows_NT" endlocal

settings.gradle.kts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ pluginManagement {
77
}
88
}
99
plugins {
10-
val indraVersion = "2.0.6"
10+
val indraVersion = "2.1.1"
1111
id("org.spongepowered.gradle.event-impl-gen") version "7.0.0"
12-
id("org.spongepowered.gradle.sponge.dev") version "1.1.1"
13-
id("org.jetbrains.gradle.plugin.idea-ext") version "1.0"
14-
id("net.ltgt.errorprone") version "2.0.1"
12+
id("org.spongepowered.gradle.sponge.dev") version "2.0.2"
13+
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.5"
14+
id("net.ltgt.errorprone") version "2.0.2"
1515
id("net.kyori.indra.publishing") version indraVersion
1616
id("net.kyori.indra.publishing.sonatype") version indraVersion
1717
id("net.kyori.indra.checkstyle") version indraVersion
18+
id("net.kyori.indra.crossdoc") version indraVersion
1819
}
1920
}

0 commit comments

Comments
 (0)