Skip to content

Commit

Permalink
Latest conventions (#191)
Browse files Browse the repository at this point in the history
* Latest conventions

* latest

* latest
  • Loading branch information
big-andy-coates authored Aug 18, 2023
1 parent 9217c41 commit b82e8d2
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 12 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
tags: [ "v*.*.*" ]
pull_request:
branches: [ main ]
schedule:
- cron: "39 5 1,15 * *"
workflow_dispatch:
inputs:
publish_artifacts:
Expand Down Expand Up @@ -36,7 +38,10 @@ jobs:
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
with:
gradle-home-cache-cleanup: true
- name: Build
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

jobs:
analyze:
name: Analyze
if: ${{ github.run_number != 1 }}
runs-on: ubuntu-latest
permissions:
actions: read
Expand All @@ -37,7 +37,11 @@ jobs:
with:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Setup Gradle
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
with:
gradle-home-cache-cleanup: true

- name: Build
run: ./gradlew test
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
name: Dependabot
on:
pull_request:
branches:
- main
branches: [ main ]

permissions:
contents: read
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Dependencies

on:
push:
branches: [ main ]
tags: [ "v*.*.*" ]
schedule:
- cron: "39 5 1,15 * *"
pull_request:
branches: [ main ]

permissions: read-all

jobs:
submit-dependencies:
permissions:
contents: write # required to submit dependencies report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0
- name: Set up JDK
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
with:
java-version: '17'
distribution: 'adopt'
- name: Setup Gradle
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
with:
dependency-graph: generate-and-submit
gradle-home-cache-cleanup: true
- name: Generate dependency report
run: ./gradlew dependencies allDeps
- name: Generate dependency report for buildSrc
run: (cd buildSrc && ../gradlew dependencies)

6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ jobs:
with:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Setup Gradle
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
with:
gradle-home-cache-cleanup: true
- name: Ensure build is green
run: ./gradlew build
- name: Release
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ jobs:
with:
java-version: '17'
distribution: 'adopt'
cache: gradle

- name: Setup Gradle
uses: gradle/gradle-build-action@a4cf152f482c7ca97ef56ead29bf08bcd953284c # v2.7.0
with:
gradle-home-cache-cleanup: true
- name: Increment version
if: contains(fromJson('["Major", "Minor", "Patch"]'), github.event.inputs.part)
run: |
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
* limitations under the License.
*/

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.4.0"
}
21 changes: 16 additions & 5 deletions buildSrc/src/main/kotlin/creek-common-convention.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
*
* <p>Apply to all java modules, usually excluding the root project in multi-module sets.
*
* <p>Version: 1.7
* <p>Version: 1.9
* - 1.9: Add `allDeps` task.
* - 1.8: Tweak test config to reduce build speed.
* - 1.7: Switch to setting Java version via toolchain
* - 1.6: Remove GitHub packages for snapshots
* - 1.5: Add filters to exclude generated sources
Expand Down Expand Up @@ -70,8 +72,8 @@ tasks.withType<JavaCompile> {

tasks.test {
useJUnitPlatform()
setForkEvery(1)
maxParallelForks = 4
setForkEvery(5)
maxParallelForks = Runtime.getRuntime().availableProcessors()
testLogging {
showStandardStreams = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
Expand Down Expand Up @@ -117,17 +119,26 @@ if (rootProject.name != project.name) {
}
}

tasks.register("format") {
val format = tasks.register("format") {
group = "creek"
description = "Format the code"

dependsOn("spotlessCheck", "spotlessApply")
}

tasks.register("static") {
val static = tasks.register("static") {
group = "creek"
description = "Run static code analysis"

dependsOn("checkstyleMain", "checkstyleTest", "spotbugsMain", "spotbugsTest")

shouldRunAfter(format)
}

tasks.test {
shouldRunAfter(static)
}

// See: https://solidsoft.wordpress.com/2014/11/13/gradle-tricks-display-dependencies-for-all-subprojects-in-multi-project-build/
tasks.register<DependencyReportTask>("allDeps") {}

0 comments on commit b82e8d2

Please sign in to comment.