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
parent
fdbdcc4bbf
commit
b1ae5dee5d
|
@ -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
|
|
@ -4,6 +4,7 @@
|
|||
# Folders
|
||||
!/gradle
|
||||
!/src
|
||||
!/.github
|
||||
|
||||
# Files
|
||||
!/.gitattributes
|
||||
|
@ -18,5 +19,4 @@
|
|||
!/README.md
|
||||
!/settings.gradle
|
||||
!/Jenkinsfile
|
||||
!/.travis.yml
|
||||
!/checkstyle.xml
|
12
.travis.yml
12
.travis.yml
|
@ -1,12 +0,0 @@
|
|||
language: java
|
||||
install: true
|
||||
|
||||
jdk:
|
||||
- openjdk8
|
||||
|
||||
script:
|
||||
- chmod +x gradlew
|
||||
- ./gradlew check build test --stacktrace
|
||||
|
||||
notifications:
|
||||
email: false
|
18
build.gradle
18
build.gradle
|
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,8 +173,3 @@ publishing {
|
|||
}
|
||||
}
|
||||
}
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force 'org.codehaus.groovy:groovy-all:2.4.12'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class EmptyBuildFunctionalTest extends Specification {
|
|||
.withProjectDir(testProjectDir.root)
|
||||
.withArguments('build',"--stacktrace")
|
||||
.withPluginClasspath()
|
||||
.withGradleVersion("4.9")
|
||||
.forwardOutput()
|
||||
.build()
|
||||
|
||||
then:
|
||||
|
|
|
@ -62,7 +62,7 @@ class MixinBuildFunctionalTest extends Specification {
|
|||
.withProjectDir(testProjectDir.root)
|
||||
.withArguments('build')
|
||||
.withPluginClasspath()
|
||||
.withGradleVersion("4.9")
|
||||
.forwardOutput()
|
||||
.build()
|
||||
|
||||
then:
|
||||
|
|
|
@ -47,7 +47,7 @@ class SimpleBuildFunctionalTest extends Specification {
|
|||
.withProjectDir(testProjectDir.root)
|
||||
.withArguments('build',"--stacktrace")
|
||||
.withPluginClasspath()
|
||||
.withGradleVersion("4.9")
|
||||
.forwardOutput()
|
||||
.withDebug(true)
|
||||
.build()
|
||||
|
||||
|
|
Loading…
Reference in New Issue