CI & Formatting improvements (#178)

* CI & Formatting improvements

+ Added spotlessCheck to CI
+ Now formatting .yaml files (with spaces)
* Bumped version numbers of actions

* Renamed .yml to .yaml in accordance with yaml.org/faq
This commit is contained in:
Ryan Butler
2022-05-23 13:54:10 +01:00
committed by GitHub
parent 5a4b656a74
commit 57f3624ee7
3 changed files with 70 additions and 66 deletions

61
.github/workflows/gradle.yaml vendored Normal file
View File

@@ -0,0 +1,61 @@
# 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: SlimeVR Server
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Check code formatting
run: ./gradlew spotlessCheck
- name: Test with Gradle
run: ./gradlew test
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew shadowJar
- name: Upload the Server JAR as a Build Artifact
uses: actions/upload-artifact@v3
with:
# Artifact name
name: "SlimeVR-Server" # optional, default is artifact
# A file, directory or wildcard pattern that describes what to upload
path: build/libs/*

View File

@@ -1,57 +0,0 @@
# 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: SlimeVR Server
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v2.4.0
with:
java-version: '11'
distribution: 'adopt'
cache: 'gradle' # will restore cache of dependencies and wrappers
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Test with Gradle
run: ./gradlew clean test
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0
with:
submodules: recursive
- name: Set up JDK 11
uses: actions/setup-java@v2.4.0
with:
java-version: '11'
distribution: 'adopt'
cache: 'gradle' # will restore cache of dependencies and wrappers
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean shadowJar
- 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/*

View File

@@ -90,19 +90,19 @@ spotless {
// define the steps to apply to those files
trimTrailingWhitespace()
endWithNewline()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
indentWithTabs()
}
// format 'yaml', {
// target '*.yml', '*.yaml',
// trimTrailingWhitespace()
// endWithNewline()
// indentWithSpaces(2) // YAML cannot contain tabs: https://yaml.org/faq.html
// }
java {
removeUnusedImports()
// Use eclipse JDT
// Use eclipse JDT formatter
eclipse().configFile("spotless.xml")
// apply a specific flavor of google-java-format
// googleJavaFormat('1.8').aosp().reflowLongStrings()
// make sure every file has the following copyright header.
// optionally, Spotless can set copyright years by digging
// through git history (see "license" section below)
// licenseHeader '/* (C)$YEAR */'
}
}