Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
update buildSrc code and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
xenoterracide committed Sep 11, 2023
1 parent 33e247d commit 8cee0c5
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 110 deletions.
16 changes: 16 additions & 0 deletions .config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" ?>
<FindBugsFilter
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://github.com/spotbugs/filter/3.0.0"
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd"
>
<!--
<Match>
<And>
<BugPattern name="EI_EXPOSE_REP" />
<Package name="com.xenoterracide.ai.wh40k.game" />
<Method name="grid" />
</And>
</Match>
-->
</FindBugsFilter>
11 changes: 11 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: gradle/gradle-build-action@v2
- run: ./gradlew build
66 changes: 29 additions & 37 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ name: "CodeQL"

on:
push:
branches: [ "master" ]
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '24 15 * * 1'

branches: ["main"]
jobs:
analyze:
name: Analyze
Expand All @@ -32,45 +28,41 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
language: ["java"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

- name: Checkout repository
uses: actions/checkout@v3

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
- uses: gradle/gradle-build-action@v2
- run: ./gradlew testClasses
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
17 changes: 17 additions & 0 deletions .github/workflows/full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Full Unoptimized Build
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
full:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: gradle/gradle-build-action@v2
with:
cache-disabled: true
- run: ./gradlew build --no-build-cache --no-configuration-cache
10 changes: 5 additions & 5 deletions buildSrc/gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ com.diffplug.durian:durian-collect:1.2.0=buildScriptClasspath,runtimeClasspath
com.diffplug.durian:durian-core:1.2.0=buildScriptClasspath,runtimeClasspath
com.diffplug.durian:durian-io:1.2.0=buildScriptClasspath,runtimeClasspath
com.diffplug.durian:durian-swt.os:4.2.0=buildScriptClasspath,runtimeClasspath
com.diffplug.spotless:spotless-lib-extra:2.40.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.diffplug.spotless:spotless-lib:2.40.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.diffplug.spotless:spotless-plugin-gradle:6.20.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.github.ben-manes:gradle-versions-plugin:0.47.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.github.spotbugs.snom:spotbugs-gradle-plugin:5.1.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.diffplug.spotless:spotless-lib-extra:2.41.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.diffplug.spotless:spotless-lib:2.41.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.diffplug.spotless:spotless-plugin-gradle:6.21.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.github.ben-manes:gradle-versions-plugin:0.48.0=buildScriptClasspath,compileClasspath,runtimeClasspath
com.github.spotbugs.snom:spotbugs-gradle-plugin:5.1.3=buildScriptClasspath,compileClasspath,runtimeClasspath
com.googlecode.concurrent-trees:concurrent-trees:2.6.1=buildScriptClasspath,runtimeClasspath
com.googlecode.javaewah:JavaEWAH:1.2.3=buildScriptClasspath,runtimeClasspath
com.squareup.moshi:moshi-kotlin:1.12.0=buildScriptClasspath,runtimeClasspath
Expand Down
15 changes: 9 additions & 6 deletions buildSrc/src/main/kotlin/our.coverage.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@ plugins {
`java-base`
}

val coverageMinimum: Property<Double> = project.objects.property<Double>()


tasks.withType<JacocoReport> {
dependsOn(project.tasks.withType<Test>())
}

val verification = tasks.withType<JacocoCoverageVerification> {
project.tasks.check.configure {
dependsOn(tasks.withType<JacocoCoverageVerification>())
}

tasks.withType<JacocoCoverageVerification>().configureEach {
dependsOn(project.tasks.withType<JacocoReport>())
violationRules {
rule {
limit {
minimum = 0.9.toBigDecimal()
coverageMinimum.convention(0.9).let { minimum = it.get().toBigDecimal() }
}
}
}
}

project.tasks.check.configure {
dependsOn(verification)
}
1 change: 0 additions & 1 deletion buildSrc/src/main/kotlin/our.java-library.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ plugins {
id("our.checkstyle")
id("our.spotbugs")
id("our.spotless")
id("our.coverage")
}
9 changes: 3 additions & 6 deletions buildSrc/src/main/kotlin/our.java-test.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import java.io.FileNotFoundException

plugins {
`java-library`
Expand All @@ -21,15 +20,13 @@ dependencies {
}

val available = tasks.register("tests available") {
val ss = sourceSets;
val java: Provider<FileCollection> = sourceSets.test.map { it.java }
doLast {
ss.getByName("test") {
if (java.isEmpty) throw FileNotFoundException("no tests found")
}
if (java.get().isEmpty) throw RuntimeException("no tests found")
}
}

tasks.test.configure {
tasks.withType<Test>().configureEach {
useJUnitPlatform()

// See: https://github.com/google/compile-testing/issues/222
Expand Down
10 changes: 5 additions & 5 deletions buildSrc/src/main/kotlin/our.spotbugs.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import com.github.spotbugs.snom.Confidence
import com.github.spotbugs.snom.Effort
import com.github.spotbugs.snom.SpotBugsTask
import org.gradle.accessors.dm.LibrariesForLibs

plugins {
`java-base`
id("com.github.spotbugs")
}

spotbugs {
val config = rootProject.file(".config/spotbugs/exclude.xml")
if (config.exists()) {
excludeFilter.set(config)
}
excludeFilter.set(rootProject.file(".config/spotbugs/exclude.xml"))
effort.set(Effort.MAX)
reportLevel.set(Confidence.LOW)
}
Expand All @@ -22,6 +20,8 @@ tasks.withType<SpotBugsTask>().configureEach {
}
}

val libs = the<LibrariesForLibs>()

dependencies {
spotbugs("com.github.spotbugs:spotbugs:4.5.3")
spotbugs(libs.spotbugs)
}
16 changes: 7 additions & 9 deletions buildSrc/src/main/kotlin/our.spotless.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.diffplug.gradle.spotless.SpotlessTask
import org.gradle.kotlin.dsl.support.normaliseLineSeparators

plugins {
Expand All @@ -6,21 +7,18 @@ plugins {
}

val copyright = "Copyright © \$YEAR Caleb Cushing."
val license = "Apache 2.0. See https://github.com/xenoterracide/brix/LICENSE.txt"
val licenseSimple = "https://choosealicense.com/licenses/apache-2.0/#"

spotless {
val isCI = providers.environmentVariable("CI").isPresent
ratchetFrom = if (isCI) "HEAD~1" else "HEAD"
tasks.withType<SpotlessTask>().configureEach {
enabled = !providers.environmentVariable("CI").isPresent
}

spotless {
java {
licenseHeader(
"""
/**
/*
$copyright
$license
$licenseSimple
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -34,7 +32,7 @@ spotless {
See the License for the specific language governing permissions and
limitations under the License.
**/
*/
""".trimIndent().normaliseLineSeparators()
)
}
Expand Down
55 changes: 31 additions & 24 deletions gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
antlr:antlr:2.7.7=checkstyle
aopalliance:aopalliance:1.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.github.ben-manes.caffeine:caffeine:3.0.5=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.github.javaparser:javaparser-core:3.25.4=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
com.github.javaparser:javaparser-core:3.25.5=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.github.spotbugs:spotbugs-annotations:4.5.3=spotbugs
com.github.spotbugs:spotbugs:4.5.3=spotbugs
com.github.spotbugs:spotbugs-annotations:4.7.3=spotbugs
com.github.spotbugs:spotbugs:4.7.3=spotbugs
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.auto.service:auto-service-annotations:1.1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
com.google.auto.service:auto-service:1.1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
Expand All @@ -16,14 +16,14 @@ com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,errorprone,
com.google.auto.value:auto-value:1.10=testCompileClasspath,testRuntimeClasspath
com.google.auto:auto-common:1.2.1=annotationProcessor,compileClasspath,errorprone,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testFixturesAnnotationProcessor,testFixturesRuntimeClasspath,testRuntimeClasspath
com.google.code.findbugs:jsr305:3.0.2=annotationProcessor,checkstyle,compileClasspath,errorprone,runtimeClasspath,spotbugs,testAnnotationProcessor,testCompileClasspath,testFixturesAnnotationProcessor,testFixturesRuntimeClasspath,testRuntimeClasspath
com.google.code.gson:gson:2.8.9=spotbugs
com.google.errorprone:error_prone_annotation:2.21.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.code.gson:gson:2.9.1=spotbugs
com.google.errorprone:error_prone_annotation:2.21.1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:error_prone_annotations:2.18.0=runtimeClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
com.google.errorprone:error_prone_annotations:2.21.0=annotationProcessor,compileClasspath,errorprone,testAnnotationProcessor,testCompileClasspath,testFixturesAnnotationProcessor,testFixturesCompileClasspath
com.google.errorprone:error_prone_annotations:2.21.1=annotationProcessor,compileClasspath,errorprone,testAnnotationProcessor,testCompileClasspath,testFixturesAnnotationProcessor,testFixturesCompileClasspath
com.google.errorprone:error_prone_annotations:2.5.1=checkstyle
com.google.errorprone:error_prone_check_api:2.21.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:error_prone_core:2.21.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:error_prone_type_annotations:2.21.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:error_prone_check_api:2.21.1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:error_prone_core:2.21.1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:error_prone_type_annotations:2.21.1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.google.errorprone:javac:9+181-r4173-1=errorproneJavac
com.google.guava:failureaccess:1.0.1=annotationProcessor,checkstyle,compileClasspath,errorprone,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testFixturesAnnotationProcessor,testFixturesRuntimeClasspath,testRuntimeClasspath
com.google.guava:guava-parent:32.1.1-jre=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
Expand All @@ -38,29 +38,35 @@ com.google.protobuf:protobuf-java:3.19.6=annotationProcessor,errorprone,testAnno
com.google.testing.compile:compile-testing:0.21.0=testCompileClasspath,testRuntimeClasspath
com.google.truth:truth:1.1.3=testCompileClasspath,testRuntimeClasspath
com.puppycrawl.tools:checkstyle:8.45.1=checkstyle
com.uber.nullaway:nullaway:0.10.11=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
com.uber.nullaway:nullaway:0.10.14=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
commons-beanutils:commons-beanutils:1.9.4=checkstyle
commons-codec:commons-codec:1.15=spotbugs
commons-collections:commons-collections:3.2.2=checkstyle
info.picocli:picocli:4.6.1=checkstyle
io.github.eisop:dataflow-errorprone:3.34.0-eisop1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
io.github.java-diff-utils:java-diff-utils:4.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
javax.inject:javax.inject:1=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
jaxen:jaxen:1.2.0=spotbugs
net.bytebuddy:byte-buddy:1.12.23=testCompileClasspath,testRuntimeClasspath
net.bytebuddy:byte-buddy:1.14.6=testCompileClasspath,testRuntimeClasspath
net.jcip:jcip-annotations:1.0=spotbugs
net.sf.saxon:Saxon-HE:10.5=checkstyle
net.sf.saxon:Saxon-HE:10.6=spotbugs
net.sf.saxon:Saxon-HE:11.4=spotbugs
org.antlr:antlr4-runtime:4.9.2=checkstyle
org.apache.bcel:bcel:6.5.0=spotbugs
org.apache.commons:commons-lang3:3.12.0=compileClasspath,runtimeClasspath,spotbugs,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
org.apache.commons:commons-text:1.9=spotbugs
org.apache.commons:commons-text:1.10.0=spotbugs
org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs
org.apache.httpcomponents.core5:httpcore5-h2:5.1.3=spotbugs
org.apache.httpcomponents.core5:httpcore5:5.1.3=spotbugs
org.apache.logging.log4j:log4j-api:2.19.0=spotbugs
org.apache.logging.log4j:log4j-api:2.20.0=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.19.0=spotbugs
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath
org.assertj:assertj-core:3.24.2=testCompileClasspath,testRuntimeClasspath
org.checkerframework:checker-qual:3.33.0=annotationProcessor,errorprone,runtimeClasspath,testAnnotationProcessor,testFixturesAnnotationProcessor,testFixturesRuntimeClasspath,testRuntimeClasspath
org.checkerframework:checker-qual:3.37.0=compileClasspath,testCompileClasspath,testFixturesCompileClasspath
org.checkerframework:checker-qual:3.38.0=compileClasspath,testCompileClasspath,testFixturesCompileClasspath
org.checkerframework:checker-qual:3.8.0=checkstyle
org.checkerframework:dataflow-nullaway:3.26.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
org.checkerframework:dataflow-nullaway:3.38.0=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
org.dom4j:dom4j:2.1.3=spotbugs
org.eclipse.jgit:org.eclipse.jgit:4.4.1.201607150455-r=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
org.jacoco:org.jacoco.agent:0.8.9=jacocoAgent,jacocoAnt
Expand All @@ -75,21 +81,22 @@ org.junit.platform:junit-platform-commons:1.10.0=testCompileClasspath,testRuntim
org.junit.platform:junit-platform-engine:1.10.0=testRuntimeClasspath
org.junit.platform:junit-platform-launcher:1.10.0=testRuntimeClasspath
org.junit:junit-bom:5.10.0=testCompileClasspath,testRuntimeClasspath
org.junit:junit-bom:5.8.2=spotbugs
org.junit:junit-bom:5.9.1=spotbugs
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath
org.ow2.asm:asm-analysis:9.2=spotbugs
org.ow2.asm:asm-commons:9.2=spotbugs
org.ow2.asm:asm-analysis:9.4=spotbugs
org.ow2.asm:asm-commons:9.4=spotbugs
org.ow2.asm:asm-commons:9.5=jacocoAnt
org.ow2.asm:asm-tree:9.2=spotbugs
org.ow2.asm:asm-tree:9.4=spotbugs
org.ow2.asm:asm-tree:9.5=jacocoAnt
org.ow2.asm:asm-util:9.2=spotbugs
org.ow2.asm:asm-util:9.4=spotbugs
org.ow2.asm:asm:9.1=testCompileClasspath,testRuntimeClasspath
org.ow2.asm:asm:9.2=spotbugs
org.ow2.asm:asm:9.4=spotbugs
org.ow2.asm:asm:9.5=jacocoAnt
org.pcollections:pcollections:3.1.4=annotationProcessor,errorprone,testAnnotationProcessor,testFixturesAnnotationProcessor
org.reflections:reflections:0.9.12=checkstyle
org.slf4j:slf4j-api:1.8.0-beta4=spotbugs
org.slf4j:slf4j-api:2.0.0=spotbugsSlf4j
org.slf4j:slf4j-api:2.0.0=spotbugs,spotbugsSlf4j
org.slf4j:slf4j-simple:2.0.0=spotbugsSlf4j
org.springframework.boot:spring-boot-starter-parent:2.7.14=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
org.springframework.boot:spring-boot-starter-parent:3.1.3=compileClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath
org.xmlresolver:xmlresolver:4.4.3=spotbugs
xml-apis:xml-apis:1.4.01=spotbugs
empty=actualSpotbugsPlugins,spotbugsPlugins
Loading

0 comments on commit 8cee0c5

Please sign in to comment.