Skip to content

Commit

Permalink
Many update based on Micronaut Laumch
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospereira committed Nov 25, 2023
1 parent bab04c4 commit 1c2a47d
Show file tree
Hide file tree
Showing 14 changed files with 270 additions and 134 deletions.
5 changes: 3 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ updates:
rebase-strategy: auto
schedule:
interval: "daily"
day: "sunday"
commit-message:
prefix: "[gradle]"
groups:
gradle-patch-updates:
update-types: [ "patch" ]
- package-ecosystem: "github-actions"
directory: "/"
rebase-strategy: auto
schedule:
interval: "weekly"
day: "sunday"
commit-message:
prefix: "[github-actions]"
66 changes: 38 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ on:
pull_request:
branches: [ main ]

permissions:
contents: read

env:
GRADLE_OPTS: "-Dorg.gradle.console=plain"
GRADLE_OPTS: "-Dorg.gradle.console=plain -Dorg.gradle.caching=true -Dkotlin.caching.enabled=true"

jobs:
compile:
Expand All @@ -19,11 +16,14 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v2
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Starts Gradle Daemon
run: ./gradlew
with:
# Runs the gradle wrapper step
gradle-wrapper-validation: true
# Allows this job to write to the cache every time it runs
gradle-cache-read-only: false
- run: ./gradlew testClasses
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY

detekt:
name: Code Analysis / detekt
Expand All @@ -33,7 +33,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: detekt report
uses: natiginfo/[email protected].1
uses: natiginfo/[email protected].3
with:
args: |
--report md:build/reports/detekt/detekt.md
Expand All @@ -53,23 +53,6 @@ jobs:
- name: run ktlin
run: ktlint --relative >> $GITHUB_STEP_SUMMARY

accessibility-test:
name: Tests / Accessibility
runs-on: ubuntu-latest
# Since this job is experimental
continue-on-error: true
needs:
- detekt
- ktlint
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v2
- run: ./gradlew accessibilityTestClasses
- name: Run Accessibility Tests
# For some annoying reason, Gradle insists in execute the `test` task
# too. -x removes it from the task graph for this execution.
run: ./gradlew accessibilityTest

test:
name: Tests / test
runs-on: ubuntu-latest
Expand All @@ -79,7 +62,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v2
- run: ./gradlew koverHtmlReport -x accessibilityTest
- name: Run tests
run: ./gradlew koverHtmlReport -x accessibilityTest
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2
- name: Output Kover summary
Expand All @@ -99,14 +85,16 @@ jobs:
only-summary: "true"

build:
name: Package / build
name: Package / shadowJar
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: Liber-UFPE/spring-gradle-build-action@v2
- run: ./gradlew shadowJar
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY

build-docker:
name: Package / Docker / build
Expand All @@ -118,6 +106,26 @@ jobs:
- uses: Liber-UFPE/spring-gradle-build-action@v2
- name: Run dockerBuild
run: ./gradlew dockerBuild
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY

build-docker-native:
name: Package / Docker / native
runs-on: ubuntu-latest
needs:
- test
steps:
- uses: actions/checkout@v4
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
cache: 'maven'
- name: Run dockerBuildNative
run: GRAALVM_QUICK_BUILD=true ./gradlew dockerBuildNative
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY

check-if-prod:
if: ${{ github.ref == 'refs/heads/main' }}
Expand Down Expand Up @@ -150,6 +158,8 @@ jobs:
- uses: Liber-UFPE/spring-gradle-build-action@v2
- name: Create Release Package
run: ./gradlew clean shadowJar
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY
- name: Create Github Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Gradle Build Action'
description: 'Reusable GitHub Action for performing a gradle build or running a gradle task.'

inputs:
gradle-cache-disabled:
description: 'Caching is enabled by default. You can disable caching for the action using this parameter'
required: false
default: false
gradle-cache-read-only:
description: 'Configure read-only caching for the gradle-build-action'
required: false
default: ${{ github.ref != 'refs/heads/main' }}
gradle-cache-write-only:
description: 'Configure write-only caching for the gradle-build-action'
required: false
default: false

runs:
using: 'composite'
steps:
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: "21"
distribution: "temurin"
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
generate-job-summary: false
cache-disabled: ${{ inputs.gradle-cache-disabled }}
cache-read-only: ${{ inputs.gradle-cache-read-only }}
cache-write-only: ${{ inputs.gradle-cache-write-only }}
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ permissions:
contents: write

env:
GRADLE_OPTS: "-Dorg.gradle.console=plain"
GRADLE_OPTS: "-Dorg.gradle.console=plain -Dorg.gradle.caching=true -Dkotlin.caching.enabled=true"

jobs:
gh-dependency-graph:
Expand All @@ -26,4 +26,6 @@ jobs:
with:
dependency-graph: generate-and-submit
- name: Generate Dependency Graph
run: ./gradlew compileTestKotlin
run: ./gradlew testClasses
- name: Gradle Tasks Summary
run: cat build/reports/build-times.md >> $GITHUB_STEP_SUMMARY
41 changes: 17 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,29 @@
Thumbs.db
.DS_Store
.gradle
**/build/
!src/**/build/

