diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 000000000..1236527da --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,48 @@ +# This workflow will build a Java project with Gradle +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build SlimeVR Server with Gradle + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.3.4 + + - name: Clone Slime Java Commons + uses: actions/checkout@v2.3.4 + with: + repository: Eirenliel/slime-java-commons + # Relative path under $GITHUB_WORKSPACE to place the repository + path: Slime Java Commons + + - name: Set up JDK 11 + uses: actions/setup-java@v2.1.0 + with: + java-version: '11' + distribution: 'adopt' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Test with Gradle + run: ./gradlew clean test + + - name: Build with Gradle + run: ./gradlew clean serverJar + + - name: Upload the Server JAR as a Build Artifact + uses: actions/upload-artifact@v2.2.4 + with: + # Artifact name + name: "SlimeVR-Server" # optional, default is artifact + # A file, directory or wildcard pattern that describes what to upload + path: build/libs/* diff --git a/build.gradle b/build.gradle index dc924bdb1..93b46112d 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,8 @@ repositories { } dependencies { + compile project(':Slime Java Commons') + // This dependency is exported to consumers, that is to say found on their compile classpath. api 'org.apache.commons:commons-math3:3.6.1' api 'org.yaml:snakeyaml:1.25' @@ -33,3 +35,15 @@ dependencies { // Use JUnit test framework testImplementation 'junit:junit:4.12' } + +subprojects.each { subproject -> evaluationDependsOn(subproject.path) } +task serverJar (type: Jar, dependsOn: subprojects.tasks['build']) { + manifest { + attributes 'Main-Class': 'io.eiren.vr.Main' + } + + from { + configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } + } + with jar +}