Skip to content

Commit

Permalink
feat(core): Project bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed Feb 5, 2024
1 parent f144663 commit d09c7c8
Show file tree
Hide file tree
Showing 16 changed files with 860 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* eol=lf

# specific for windows script files
*.bat text eol=crlf

# required by gradle on Windows
*.jar eol=auto
buildscript-gradle.lockfile text eol=auto
gradle.lockfile text eol=auto
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: main
pull_request:
workflow_call:

concurrency:
group: ci-${{ github.ref_name }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 21
check-latest: true
- uses: gradle/actions/setup-gradle@v3
- run: ./gradlew compileJava compileTestJava
- run: ./gradlew checkstyleMain checkstyleTest
- run: ./gradlew sonarlintMain sonarlintTest
- run: ./gradlew javadoc
- run: ./gradlew test
- run: ./gradlew build -x check
14 changes: 14 additions & 0 deletions .github/workflows/owner-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto approve for owner

on:
pull_request:
types: [opened, reopened]

jobs:
approve:
if: github.actor == github.repository_owner
runs-on: ubuntu-latest
steps:
- uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
Expand All @@ -22,3 +16,13 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Ignore Gradle project-specific cache directory
.gradle
!gradle/wrapper/gradle-wrapper.jar

# Ignore Gradle build output directory
build

# VSCode
.vscode/
115 changes: 115 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
buildscript {
configurations.classpath {
resolutionStrategy.activateDependencyLocking()
}
}

plugins {
id('checkstyle')
id('java-library')

alias(libs.plugins.prettyJupiter)
alias(libs.plugins.sonarlint)
alias(libs.plugins.strictNullCheck)
}

group = 'io.github.joselion'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.ORACLE
}
withJavadocJar()
withSourcesJar()
}

javadoc {
title = 'Spring R2DBC Relational'
options {
encoding = 'UTF-8'
addBooleanOption('html5', true)
addStringOption('Xwerror', '-quiet')
tags('apiNote')
}
}

jar {
from(sourceSets.main.allSource)
manifest {
attributes(
'Build-Jdk': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-Jdk-Spec': java.sourceCompatibility,
'Created-By': "Gradle ${gradle.gradleVersion}",
'Implementation-Title': project.name,
'Implementation-Vendor': 'Jose Luis Leon',
'Implementation-Version': project.version,
'Package': "${project.group}.${project.name}",
)
}
}

checkstyle {
setToolVersion(libs.versions.checkstyle.get())
}

sonarLint {
setToolVersion(libs.versions.sonarlint.core.get())
languages {
include('java')
}
rules {
enable(
'java:S4266', // "Stream.collect()" calls should not be redundant
)
disable(
'java:S107', // Allow constructors with more than 7 parameters
'java:S3776', // Allow methods with more than 15 lines
'java:S4032', // Allow packages only containing `package-info.java`
)
}
}

strictNullCheck {
addEclipse()
packageInfo {
useEclipse()
javadoc = '@author Jose Luis Leon'
}
}

dependencyLocking {
lockAllConfigurations()
}

// Workaround for: https://github.com/checkstyle/checkstyle/issues/14211
configurations.checkstyle {
resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") {
select("com.google.guava:guava:0")
}
}

repositories {
mavenCentral()
}

dependencies {
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)
sonarlintCorePlugins(libs.sonarlint.java)
}

testing {
suites {
test {
useJUnitJupiter(libs.versions.junit.get())

dependencies {
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)

implementation(libs.assertj.core)
}
}
}
}
Loading

0 comments on commit d09c7c8

Please sign in to comment.