🎨 Add spotless formatting (#2)
* 🎨 Add spotless formatting * 🚧 Add formatting check * 🚧 Fix workflow label, Add build workflow * 🛠️ Fix typos * 🏃 Make binaries ~run~executable * 🔧 Fix step name
This commit is contained in:
parent
e75ac48743
commit
56d6b8694a
7 changed files with 79 additions and 0 deletions
25
.github/workflows/build.yml
vendored
Normal file
25
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
- name: Build gradle project
|
||||
run: ./gradlew build
|
28
.github/workflows/formatting.yml
vendored
Normal file
28
.github/workflows/formatting.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: Check formatting
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
check-formatting:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 21
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Run formatting check
|
||||
run: ./gradlew spotlessCheck
|
7
.prettierrc.yml
Normal file
7
.prettierrc.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
plugins:
|
||||
- prettier-plugin-java
|
||||
parser: java
|
||||
printWidth: 120
|
||||
tabWidth: 4
|
||||
singleQuote: false
|
||||
useTabs: false
|
|
@ -2,11 +2,16 @@ plugins {
|
|||
java
|
||||
id("org.springframework.boot") version "3.3.5"
|
||||
id("io.spring.dependency-management") version "1.1.6"
|
||||
id("com.diffplug.spotless") version "6.25.0"
|
||||
}
|
||||
|
||||
group = "io.github.markl4yg.hca"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
|
||||
apply(
|
||||
from = file("./gradle/spotless.gradle")
|
||||
)
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
|
|
14
gradle/spotless.gradle
Normal file
14
gradle/spotless.gradle
Normal file
|
@ -0,0 +1,14 @@
|
|||
import java.nio.charset.StandardCharsets
|
||||
|
||||
spotless {
|
||||
enforceCheck(false)
|
||||
ratchetFrom "origin/main"
|
||||
|
||||
java {
|
||||
target "src/**/java/**/*.java"
|
||||
encoding(StandardCharsets.UTF_8)
|
||||
removeUnusedImports()
|
||||
prettier(['prettier': '3.0.3', 'prettier-plugin-java': '2.3.0'])
|
||||
.configFile('.prettierrc.yml')
|
||||
}
|
||||
}
|
0
gradlew
vendored
Normal file → Executable file
0
gradlew
vendored
Normal file → Executable file
0
gradlew.bat
vendored
Normal file → Executable file
0
gradlew.bat
vendored
Normal file → Executable file
Loading…
Add table
Reference in a new issue