Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit bb69d4e

Browse files
authored
Faster building, hopefully better actions workflow (#185)
* Faster building, hopefully better actions workflow * More!!! * Another test * fix * Hopefully fix Bintray publishing while we're at it * Checkstyle doesn't need to wait until build is done anymore * One last oopsie and we're good for merge.
1 parent dc6fe55 commit bb69d4e

File tree

10 files changed

+88
-78
lines changed

10 files changed

+88
-78
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,40 @@ on:
88

99
jobs:
1010
build:
11+
strategy:
12+
matrix:
13+
java-version: [1.8, 11, 14]
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v2
1417
- uses: actions/setup-java@v1
1518
with:
16-
java-version: 8
17-
# https://github.com/actions/cache/blob/master/examples.md#java---gradle
18-
- uses: actions/cache@v2
19-
with:
20-
path: ~/.gradle/caches
21-
key: ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*') }}
22-
restore-keys: |
23-
${{ runner.os }}-gradle-
19+
java-version: ${{ matrix.java-version }}
2420
- uses: eskatos/gradle-command-action@v1
2521
with:
22+
gradle-version: wrapper
2623
arguments: remapJar
24+
dependencies-cache-enabled: true
25+
configuration-cache-enabled: false
2726
# Artifact publishing
2827
- uses: actions/upload-artifact@v2
28+
# In theory we could publish the j11 or even j14 jar, but let's not take any chances
29+
if: ${{ matrix.java-version == 1.8 }}
2930
with:
31+
name: Jar Download
3032
path: ./build/libs/patchwork-api-?.?.?.jar
3133

32-
checkstyle:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v2
36-
- uses: actions/setup-java@v1
37-
with:
38-
java-version: 8
39-
- uses: actions/cache@v2
40-
with:
41-
path: ~/.gradle/caches
42-
key: ${{ runner.os }}-gradle-checkstyle-${{ hashFiles('**/*.gradle*') }}
43-
restore-keys: |
44-
${{ runner.os }}-gradle-
45-
- uses: eskatos/gradle-command-action@v1
46-
with:
47-
arguments: checkstyleMain
4834

49-
license:
35+
check:
5036
runs-on: ubuntu-latest
5137
steps:
5238
- uses: actions/checkout@v2
5339
- uses: actions/setup-java@v1
5440
with:
55-
java-version: 8
56-
- uses: actions/cache@v2
57-
with:
58-
path: ~/.gradle/caches
59-
key: ${{ runner.os }}-gradle-license-${{ hashFiles('**/*.gradle*') }}-license
60-
restore-keys: |
61-
${{ runner.os }}-gradle-
41+
java-version: 11
6242
- uses: eskatos/gradle-command-action@v1
6343
with:
64-
arguments: checkLicenses
44+
gradle-version: wrapper
45+
arguments: licenseCheck checkstyleMain
46+
dependencies-cache-enabled: true
47+
configuration-cache-enabled: false

.github/workflows/publish.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ env:
88
bintray_key: ${{ secrets.bintray_key }}
99

1010
jobs:
11-
# bintray:
12-
# runs-on: ubuntu-latest
13-
# steps:
14-
# - uses: actions/checkout@v1
15-
# - uses: actions/setup-java@v1
16-
# with:
17-
# java-version: 8
18-
# - uses: eskatos/gradle-command-action@v1
19-
# with:
20-
# arguments: bintrayUpload
2111
release:
2212
runs-on: ubuntu-latest
2313
steps:
@@ -43,4 +33,7 @@ jobs:
4333
java-version: 8
4434
- uses: eskatos/gradle-command-action@v1
4535
with:
36+
gradle-version: wrapper
4637
arguments: bintrayUpload
38+
dependencies-cache-enabled: true
39+
configuration-cache-enabled: false

build.gradle

Lines changed: 59 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'eclipse'
44
id 'idea'
55
id 'maven-publish'
6-
id 'fabric-loom' version '0.4-SNAPSHOT' apply false
6+
id 'fabric-loom' version '0.5-SNAPSHOT' apply false
77
id 'net.minecrell.licenser' version '0.4.1'
88
id "org.ajoberstar.grgit" version "3.1.1"
99
id 'com.jfrog.bintray' version '1.8.4'
@@ -52,6 +52,14 @@ allprojects {
5252

5353
group = "net.patchworkmc.patchwork-api"
5454

55+
loom {
56+
shareCaches = true
57+
}
58+
59+
repositories {
60+
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
61+
}
62+
5563
dependencies {
5664
minecraft "com.mojang:minecraft:$Globals.mcVersion"
5765
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
@@ -69,10 +77,6 @@ allprojects {
6977
dev
7078
}
7179

72-
repositories {
73-
maven { url 'https://dl.bintray.com/patchworkmc/Patchwork-Maven/' }
74-
}
75-
7680
jar {
7781
classifier = "dev"
7882
}
@@ -113,7 +117,7 @@ allprojects {
113117

114118
checkstyle {
115119
configFile = rootProject.file("checkstyle.xml")
116-
toolVersion = '8.25'
120+
toolVersion = '8.31'
117121
}
118122
}
119123

@@ -136,39 +140,50 @@ subprojects {
136140

137141
publishing {
138142
publications {
139-
mavenJava(MavenPublication) {
140-
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
141-
builtBy remapMavenJar
142-
}
143-
artifact(sourcesJar) {
144-
builtBy remapSourcesJar
143+
create("${archivesBaseName}_mavenJava", MavenPublication) {
144+
afterEvaluate {
145+
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}-maven.jar")) {
146+
builtBy remapMavenJar
147+
}
148+
artifact(sourcesJar) {
149+
builtBy remapSourcesJar
150+
}
145151
}
146152
}
147153
}
154+
}
148155

149-
repositories {
150-
maven {
151-
url "http://mavenupload.modmuss50.me/"
152-
if (project.hasProperty('mavenPass')) {
153-
credentials {
154-
username 'buildslave'
155-
password project.getProperty('mavenPass')
156-
}
157-
}
156+
bintray {
157+
user = project.hasProperty('bintrayUser') ? project.getProperty('bintrayUser') : System.getenv('bintray_user')
158+
key = project.hasProperty('bintrayKey') ? project.getProperty('bintrayKey') : System.getenv('bintray_key')
159+
publish = true
160+
override = true
161+
publications = ["${archivesBaseName}_mavenJava"]
162+
pkg {
163+
repo = project.bintrayRepo
164+
name = archivesBaseName
165+
user = bintray.user
166+
userOrg = project.repoOwner
167+
licenses = [project.codeLicense]
168+
desc = project.description
169+
websiteUrl = "https://github.com/${project.repoOwner}/${project.repoName}"
170+
issueTrackerUrl = "https://github.com/${project.repoOwner}/${project.repoName}/issues"
171+
vcsUrl = "https://github.com/${project.repoOwner}/${project.repoName}.git"
172+
publicDownloadNumbers = true
173+
174+
githubRepo = "${project.repoOwner}/${project.repoName}"
175+
version {
176+
name = project.version
177+
released = new Date()
158178
}
159179
}
160180
}
161181

162182
javadoc.enabled = false
163183
}
164184

165-
task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
166-
afterEvaluate {
167-
input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
168-
archiveName = "${archivesBaseName}-${version}-maven.jar"
169-
addNestedDependencies = false
170-
}
171-
}
185+
subprojects.each { bintrayUpload.dependsOn("${it.path}:bintrayUpload") }
186+
172187
bintray {
173188
user = project.hasProperty('bintrayUser') ? project.getProperty('bintrayUser') : System.getenv('bintray_user')
174189
key = project.hasProperty('bintrayKey') ? project.getProperty('bintrayKey') : System.getenv('bintray_key')
@@ -193,7 +208,18 @@ bintray {
193208
released = new Date()
194209
}
195210
}
211+
212+
javadoc.enabled = false
196213
}
214+
215+
task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
216+
afterEvaluate {
217+
input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
218+
archiveName = "${archivesBaseName}-${version}-maven.jar"
219+
addNestedDependencies = false
220+
}
221+
}
222+
197223
publishing {
198224
publications {
199225
mavenJava(MavenPublication) {
@@ -220,6 +246,7 @@ publishing {
220246
task licenseFormatAll
221247
subprojects {p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat")}
222248
subprojects.each {remapJar.dependsOn("${it.path}:remapJar")}
249+
223250
repositories {
224251
flatDir {
225252
dirs 'jars'
@@ -265,6 +292,10 @@ dependencies {
265292
}
266293
}
267294

295+
loom {
296+
shareCaches = true
297+
}
298+
268299
version = Globals.baseVersion //+ "+" + (ENV.BUILD_NUMBER ? ("build." + ENV.BUILD_NUMBER) : "local") + "-" + getBranch()
269300

270301
logger.lifecycle("Building Patchwork: " + version)

gradle.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
org.gradle.jvmargs=-Xmx2G
1+
# Gradle needs a lot of memory to build in parallel.
2+
# If you're starved, you can reduce this to 1G and disable parallel building.
3+
org.gradle.jvmargs=-Xmx3G
4+
org.gradle.parallel=true
5+
org.gradle.daemon=false
26
repoName=patchwork-api
37
repoOwner=patchworkmc
48
bintrayRepo=Patchwork-Maven

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip

patchwork-extensions-block/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ dependencies {
88
implementation project(path: ':patchwork-tooltype', configuration: 'dev')
99
}
1010

11-
minecraft {
11+
loom {
1212
accessWidener "src/main/resources/patchwork-extensions-block.accesswidener"
1313
}

patchwork-level-generators/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ dependencies {
77
implementation project(path: ':patchwork-events-world', configuration: 'dev')
88
}
99

10-
minecraft {
10+
loom {
1111
accessWidener "src/main/resources/patchwork-level-generators.accesswidener"
1212
}

patchwork-registries/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ dependencies {
66
implementation project(path: ':patchwork-fml', configuration: 'dev')
77
}
88

9-
minecraft {
9+
loom {
1010
accessWidener "src/main/resources/patchwork-registries.accesswidener"
1111
}

patchwork-tags/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ dependencies {
55
implementation project(path: ':patchwork-api-base', configuration: 'dev')
66
}
77

8-
minecraft {
8+
loom {
99
accessWidener "src/main/resources/patchwork-tags.accesswidener"
1010
}

settings.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ include 'patchwork-resource'
4545
include 'patchwork-tags'
4646
include 'patchwork-tooltype'
4747
include 'patchwork-vanilla-patches'
48-

0 commit comments

Comments
 (0)