bin

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath
Thum
bs.db
.DS_Store
build/
jte-classes
target/
out/

.lighthouseci
.micronaut/
.vagrant

.idea
*.iml
*.ipr
*.iws

.project
.settings
.classpath
.factorypath

jte-classes
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties
40 changes: 37 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!-- markdownlint-disable MD013 -->

# Project Starter

![CI Workflow](https://github.com/Liber-UFPE/project-starter/actions/workflows/build.yml/badge.svg?branch=main)
![Main Workflow](https://github.com/Liber-UFPE/project-starter/actions/workflows/main.yml/badge.svg?branch=main)

This is a project starter template. There are a few things you need to do after creating your repository using this template:

- [ ] Replace `project-starter`/`PROJECT_STARTER` (and other mentions) with your project's name
- [ ] Replace `project-starter`, `PROJECT_STARTER` (and other mentions) with your project's name
- [ ] Edit `src/main/resources/public/stylesheets/main.css` as needed (different colors, fonts, etc.)
- [ ] Edit `src/main/resources/public/javascript/main.js` as needed
- [ ] Edit `src/main/jte/layout.kte` as necessary to support your project's navigation
Expand Down Expand Up @@ -78,7 +80,7 @@ If you want to reload the application for every code change, run [Gradle in _con

## Requirements

1. Java 17+ (easier to install with [SDKMAN](https://sdkman.io/))
1. Java 21 (easier to install with [SDKMAN](https://sdkman.io/))
2. [Docker Desktop](https://www.docker.com/products/docker-desktop/) (if you want to test docker images)
3. [Ktlint CLI](https://pinterest.github.io/ktlint/1.0.0/install/cli/) (if you want to run code inspections locally)
4. [Gradle](https://gradle.org/install/#with-a-package-manager) (if you don't want to use the `./gradlew` script)
Expand All @@ -100,6 +102,7 @@ The project is developed using Micronaut Framework, [Gradle](https://gradle.org/
It uses JTE/KTE as the template engine.

- [JTE Website](https://jte.gg/)
- [Micronaut JTE Views documentation](https://micronaut-projects.github.io/micronaut-views/latest/guide/#jte)

### CI & CD

Expand All @@ -111,7 +114,7 @@ We use [Kotest](https://kotest.io/) as the test framework, and [Kover](https://g

### Code Inspections

For every merge/push, and also for pull requests, there are GitHub Actions to run [ktlint](https://github.com/pinterest/ktlint) and [detekt](https://github.com/detekt/detekt). There is also an (experimental) integration with [DeepSource](https://deepsource.com/).
For every merge/push, and also for pull requests, there are GitHub Actions to run [ktlint](https://github.com/pinterest/ktlint) and [detekt](https://github.com/detekt/detekt). There is also an (experimental) integration with [DeepSource](https://deepsource.com/).

Ktlint is configured to use `intellij_idea` code style so that it won't conflict with code formatting action in IDEA.

Expand All @@ -130,3 +133,34 @@ Project follow the default [Maven Standard Directory Layout](https://maven.apach
| `src/accessibilityTest` | Root folder for accessibility test code |
| `.github` | Root folder for GitHub configurations |
| `.github/workflows` | GitHub Actions configuration |

## Micronaut 4.2.0 Documentation

- [User Guide](https://docs.micronaut.io/4.2.0/guide/index.html)
- [API Reference](https://docs.micronaut.io/4.2.0/api/index.html)
- [Configuration Reference](https://docs.micronaut.io/4.2.0/guide/configurationreference.html)
- [Micronaut Guides](https://guides.micronaut.io/index.html)

---

- [Shadow Gradle Plugin](https://plugins.gradle.org/plugin/com.github.johnrengelman.shadow)
- [Micronaut Gradle Plugin documentation](https://micronaut-projects.github.io/micronaut-gradle-plugin/latest/)
- [GraalVM Gradle Plugin documentation](https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html)

## Feature serialization-jackson documentation

- [Micronaut Serialization Jackson Core documentation](https://micronaut-projects.github.io/micronaut-serialization/latest/guide/)

## Feature ksp documentation

- [Micronaut Kotlin Symbol Processing (KSP) documentation](https://docs.micronaut.io/latest/guide/#kotlin)
- [https://kotlinlang.org/docs/ksp-overview.html](https://kotlinlang.org/docs/ksp-overview.html)

## Feature kotest documentation

- [Micronaut Test Kotest5 documentation](https://micronaut-projects.github.io/micronaut-test/latest/guide/#kotest5)
- [https://kotest.io/](https://kotest.io/)

## Feature micronaut-aot documentation

- [Micronaut AOT documentation](https://micronaut-projects.github.io/micronaut-aot/latest/guide/)
Loading

0 comments on commit 1c2a47d

Please sign in to comment.