Test across java and gradle versions with github actions. (#218)

* Experiment with github actions

* Fix?

* another fix

* Fix?

* Change github actions run args

* Tried and tested is better right?

* spaces spaces spaces

* revert

* info

* Just 4.9

* Fixes to support building on newer gradle versions

* Forward log output and run tests on runtime gradle version

* Remove travis

* De-duplicate

* Remove daily action, doesnt seem to work so well.
dev/0.11
modmuss50 2020-06-08 15:19:11 +01:00 committed by GitHub
parent fdbdcc4bbf
commit b1ae5dee5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 42 deletions

30
.github/workflows/test-push.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Run Tests
on: [push, pull_request]
jobs:
gradle:
strategy:
matrix:
os: [ubuntu-20.04, windows-latest]
gradle-version: [4.9, 4.10.2, 5.6.4, 6.5]
java-version: [1.8, 11, 14]
exclude: # Dont run older gradle versions on newer java
- java-version: 14
gradle-version: 4.9
- java-version: 14
gradle-version: 4.10.2
- java-version: 14
gradle-version: 5.6.4
- java-version: 11
gradle-version: 4.9
- java-version: 11
gradle-version: 4.10.2
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- uses: eskatos/gradle-command-action@v1
with:
gradle-version: ${{ matrix.gradle-version }}
arguments: build check test --stacktrace

2
.gitignore vendored
View File

@ -4,6 +4,7 @@
# Folders
!/gradle
!/src
!/.github
# Files
!/.gitattributes
@ -18,5 +19,4 @@
!/README.md
!/settings.gradle
!/Jenkinsfile
!/.travis.yml
!/checkstyle.xml

View File

@ -1,12 +0,0 @@
language: java
install: true
jdk:
- openjdk8
script:
- chmod +x gradlew
- ./gradlew check build test --stacktrace
notifications:
email: false

View File

@ -47,9 +47,8 @@ dependencies {
}
// tinyfile management
implementation ('net.fabricmc:tiny-remapper:0.3.0.70') {
transitive = false
}
implementation ('net.fabricmc:tiny-remapper:0.3.0.70')
implementation ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
implementation ('net.fabricmc:lorenz-tiny:2.0.0+build.2') {
transitive = false
@ -67,12 +66,8 @@ dependencies {
// Testing
testImplementation(gradleTestKit())
testImplementation("org.spockframework:spock-core:1.3-groovy-2.4")
}
configurations.all {
resolutionStrategy {
force 'org.codehaus.groovy:groovy-all:2.4.12'
testImplementation("org.spockframework:spock-core:1.3-groovy-2.4") {
exclude module: 'groovy-all'
}
}
@ -177,9 +172,4 @@ publishing {
}
}
}
}
configurations.all {
resolutionStrategy {
force 'org.codehaus.groovy:groovy-all:2.4.12'
}
}
}

View File

@ -25,6 +25,7 @@
package net.fabricmc.loom.task;
import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.Internal;
import net.fabricmc.loom.LoomGradleExtension;
@ -33,6 +34,7 @@ public abstract class AbstractLoomTask extends DefaultTask {
setGroup("fabric");
}
@Internal
protected LoomGradleExtension getExtension() {
return getProject().getExtensions().getByType(LoomGradleExtension.class);
}

View File

@ -24,12 +24,10 @@
package net.fabricmc.loom.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.gradle.api.Project;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.model.ObjectFactory;
//This is used to bridge the gap over large gradle api changes.
public class GradleSupport {
@ -41,17 +39,24 @@ public class GradleSupport {
//Nope
}
return getfilePropertyLegacy(project);
try {
return getfilePropertyLegacy(project);
} catch (Exception e) {
throw new RuntimeException("Failed to find file property", e);
}
}
private static RegularFileProperty getfilePropertyModern(Project project) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
ObjectFactory objectFactory = project.getObjects();
Method method = objectFactory.getClass().getDeclaredMethod("fileProperty");
private static RegularFileProperty getfilePropertyModern(Project project) throws Exception {
return getfilePropertyLegacyFromObject(project.getObjects());
}
private static RegularFileProperty getfilePropertyLegacy(Project project) throws Exception {
return getfilePropertyLegacyFromObject(project.getLayout());
}
private static RegularFileProperty getfilePropertyLegacyFromObject(Object object) throws Exception {
Method method = object.getClass().getDeclaredMethod("fileProperty");
method.setAccessible(true);
return (RegularFileProperty) method.invoke(objectFactory);
}
private static RegularFileProperty getfilePropertyLegacy(Project project) {
return project.getLayout().fileProperty();
return (RegularFileProperty) method.invoke(object);
}
}

View File

@ -37,7 +37,7 @@ class EmptyBuildFunctionalTest extends Specification {
.withProjectDir(testProjectDir.root)
.withArguments('build',"--stacktrace")
.withPluginClasspath()
.withGradleVersion("4.9")
.forwardOutput()
.build()
then:

View File

@ -62,7 +62,7 @@ class MixinBuildFunctionalTest extends Specification {
.withProjectDir(testProjectDir.root)
.withArguments('build')
.withPluginClasspath()
.withGradleVersion("4.9")
.forwardOutput()
.build()
then:

View File

@ -47,7 +47,7 @@ class SimpleBuildFunctionalTest extends Specification {
.withProjectDir(testProjectDir.root)
.withArguments('build',"--stacktrace")
.withPluginClasspath()
.withGradleVersion("4.9")
.forwardOutput()
.withDebug(true)
.build()